Mojo2 for NG

BlitzMax Forums/BlitzMax NG/Mojo2 for NG

Brucey(Posted 2015) [#1]
With everyone wetting their pants over Monkey's Mojo2 "engine", I thought it only fair we weren't left out of the fun too :

It's a port of Monkey2's mojo2 implementation, which is open source.
It only works with NG, as it duplicates some of the Interfaces (as opposed to Types) that are used on Monkey.
There's a bunch of examples (rather than bananas :-p ) that are straight ports from Monkey, but in the style your used to in BlitzMax. And they all "just work".

The lighting demos are quite pretty, if you like that kind of thing.

You'll need the latest NG.

degac(Posted 2015) [#2]
This weekend I want to test it (NG!) better & deeper!


Derron(Posted 2015) [#3]
Do not forget to rebuild all modules if you already had NG installed - the latest BCC changed some things which enforces a module rebuild.


Dabhand(Posted 2015) [#4]
Just to note: If you get a tstringmap not found, you need to nab the updated mod from Bruceys git repo.


Brucey(Posted 2015) [#5]
There's a new Windows release of BlitzMax NG at
Includes TDM MinGW 5.1.0, SDL backend and (mky.)mojo2 modules.

Dabhand(Posted 2015) [#6]
Yummmmmmyyyyyyyyyyy! :)


degac(Posted 2015) [#7]
Downloding now :D

(I need to update MY own MaxGUI version to use NG as soon as possible :P)

ps: just a note, I don't know if there's a way to 'link togheter' GITHUB download link for the latest version AND without a manual setup...
I know already the answer 'point to github'... but an indipendent website looks more 'professional' :D

degac(Posted 2015) [#8]

just tested the latest release 66.03.07 and toying with mojo2 module.
It seems to run everything fine, except for RenderDemo

If I try to uncomment
'canvas.SetViewport( 0,0,GraphicsWidth(),GraphicsHeight())
'canvas.SetProjectionMatrix( Mat4Ortho( 0,640,0,480,-1,1 ) )

or set Graphics 640,480,0

After 2 light's loop I get 'Incomplete Framebuffer' error.

Derron(Posted 2015) [#9]
Via github-api you can fetch all published releases on the given github-project. Now just use the latest release as the "most current one" when linking from your project website

I do this exactly that way for

As Brucey might add win32, mac ... releases, he should think of a consistent naming scheme - so the other websites could filter according to parts of the name ( find("mac") ).


Derron(Posted 2015) [#10]

this is a json response you could use to fetch your "latest releases" (filtered by OS - through naming schemes).

Edit: this is a stripped down variant of my info getter:


degac(Posted 2015) [#11]
I looked at the official GITHUB API just yesterday, I should restart to use PHP to integrate these informations (in some ways) in my site.

With LibCurl module, MaxIDE could check if the user is running the latest version and/or download directly it (just free thinking of course :D)

I think the valid KEYs are (reading from GitHub API v3)
browser_download_url (for the download link)
updated_at (last change I suppose)

ps: I suppose there's no info in the BMX-NG package about the 'current version'... so comparing what version user is running is quite hard.

Derron(Posted 2015) [#12]
You only get the file name ... so if that naming scheme is constant, you could use that.

what you could do too: use "published_at" to convert that into a timestamp which you compare to something... only useful, if binaries change between releases. - or if the ide is aware of it and stores the "latest downloaded release date" somewhere ...


juankprada(Posted 2016) [#13]
What would be needed to make it work with Blitzmax instead of NG? Is not that I dont want to use NG is just that I am not sure how mature it is and would like to use the mojo2 port you have there.


Derron(Posted 2016) [#14]
Vanilla BlitzMax does not support "Interfaces", which is what "mky.mod" uses.

I did not have a closer look, but as BlitzMax (vanilla) does work without interfaces, there are surely ways out there to "emulate behaviour" (extend types). So you could convert code to make it work with vanilla.


Brucey(Posted 2016) [#15]
I'm sure it's possible to back-port it.

juankprada(Posted 2016) [#16]
Will probably do it, thanks for the info.

Derron(Posted 2016) [#17]
Might be enough to convert these "byteptr - int"-conversions + the interfaces with simple types.

Ahh and in maps.c you should replace the link to tree.h with "brl.mod/map.mod/tree/tree.h" (in NG this is placed in brl.mod/blitz.mod/tree/tree.h).


juankprada(Posted 2016) [#18]
I will try to modifiy it so that it works in both vanilla and NG.

Will post later this week with what I have done.

Thanks for the tips

Brucey(Posted 2016) [#19]
I've back-ported most of it to run under the legacy compiler.

The only thing I don't have working is the rendererdemo, as it implements some of the interfaces.
Otherwise, the examples appear to be working.

Derron(Posted 2016) [#20]
Your commit made it indeed running here on Linux Mint.

Interesting bit:
		For Local char:Int=EachIn Text
?Not bmxng
		For Local i:Int=0 Until Text.length
			Local char:Int = Text[i]

Good job.

samples not working (or needing adjustment):

- shadereffect (colormaterial not found)

- writepixels
Local rgba:Int=a*255 Shl 24 | b*255 Shl 16 | g*255 Shl 8 | r*255
Local pix:Int Ptr = data.pixels

"Compile Error: Bitwise operators can only be used with integers"
"Compile Error: Unable to convert from 'Byte Ptr' to 'Int Ptr'"

change to:
Local rgba:Int=int(a*255) Shl 24 | int(b*255) Shl 16 | int(g*255) Shl 8 | int(r*255)
Local pix:Int Ptr = Int Ptr(data.pixels)

- mojodemo (optional if you do not have the sdl.mod)
'Import brl.GLGraphics
Import sdl.sdlgraphics

Import brl.GLGraphics
'Import sdl.sdlgraphics


RustyKristi(Posted 2016) [#21]
Maybe port Mike Hart's fantomX framework which uses Mojo2?