V45 now available! [MONKEY NEWS]

Monkey Forums/Monkey Programming/V45 now available! [MONKEY NEWS]

marksibly(Posted 2011) [#1]
Hi,

V45 is now up, and includes bug fixes, better unicode handling and *simple* virtual keyboard support!

The virtual keyboard is only for iOS and android and does NOT display characters or do anything fancy other than provide, well, a 'virtual keyboard'.

After calling EnableKeyboard, your app can then use GetChar inside OnUpdate to read characters as they are typed. When 'Return' or 'Esc' is hit (ie: chr 13 or 27) it's up to you to then DisableKeyboard.

Check out the bananas/mak/keyboardtest demo.

I'm kind of dubious about the worth of this for a variety of reasons, but it does seem fair enough that if you can 'type stuff' on a desktop pc, you should also be able to (somehow) 'type stuff' on other platforms too - ie: all it's really doing is implementing GetChar!

Alas, the XNA virtual keyboard works quite differently - it's modal and effectively fullscreen (on wp7 anyway) so would probably require more work/commands to make useful. I assume xbox/wp7 do have a proper virtual keyboard in there somewhere, but it doesn't appear to be exposed by XNA. Maybe later.


Modules:

mojo.input - HTML5 target now recognizes LMB, RMB, MMB.

mojo.input - Added EnableKeyboard, DisableKeyboard for SIMPLE virtual keyboard support on iOS and Android ONLY.

monkey.map - modified Map.Compare() method so it takes 'K' (ie: Key) type params instead of plain objects.

mojo.input - changed KEY_BACKSLASH to 220.

mojo.graphics - fixed non-pow2 tex handling on ios and glfw.


Trans (1.18)

HTML5 target HTML now disables RMB popup menu for canvas.

Trans now built in release mode (was debug) for faster compiling.

Fixed spaces in [].

Added check for 'Super' calls to abstract methods.

Cleaned up debug mode, you should now get a stack trace for every (Monkey) null object, array index or Error() error in debug mode.

Cleaned up flash target a bit - bitmap creation is now in mojo code, not target code.

Validates abstract methods of non-instanced classes too now - used to only validate instanced (ie: Newed) classes.

Fixed strict mode not complaining about non-void functions without terminating return.

Fixed void->bool conversions causing crash.

Improved unicode handling of os.LoadString, os.SaveString and mojo.app.LoadString.



Samah(Posted 2011) [#2]
No preprocessor enhancement? I'm a sad panda. :(


Soap(Posted 2011) [#3]
Virtual keyboard support is useful.

>mojo.input - HTML5 target now recognizes LMB, RMB, MMB.
Awesome!

Thank you, Mark. :)


hardcoal(Posted 2011) [#4]
Now after this update i got glfw error

TRANS Failed to execute 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Debug;Platform="win32" MonkeyGame.sln', return code=1


Uncle(Posted 2011) [#5]
:) Thank you for the keyboard support on iOS and Android. Tested on Android and it works perfectly.


Xaron(Posted 2011) [#6]
Mark I love you! :D HA, just kidding of course but this virtual keyboard stuff is EXACTLY what I need! Thanks!

I'm kind of dubious about the worth of this for a variety of reasons


Well Mark, that's easy. You need this if you want to make something like a highscore list where the player enters his name.


GfK(Posted 2011) [#7]
virtual keyboard support!
i love you!


pinete(Posted 2011) [#8]
thanks a lot!


samowitsch(Posted 2011) [#9]
Great!


Shinkiro1(Posted 2011) [#10]
Wow! monkey is getting better and better. Thanks.


Beaker(Posted 2011) [#11]
Thanks for the virtual keyboard. At last I can make some projects with monkey! Yay!


GfK(Posted 2011) [#12]
I'm kind of dubious about the worth of this for a variety of reasons
You also need it for casual games where the player enters their name at the start. Its kind of prerequisite.


Raz(Posted 2011) [#13]
I assumed that the focus of keyboard input for phone devices (and the xbox to a lesser extent) was to get some sort of response to a question (e.g. asking for your name) instead of monitoring key presses in a live manner.


Beaker(Posted 2011) [#14]
raz - I think you might've misunderstood how you would use the virtual keyboard. :)

Mark - not all of use monkey to make 'standard' games, or even games at all. I often have projects that aren't games as such, but just need games technology to visualise data or to give the feel of a game. Think of educational games for example.


Raz(Posted 2011) [#15]
Ahh ok. It's just I've never seen an Android game that makes use of the keyboard on the fly.


slenkar(Posted 2011) [#16]
thanks mark

just curious about the virtual keyboard,


does it cover the entire screen when it appears?
does monkey pause the game when the keyboard appears?


hardcoal(Posted 2011) [#17]
i love mark too very very much !!
but why cant i run glfw!!! this error!!

TRANS Failed to execute 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Debug;Platform="win32" MonkeyGame.sln', return code=1


DruggedBunny(Posted 2011) [#18]
I get nothing onscreen (besides the click-here text) with the keyboard demo running in the Android emulator. I don't know if this is because it has a "built-in" keyboard, but typing on that produces no text either.


BigAnd(Posted 2011) [#19]
@hardcoal
Have you tried deleting your build directory?

This is what usually happens when you do an update.


GfK(Posted 2011) [#20]
Just tried out the virtual keyboard in the iOS simulator - works perfectly!


Soap(Posted 2011) [#21]
Thanks for the update! Are there any undocumented changes to Strict mode? I have one of the methods in my class returning a value in an If..Then..Else block which refuses to compile ("Missing return statement") unless at least one Return statement exists outside of a block. There is an easy workaround, but I'm wondering if the previous behavior was incorrect in some way.


Samah(Posted 2011) [#22]
Soap: There is an easy workaround, but I'm wondering if the previous behavior was incorrect in some way.

In my opinion, yes it was incorrect. It's unreachable code and should throw a compile error.


hardcoal(Posted 2011) [#23]
Big And

no i havnt but i will ... tnx


Dabz(Posted 2011) [#24]
Nice update there!

Dabz


therevills(Posted 2011) [#25]
Just been testing the virtual keyboard on my phone, seems to work okay - but it only gets individual key hits you can not use predictive words (my default keyboard is Swype).


DruggedBunny(Posted 2011) [#26]

In my opinion, yes it was incorrect. It's unreachable code and should throw a compile error.


Actually, I ran into this yesterday and meant to post about it -- here's an example, from AutoFit:




marksibly(Posted 2011) [#27]
Hi,

OK, a few points regarding strict mode and return statements.

The latest update now requires a return statement at the end of a function in strict mode - even if it's redundant, eg:

Method T()
  If x
    Return 1
  Else
    Return 0
  Endif
  Return -1   'redundant! But now needed...
End


However, I'm gonna have a crack at fixing this so returns aren't required if code is unreachable.

This wont be perfect (as reachability analysis is 'conservative') so you may end up having to add a return statement even though you know the code can't get there. But Monkey already does some reachability analysis to keep Java happy, so I may as well make use of it. And it'll at least take care of obvious cases like the above.

The hard part is adding enough 'returns' to keep C++ compilers (and AS) happy (which all seem to deal with missing returns in different ways!), but not so many that Java/C# gets upset!


Samah(Posted 2011) [#28]
@DruggedBunny:
Here's a less verbose version:
Method VMouseX:Float (limit:Bool)
	Local mouseoffset:Float = MouseX() - DeviceWidth() * 0.5
	Local x:Float = (mouseoffset / multi) / (vzoom + (VDeviceWidth () * 0.5))
	If Not limit Then return x
	Local widthlimit:Float = vwidth - 1
	If x <= 0 Then Return 0
	If x >= widthlimit Then Return widthlimit
	Return x
End

And even better:
Method VMouseX:Float (limit:Bool)
	Local mouseoffset:Float = MouseX() - DeviceWidth() * 0.5
	Local x:Float = (mouseoffset / multi) / (vzoom + (VDeviceWidth () * 0.5))
	If Not limit Then return x
	Return Min(Max(x, 0), vwidth-1)
End

:)


Skn3(Posted 2011) [#29]
Brilliant, nice addition :D


DruggedBunny(Posted 2011) [#30]
OT: @Samah -- thanks, meant to go through and try to optimise this/make it prettier. I know it looks awful, so I'll add your code if it works the same!


therevills(Posted 2011) [#31]
Just to let you know that the Android Keyboard stuff seems a tad broken with non-default keyboards...

On my phone I have 3 keyboards:
* Swype
* LG
* Android

You cant do swype words and the backspace is dodgy, it seems you have to double the number of hits per characters to delete them (eg you have 4 characters you need to hit the backspace 4 times to start to delete the last character).

The LG one works okay, but its based on the old mobile phone numpad (eg one key acts as 3 keys), so when you hit 3 three times it displays C.

Any way of forcing the default keyboard?


Yahfree(Posted 2011) [#32]
It seems like Java/Android doesn't like Monkey Abstract methods because they don't return anything (:


GfK(Posted 2011) [#33]
Just got word from bigfishgames that the ios virtual keyboard IS the preferred data entry method.


Gerry Quinn(Posted 2011) [#34]
Oh wow - didn't realise RMB in HTML was fixed in V45... downloading now! Thanks!


marksibly(Posted 2011) [#35]
Hi,

V45c is now up!

Hopefully we're onto V46 next...


QuickSilva(Posted 2011) [#36]
Hi Mark, just wanted to thank you for another great update.

Is there any possibility that you can include skidracers fixes to Monk in the next update as I feel that it is the only thing letting Monkey down at the moment. I`m not talking anything major, just some basic highlighting improvements (to bring it up to Blitz3D\BMax standard) would be very welcome.

Jason.

P.S.
I was also just reading this site, (an old worklog of yours)
http://www.hi-toro.com/blitz/oldsites/blitzsite2000/worklog.html

As someone who was a great fan of your Amiga Blitz products I am so glad that you are still here creating these fantastic tools for us. Thanks for making games creation so much fun!


Sunshine Dreamer(Posted 2011) [#37]
thanks Mark ! - Monkey Rocks ! :)


4mat(Posted 2011) [#38]
Nice update. My game engine now gets a compile error with Flash, html5 builds ok. I updated to Flex4.5.1 too but same problem. Those strings/images/sounds are being accessed through a string rather than directly. eg:

filename$ = "blah.jpg"
LoadImage(filename)

instead of

Loadimage("blah.jpg")




Foppy(Posted 2011) [#39]
Are you using correct upper-lower case function names, such as LoadImage versus loadImage? Or does that not help.


4mat(Posted 2011) [#40]
Yep, was all working in V44 . The errors are limited to just the asset loader:




Hima(Posted 2011) [#41]
Have you deleted the build folder after you update to new version? Usually Flash target ( and probably other targets) has a problem if you don't delete the old build folder. Happened to me once. HTML5 worked fine, but Flash target couldn't compile. But deleting the build folder did the trick.


4mat(Posted 2011) [#42]
argh, how'd I forget that? :) works now. thanks.


therevills(Posted 2011) [#43]
Have you deleted the build folder after you update to new version?


This gets people (including me) every time! Maybe if Monkey adds a version number in the source code and when compiling it checks the number and if it is a different version ask the user to delete the build folder...

"Current source code was built using Monkey v43, trying to compile with Monkey v45. Do you want to delete the build folder?"

(Of course Monkey should not automatically delete the build folder, as the developer may have stuff in there they need!)


Samah(Posted 2011) [#44]
(Of course Monkey should not automatically delete the build folder, as the developer may have stuff in there they need!)

And if custom preprocessor directives are ever added, in theory the developer should never need to have stuff in there. :)


therevills(Posted 2011) [#45]
in theory the developer should never need to have stuff in there.


Nah you will still need stuff in there. For example with Android you need your icons in the build folder and with HTML5 you can change the favicon etc ;)


Amon(Posted 2011) [#46]
Ta for the update!

Monkey does rock.....'arrrrrddddd! :)


dooz(Posted 2011) [#47]
Hi Mark,

Are you planning a port of MaxGUI to Monkey for a level of cross-platform UI?


slenkar(Posted 2011) [#48]
no


GfK(Posted 2011) [#49]
Hi Mark,

Are you planning a port of MaxGUI to Monkey for a level of cross-platform UI?

no

You're not Mark, you're Keith.


ziggy(Posted 2011) [#50]
Hi Mark,

Are you planning a port of MaxGUI to Monkey for a level of cross-platform UI?


In my opinion, It would be much better to use current Java target to get access to the Swing library for cross-platform desktop dev. Just an idea...


therevills(Posted 2011) [#51]
But the current Java target is for Android, not desktop... although it could be changed ;)

For a cross-platform GUI for all the current targets, it would need to be pure graphics mode no native stuff... a bit like the GUI stuff in Diddy :)


Big Jim(Posted 2011) [#52]
Monkey is AWESOME, and a stroke of brilliance by Mark. I just had to say that...

;)


GfK(Posted 2011) [#53]
Monkey is AWESOME, and a stroke of brilliance by Mark. I just had to say that...
It is. Plus its not overly difficult to translate Blitzmax code to Monkey. Time-consuming, tedious, occasionally soul-destroying, but not difficult. :)

If debugging was easier then it would really be the dog's dangly bits.


Supertino(Posted 2011) [#54]
My dog dont have dangly bits, we cut em off.