Monkey v70c now up! [MONKEY NEWS]

Monkey Forums/Monkey Programming/Monkey v70c now up! [MONKEY NEWS]

marksibly(Posted 2013) [#1]
Hi,

Latest Monkey is now up (see bottom of product updates page), featuring an improved doc system and lots of minor tweaks.

You can now add docs to modules via separate monkeydoc files in the same dir (or in a monkeydoc/ subdir) as the main module file, or via #Rem monkeydoc comments in module source .monkey files. 'Rebuild Docs' is back in Ted (see Help menu) and you can add doc themes in the docs/templates dir. To change the theme used by Makedocs, edit bin/docstyle.txt. Currently, there's only devolonter and blitzmunter to choose from. See MonkeyDoc tool docs.

I've added Mojo OnClose/OnBack handlers mainly to keep win8 happy - as far as I can work out, there's no way to programatically close a win8 app. All you can do is NOT cancel an OnBack event inside an OnBack handler, so on Win8, you must Error "" (or use new EndApp) inside OnBack or it wont work.

Android/Winphone8 apps will call OnBack when back button is pressed, and Glfw apps will call OnClose when window close gadget is pressed. By default, OnBack calls OnClose, and OnClose calls EndApp, so by default, apps will now just 'end' when back/close is pressed.

I've got the virtual keyboard mostly going in winphone8, the only snag being there's no way to stop it closing when 'back' is pressed. See EnableKeyboard docs for more info on this. This is proving MUCH trickier to achieve for win 'store' apps and I'm still a bit stuck on this one.

Winphone8 apps can also now use TCP modules as winphone8 supports the widely used/understood etc sockets API. Alas, for some bizarre reason the sockets API is not available to win store apps, and has been replaced by something 'modern' (that no doubt uses sockets underneath) and I haven't quite got my head around Monkeyizing that yet.

[edit]
v70e now up!
Another fix for ios device size issues
[/edit]

[edit]
v70d now up!
Fixes an android manifest problem AND adds Win8 multitouch support!
[/edit]


Updated glfw linux makefile.

Fixed bool const evalutor bug in trans.

Fixed Invalid DeviceWidth/DeviceHeight in OnCreate on iOS.

Added ANDROID_VERSION_CODE and ANDROID_VERSION_NAME app config settings.

Fixed winrt threads and winphone8 sockets.

Added Rebuild Help to Ted - can't get QWebPage reload working though, so you'll have to manually right-click/reload the page.

Added Makedocs to rebuildall.bmx/bin.

Added Close Others to Ted.

Added Stack.Sort.

Added brl.filesystem module.

Added Check/Update to Ted's build menu.

Added OnClose and OnBack to mojo App class - on window phone 8, these are the ONLY places you can call EndApp. By default, OnBack calls OnClose and OnClose calls EndApp, so by default back/close will both end an app.

Added EndApp to Mojo. Use this instead of Error "" if you're using Mojo. Error "" still works.

Added monkeydoc as a textfile type to Ted so you get wordwrap.

Html5 Mojo now handles Audio-less DOMs.

Ted rebuilt with Qt4.8.4 on Windows/Mac - tried on Linux: too hard...

Ted console no longer htmlizes app output.

Fixed JoyHit not reseting.

Added temp SaveState_V66b().

Merged mwtb's html5 SetScissor fix.

Merged Devolonter's bananas tweaks.

Added WIN8_PRINT_ENABLED app config var - defaults to 'false', due to apps with print failing 'app store' guidelines.

Added EnabledKeyboard/DisableKeyboard support to windows phone 8 - not yet windows (store?) 8. Note: 'back' on windows phone 8 ALWAYS clears virtual keyboard, whether or not you call DisableKeyboard in response to GetChar()=27. See EnableKeyboard/DisableKeyboard docs for how to handle this.

Fixed Select in generic code causing internal error.

Fixed Android LoadBitmap so it returns Null instead of throwing exception.

Added file path to 'invalid utf8' warning in os.LoadString; rebuilt trans.

Added "screenSize" to android target manifest android:configChanges setting so apps with targetSdkVersion>=12 don't reset when orientation changes.

Merged Ziggy's mserver tweaks.




CodeGit(Posted 2013) [#2]
Thank you for the Win8 "Back button" fix. :)


MikeHart(Posted 2013) [#3]
Thanks. What are Ziggy's MSERVER tweaks?


Erik(Posted 2013) [#4]
Thanks a lot for the windows 8 fixes. I have asked this many times but never recieved an answer, are there plans to support multitouch for win 8 / phone8?

I seems really strange to me that this isn't of higher priority, am I missing something?

Since this is a part of mojo, and is not open source, I would prefer not to have to implement this myself.


therevills(Posted 2013) [#5]
Whats the difference between ExitApp(os) and EndApp(mojo)?

(The new doco looks excellent!)

When I try Rebuild Help in Ted I get the following output:
"H:/Dropbox/CodeMonkey/MonkeyPro70c/bin/makedocs_winnt"
Parsing apis...
Parsing docs...
Making indices...
Making apis...
monkey.lang  :  Can't find link:Throw
monkey.lang.Throwable  :  Can't find link:Throw
monkey.lang.Throwable  :  Can't find link:Throw
Making docs...
docs/monkeydoc/Programming/Keywords/End.monkeydoc  :  Can't find link:Select
docs/monkeydoc/Programming/Keywords/Strict.monkeydoc  :  Can't find link:Return
docs/monkeydoc/Tools/Trans.monkeydoc  :  Can't find link:Jungle
docs/monkeydoc/Tutorials/First monkey steps.monkeydoc  :  Can't find link:Skid
Finished!
Done.

Is this normal?

@Mike
Thanks. What are Ziggy's MSERVER tweaks?

You can see Ziggy's tweaks here: https://github.com/blitz-research/monkey/commits/master/src/mserver
*Added version info on the MServer GUI as there was no version numbering
of any kind.
*Removed small debug print from source
*Just removed a comment that should not be there
*This commit adds content-type header to http requests so it can be
loaded nicer on WebKit or Chrominium based browsing engines.


therevills(Posted 2013) [#6]
So I decided to "quickly" update MonkeyMax to v70... but running into issues due to all the pre-processor stuff in brl/gametarget.monkey, monkey/lang.monkey and mojo/app.monkey.

What's the "official" way to get around the pre-processors? We've already implemented BRL_GAMETARGET_IMPLEMENTED?


EdzUp(Posted 2013) [#7]
the Android commands are very welcome will make development easier :D


Amon(Posted 2013) [#8]
Upgrading to 70c my game, using the playniax framework, now spits out this error: Android Target:

[gettype] [Fatal Error] :5:22: Open quote is expected for attribute "{1}" associated with an  element type  "android:versionCode".


I've deleted my build folder.


golomp(Posted 2013) [#9]
Thank you Mark !


CopperCircle(Posted 2013) [#10]
Thanks!, I have re-submitted two WP8 apps with back button functionality, fingers crossed.


Rushino(Posted 2013) [#11]
Thanks you Mark!


Ole JR(Posted 2013) [#12]
When compiling for Android you get:
[gettype] [Fatal Error] :5:22: Open quote is expected for attribute "{1}" associated with an  element type  "android:versionCode".

To fix it edit: MonkeyPro/targets/android/template/templates/AndroidManifest.xml

Change:
android:versionCode=${ANDROID_VERSION_CODE}
android:versionName=${ANDROID_VERSION_NAME}
To:
android:versionCode="${ANDROID_VERSION_CODE}"
android:versionName="${ANDROID_VERSION_NAME}"


Anywho. It should maybe be considered a "bug".


marksibly(Posted 2013) [#13]
> are there plans to support multitouch for win 8 / phone8?

Try v70d (just uploaded).

I had a hack at this a while back with no joy, but had another go this morning and think I've got it sussed.

> When I try Rebuild Help in Ted I get the following output:

This is normal.

> Upgrading to 70c my game, using the playniax framework, now spits out this error: Android Target

My bad, try new v70d.


therevills(Posted 2013) [#14]
Thanks Mark... any info about extra targets regarding the predecessors in brl/gametarget.monkey, monkey/lang.monkey and mojo/app.monkey.?


marksibly(Posted 2013) [#15]
> any info about extra targets regarding the predecessors in brl/gametarget.monkey, monkey/lang.monkey and mojo/app.monkey.?

To add a bmx/max2d target you'll need to do at least the following.

* Implement/import native lang.bmx somehow.
* Implement/import native mojo.max2d.bmx somehow.
* Implement/import native max2dgame.bmx file containing eg: BBMax2dGame class somehow and set #BRL_GAMETARGET_IMPLEMENTED=True

The easiest way to go is probably to place all these files in the target modules dir, eg:

targets/max2d/modules/native/lang.bmx
targets/max2d/modules/native/max2dgame.bmx
targets/max2d/modules/native/mojo.max2d.bmx
targets/max2d/modules/monkeytarget.monkey

...and the last might look like...

Import brl.gametarget

Import "native/lang.bmx"
Import "native/max2dgame.bmx"
Import "native/mojo.max2d.bmx"

#BRL_GAMETARGET_IMPLEMENTED=True 


Note that this file will be auto imported when the max2d target is used.


therevills(Posted 2013) [#16]
Thanks Mark, we had all the native files within the brl, monkey, mojo etc folders.

Our monkeytarget.monkey ended up looking like this:
Import brl.gametarget

Import "native/gametarget.bmx"
Import "native/lang.bmx"
Import "native/bmaxgame.bmx"
Import "native/mojo.bmax.bmx"
Import "native/monkeytarget.bmx"

#BRL_THREAD_IMPLEMENTED=True
#BRL_GAMETARGET_IMPLEMENTED=True


We had to add the BRL_THREAD_IMPLEMENTED as well or we got "Error : Native Thread class not found." error.


EdzUp(Posted 2013) [#17]
Is monkey v70 the last stable release, on the home page it says v70 out now... but on the product updates its v69 is the last stable release and v70d is experimental?


DruggedBunny(Posted 2013) [#18]
@EdzUp: the home page announcement says...


Monkey V70 is now available.

This is my first attempt at creating a release from the Github 'master' branch [...] so I've uploaded it to the experimental section for now.



... so V69 is the current stable release.


Erik(Posted 2013) [#19]
Thanks!


EdzUp(Posted 2013) [#20]
If its still experimental why post news about it at all?


MikeHart(Posted 2013) [#21]
Is the doc system working for other module folders then the native one?


MikeHart(Posted 2013) [#22]
Guess so. When I move the module back into the main module folder the doc system works, but not with a user defined module folder. :-/


siread(Posted 2013) [#23]
Anyone tried building on iOS yet. My game image get shrunk down to 1/4 size and sits in the bottom left corner on iPhone5. Works ok if I build with v70b. Also my iPad mini works fine when building with either version.


skid(Posted 2013) [#24]
Si, I ran into the shrunken view on iPhone4S, for quick fix I ended up changing (commenting out 2 lines) targets/ios/modules/native/iosgame.cpp[355]

//Bit of a kludge for now...
void BBIosGame::StartGame(){
	MonkeyView *view=_appDelegate->view;
//    view->backingWidth=view.frame.size.width;
//    view->backingHeight=view.frame.size.height;
    BBGame::StartGame();

}



marksibly(Posted 2013) [#25]
Very weird, this was a fix for the 'device width/height is 0 in OnCreate' problem and it works fine here on my iPad. Take out the above and device width/height should be 0 inside OnCreate? Or does that depend on device too?

But there's another way to fix this that should be more robust - ie: the old way! v70e coming soon...


marksibly(Posted 2013) [#26]
Okay, v70e now up and hopefully fixes all these issues!


Erik(Posted 2013) [#27]
I think I found a bug with line drawing on Windows 8.

For example, if I replace line 46 in clock.monkey to MouseX,MouseY and try to run under win8 I get a strange trailing effect of the lines.
bananas\difference\clock\clock.monkey

	Method OnRender()
	
		Local nowtime:Float =   Millisecs + adjust

		Cls 128,0,255

		Local w:Int = 640
		Local h:Int = 480
		
		Local r:Float = 0.95 * Min(w,h) / 2.0
	
		PushMatrix
	
			Translate MouseX,MouseY ' <----- Change this



marksibly(Posted 2013) [#28]
Win8 mojo is drawing twice as many lines as it should!

Fixed in next update, or try replacing ->Draw( n*2,...) with ->Draw( n,...) in mojo.win8.cpp.


siread(Posted 2013) [#29]
By the way Mark, any chance you could apply this fix for music mixing on iOS?

http://www.monkeycoder.co.nz/Community/posts.php?topic=3057

Would save me having to paste the code in every time I release. :)


Erik(Posted 2013) [#30]
Great, thanks!


EdzUp(Posted 2013) [#31]
Mark: can you put Remove back in lists please it makes it easier to go through the list and remove entries that have timed out etc. As an example:

For ScoreFloat = EachIn ScoreFloatList
   if ScoreFloat.Timer=0
      ScoreFloatList.Remove( ScoreFloat )
   Endif
Next


How will we remove items without it?


MikeHart(Posted 2013) [#32]
How will we remove items without it?


Two methods:

#1 list.RemoveEach(item) slow

#2 ListNode.Remove() fast

You get the node when you add the item to the list.


Jesse(Posted 2013) [#33]
@EdzUp
I guess Mark finally removed "Remove". You have to use "RemoveEach" now. It is the same thing. Remove used to call RemoveEach. now you have to do it directly.

it was mentioned in previous versions of monkey that "Remove" was deprecated.


EdzUp(Posted 2013) [#34]
@Jesse: ah ok thanks :)


MikeHart(Posted 2013) [#35]
Okay, v70e now up and hopefully fixes all these issues!


I guess you didn't see my post here and also my bug reports. Nothing got fixed regarding the documentation system.


marksibly(Posted 2013) [#36]
re: List.Remove.

I actually didn't mean to nuke this just yet - sorry!

It will be replaced with RemoveFirst:Void( value:T ), ie: "remove first item in list matching 'value'". This is a pretty common game op, and faster than RemoveEach (although still O(N) really, ie: slow).


EdzUp(Posted 2013) [#37]
Ah that sounds like a better option :)


Paul - Taiphoz(Posted 2013) [#38]
Mark what about keeping the List.Remove syntax but give it an optional flag paramater to set it up to either remove first, or each with first being the default , that would mean no code changes for people.

although to be honest it was a simple find/replace edit to a few source files to bring my code in line with the new monkey version so I guess its not that big of a deal.


EdzUp(Posted 2013) [#39]
I think the thing is to me RemoveEach does sound a bit like it removes all entries relating to the variable like a selective clear call. Remove was very useful if its RemoveFirst why not just reinstate Remove?


ziggy(Posted 2013) [#40]
If the old Remove was just removing the first item, it is better called RemoveFirst. I would leave it as it is now. It's much better when method names correspond to what a method does. Backwards compatibility is great, except when something is being improved.
However, when a method is deprecated and it's going to be removed, it would be great if Mark adds a #PRINT "WARINING: Method XXXX is deprecated and will be removed soon. Use XXXX instead" so we can see it in advance in compile time.


EdzUp(Posted 2013) [#41]
+1 on that :-)


SLotman(Posted 2013) [#42]
Please *do not* remove "Remove"! I've written tons of code using the demo, and now that I purchased the full version, I really don't want to re-write everything, or even have to make another function...

I think the solution proposed above by Taiphoz on post #38 is the best - give it a optional parameter to select between removefirst (default behaviour) or removeeach.

It also keeps some compatibility level with Bmax TList (my main concern here - I wrote a very big library wrapping up Monkey commands so I can port easily from Monkey to BMX), which also has "Remove".

And on another note... so, there is no way to 'end' a win8 app? Calling 'Error ""', or even EndApp() makes it crash right now.


CopperCircle(Posted 2013) [#43]
Thanks for the WP8 updates, two apps have just passed submission and are live.


MikeHart(Posted 2013) [#44]
The fastest way to remove items from a list is node.Remove() anyway, so I see no big deal in that list.Remove(item) was depreciated.


therevills(Posted 2013) [#45]
so I see no big deal in that list.Remove(item) was depreciated.

Apart from everyone's code which uses it would need to be updated...


marksibly(Posted 2013) [#46]
> Thanks for the WP8 updates, two apps have just passed submission and are live.

Woohoo!


Nobuyuki(Posted 2013) [#47]
Everyone's used to updating their code from monkey updates breaking code, and if they aren't, they should be. Keeping a bunch of old cruft in Monkey for obscure compatibility reasons should be reserved for when monkey's pretty much feature-complete, I think. Removing the method requires minimum refactoring, and is obvious because its removal will cause a compile-time error.

This has happened already with brl, I don't see what the problem is other than people not knowing that a List isn't a magical container that can be manipulated like a Stack. Remove() is a deceptively-named method. It would be similar to if List.Count() was named List.Length() -- it obscures what's actually going on in there, and should've probably been updated as early as possible. Depreciating the Remove() method with an explicit sunset period is a good compromise which gives everyone time to refactor their code.


therevills(Posted 2013) [#48]
The issue is that Monkey now is over two years old, so there is a lot of code out there already and Mark doesn't like "warnings" in his languages so people may not know that they have to refactor their code in the first place!


ziggy(Posted 2013) [#49]
Thanks for the WP8 updates, two apps have just passed submission and are live.
Great!!!!


Nobuyuki(Posted 2013) [#50]
>The issue is that Monkey now is over two years old, so there is a lot of code out there already and Mark doesn't like "warnings" in his languages so people may not know that they have to refactor their code in the first place!

I see. Depreciated functions are the perfect place to have a warning, though!


MikeHart(Posted 2013) [#51]
Sadly a warning via #Print can't be used right now as it is always printing text to the console, no matter if you use the embending method.


MikeHart(Posted 2013) [#52]
And regarding old code... By your logic, Marc would need to keep depreciated stuff forever. Guess it is time for Monkey version #2 then :-) .


EdzUp(Posted 2013) [#53]
Well tbh if the source is using old commands its down the the programmer to update it to use the new stuff. If there was a code archive like the blitzbasic.com then maybe a version number of the monkey that works with the source could be added?


therevills(Posted 2013) [#54]
By your logic, Marc would need to keep depreciated stuff forever

Works for Java ;)


EdzUp(Posted 2013) [#55]
Ya could have it come up when the file is tokenised :-)


CopperCircle(Posted 2013) [#56]
>Added EnabledKeyboard/DisableKeyboard support to windows phone 8 - not yet windows (store?) 8. Note: 'back' on windows phone 8 ALWAYS clears virtual keyboard, whether or not you call DisableKeyboard in response to GetChar()=27. See EnableKeyboard/DisableKeyboard docs for how to handle this.

Looking at the latest docs I don't see any info on how to handle this?
Can we check if the keyboard is still on screen?

Thanks.