V39 Up! [MONKEY NEWS]

Monkey Forums/Monkey Programming/V39 Up! [MONKEY NEWS]

marksibly(Posted 2011) [#1]
Hi,

Version 39 is now available.

IMPORTANT : Mac users may have to manually run the program bin/mserver_macos manually just once before running Monk. Otherwise, you'll get a perma-bouncing icon in the taskbar when you try and run html5/flash apps. Will attempt to fix this soon.

The major new features is interfaces, but for now I'm more worried about having broken anyone's code, so please test your projects with this release thoroughly.


Modules:

Mojo SetColor now affects images.

Added Compare method to String type.

Fixed DrawImageRect with 0 sized src rect in Flash.

Android mojo now works with API level 3.

Fixed Android music.


Trans (1.10)

Fixed various parser issues.

Added mserver, minimal monkey server. Very minimal.

Android target now works with API level 3.

Added 'm4a' (ie: aac) as recognized audio format.

Added interfaces.

Majorly cleaned up generics.

Added Alias directive.

Added #Error directive.




therevills(Posted 2011) [#2]
Cool - Thanks Mark!

Quick Q - How do I set the default browser now, as HTML_PLAYER and FLASH_PLAYER points to the mserver?


marksibly(Posted 2011) [#3]
Hi,

You can't yet - it uses the OS default.

It's early days for mserver...


therevills(Posted 2011) [#4]
Ok - no problems.

Another Q - What targets supports the m4a audio format?


marksibly(Posted 2011) [#5]
Hi,

> Another Q - What targets supports the m4a audio format?

Take a look at bananas/mak/audiotest


therevills(Posted 2011) [#6]
Take a look at bananas/mak/audiotest


LOL - maybe add all those comments to the PlaySound doco ;) (I see you have already added some more comments to the docs)

What does the Alias directive do?


xzess(Posted 2011) [#7]
thanks mark!
cool, mserver, i will immediately give it a try


impixi(Posted 2011) [#8]
Nothing is running for me (HTML5 target). IE9 gets 'stuck' on 'localhost' and displays nothing.

MServer's output is:
MServer active and listening on port 50607
1> HTTP Server active and listening on port 50107

I've fiddled with Window's Firewall settings, allowing "mserver_winnt" access, still no success.

Windows 7 Home Premium 64bit.

EDIT: If I wait long enough, IE displays the "Internet Explorer cannot display the webpage" error page, with "http://localhost:50131/MonkeyGame.html" in the URL bar.


Any ideas?



EDIT2: Must be an IE9 problem. I set my default browser to Chrome and programs run as they should on that.


wmaass(Posted 2011) [#9]
I had a similar issue as impixi. I had to build and run some of the samples and my app 2-3 times before it would work. After that, smooth sailing.


marksibly(Posted 2011) [#10]
Hi,

Just in the process of fixing mserver for IE9...in the meantime, use Chrome!


therevills(Posted 2011) [#11]
What does the Alias directive do?


The Alias directive

The Alias directive allows you to assign a local name to a constant, global, function or class declared in another module. This can be used to create 'shortcuts' for clashing identifiers.


The syntax for Alias is:


Alias Identifier = ModulePath . Identifier


Alias directives must appear in the 'import' section of a module, before any code.


For example:


'----- file1.monkey -----


Import file2

Import file3


Alias T=file2.T 'which 'T' to use


Function Main()

Print T 'Prints '1'

End


'----- file2.monkey -----


Global T:=1


'----- file3.monkey -----


Global T:=2






Richard Betson(Posted 2011) [#12]
So far I have GLFW, HTML5 (Chrome) running. XNA runs some demos but not others. No luck with Android (emulator) so far.

I'm going to post compiler output once I get a better look at things.

See ya,


dopeyrulz(Posted 2011) [#13]
I've also got a problem under XNA (HTML5 and MingW - haven't tried GLFW yet due to some compile speed problems).

The process has created a class called bb_ for the Main call and added a global variable I've created. Within a seperate class/method an Integer has been created called bb_ also. The issue stems from trying to access the global variable within this same method which is causing the problem. easy... (not)!

I'll try and reproduce a small example as my project is reasonably big now.


dopeyrulz(Posted 2011) [#14]
Ok - have been able to create an example of the problem:

Import mojo

Const SETTING_A:Int = 0
Const SETTING_B:Int = 1

Global myTimer:=New Timer("myTimer")

Class TestApp Extends App
Private
	Field _setting:Int = SETTING_A
Public

	Method OnCreate()
		SetUpdateRate 60

	End Method
	
	Method OnUpdate()
		'Part one of issue - XNA creates a variable to so we 
		'can compare the setting
		Select _setting
			Case SETTING_A
			
			Case SETTING_B
		
		End Select
		
		'Part two of issue - XNA tries to refer to the global timer 
		'but both part one and two use the same variable bb_
		If (myTimer.Value = 0) Then
		EndIf
		
	End Method
	
	Method OnRender()
		'Clear screen and color
		Cls(0,0,0)
		SetColor(255,255,255)
	
		'Output
		DrawText("Hello",0,0,0,0)
				
	End Method

End Class

Function Main()
	New TestApp()
	
End Function


Class Timer
Private
	Field _id:String
	Field _value:Int = 0
Public

	Method New(id:String)
		_id = id	
	End
	
	Method Value:Int() Property
		Return _value
	End
	
End


The above displays the following error:
error CS1061: 'int' does not contain a definition for 'bb_myTimer' and no 
extension method 'bb_myTimer' accepting a first argument of type 'int' could be found (are you missing a using
directive or an assembly reference?


Source:



marksibly(Posted 2011) [#15]
Hi,

Ok, found that one! Should have a 1.40 fix up tomorrow...


xzess(Posted 2011) [#16]
Hi,
is it possible to deactivate SetColor for Images manually? Maybe by setting a flag?
I compiled my game with 1.39 and it got really laggy.

Also i have problems playing my game in Safari on IPhone, is it possible to include indiepaths hacks into 1.40 ?


marksibly(Posted 2011) [#17]
Hi,

>is it possible to deactivate SetColor for Images manually?

Using SetColor 255,255,255 'turns off' set color for images.

> Also i have problems playing my game in Safari on IPhone, is it possible to include indiepaths hacks into 1.40 ?

You'll probably have to wait for a new version of the hacks.


therevills(Posted 2011) [#18]
Just tried compiling Pirates on Android with v39:



Quick code sample:


Using this code, XNA failed with these errors:
XNA:



[edit]
Just tried dopeyrulz code on Android and its the same error I am getting with Pirates so hopefully your v40 fixes it.

Also just to note that Chrome on my Win7-64 machine is having trouble accessing the HTML5 and Flash builds...
[/edit]


Raz(Posted 2011) [#19]
Yay for SetColor for images, this means I make the game I want to for Xbox in blitz now :D


Corum(Posted 2011) [#20]
yay to new SetColor()!
Now I can complete my crappy retrogame. :P


xzess(Posted 2011) [#21]
its very performance lasting i think, test it:

its the same code

compiled with v39
http://www.xzess.org/Webgames/Exhale/v2/

compiled with v38:
http://www.xzess.org/Webgames/Exhale/