MonkeyMax - BlitzMax Target
Monkey Archive Forums/Monkey Projects/MonkeyMax - BlitzMax Target
| ||
Continuing from this post: http://www.monkeycoder.co.nz/Community/posts.php?topic=1573 But more an "offical" project now ;) This is the first part of the BlitzMax Target - meaning it only currently translates Monkey code - NOT Mojo! So no graphics stuff yet! Instructions: 1. Grab the zip file from here: http://www.therevillsgames.com/monkey/MonkeyMax/MonkeyMax.zip 2. Back up your Monkey Folder!! The zip will replace several files, including Trans, config.winnt.txt etc! 3. Extract the zip file into your Monkey Folder 4. Alter the config.winnt.txt and set your BlitzMax path - This is my config.winnt.txt so it will have removed all your paths... Thats why I told you to back up your Monkey Folder in Step 2! 5. Run Monk.exe and open the bmaxTest.monkey file 6. Click Run and select BMAX 7. Hopefully it will now output a heap of stuff in the console - this is the BlitzMax program running!! I've done a heap of testing and it seems okay... Arrays still need work, but meh! |
| ||
Wahay :D Glad to see this is going well |
| ||
???? Besides using DirectX on Widnows then, what would be the use for it? |
| ||
nice work Mr T! Dabz |
| ||
what would be the use for it A lot of the current Monkey coders are from a Blitz background, having a BlitzMax target means that they should be able to debug the code themselves using BlitzMax tools. Also since BlitzMax is very stable I feel it would be a better alternative than the current GLFW target. |
| ||
... and you could do a more configurable/adaptable/desktop-friendly port with the same game converted to BlitzMax. |
| ||
Great stuff! Well done :) |
| ||
???? Besides using DirectX on Widnows then, what would be the use for it? I consider it a Windows / Mac / Linux friendly target that I know will work. I've had little to no luck with GLFW and XNA when releasing for windows. |
| ||
This is awesome :)! |
| ||
MojoMax News: Good News: I've got a sprite displaying on the screen \o/ Bad News: BlitzMax OO hurts!! BlitzMax's inheritance doesn't properly kick in until the constructor chain is complete... which means I have to change mojo's app.monkey, I did not want to do this! This is the generated BlitzMax code using the standard app.monkey: Type bb_MyGame Extends bb_App Method bb_MyGame_new:bb_MyGame() Super.bb_App_new(); Return Self; EndMethod Type bb_App Method bb_App_new:bb_App() bb_device=(New bb_AppDevice).bb_AppDevice_new(Self); Return Self; EndMethod Type bb_AppDevice Extends gxtkApp Method bb_AppDevice_new:bb_AppDevice(bbt_app:bb_App) Self.bb_app=bbt_app; bb_SetGraphicsContext((New bb_GraphicsContext).bb_GraphicsContext_new(Self.GraphicsDevice())); Return Self; EndMethod Type gxtkApp .. Method New() app=Self; ggraphics=New gxtkGraphics; 'input=new gxtkInput; 'audio=new gxtkAudio; startMillis=BlitzMaxMillisecs() 'game.stage.addEventListener( Event.ENTER_FRAME,OnEnterFrame ); SetFrameRate( 0 ); InvokeOnCreate(); InvokeOnRender(); Update() EndMethod I had to add a Setup() Method to get around this: Type bb_App Method bb_App_new:bb_App() bb_device=(New bb_AppDevice).bb_AppDevice_new(Self); bb_device.SetUp(); Return Self; EndMethod Type gxtkApp .. Method New() app=Self; ggraphics=New gxtkGraphics; EndMethod Method Setup() 'input=new gxtkInput; 'audio=new gxtkAudio; startMillis=BlitzMaxMillisecs() 'game.stage.addEventListener( Event.ENTER_FRAME,OnEnterFrame ); SetFrameRate( 0 ); InvokeOnCreate(); InvokeOnRender(); Update() EndMethod |
| ||
Just to show the above problem more: Java Code When you run the above Java code it will print out: Start AppDevice - Update BlitzMax Code This code outputs: Start GxtkApp - Update You see it actually calls the incorrect Update method!! Is this a bug with BlitzMax!? |
| ||
You could potentially get around this by making your types a base Abstract type and then the real type (ie accessed from translated monkey code) is extended. EG monkey Class apple Method func() End Endblitzmax Type appleBase Abstract Method func() Abstract End Type Type apple Extends appleBase Method func() End Method End TypeI dont even know if the targets translation code allows this, but it's what I usually have to do in max to get inherited methods to work "properly" in this scenario. I always wondered if it was a blitzmax bug or by design? |
| ||
@Skn3: I always wondered if it was a blitzmax bug or by design? Personally I think it's just poor OO design. See this post by FlameDuck as to why this kind of thing is dangerous: http://monkeycoder.co.nz/Community/post.php?topic=1534&post=14007 |
| ||
So you reckon essentially it shouldn't be allowed ? Or did I misunderstand? |
| ||
Sprites frames now work :) And I've got DrawText to work... I had the translator wrong - opps! |
| ||
I've checked in MonkeyMax and the start of MojoMax into the Diddy Repository. To get MojoMax to work you need to do a few things: Copy the mojo monkey files to the mojomax module folder and alter app.monkey: Add "Method SetUp()" to Class gxtkApp="gxtkApp" And change the App Class' New method: Class App Method New() device=New AppDevice( Self ) device.SetUp() End And comment out the input and audio stuff... http://code.google.com/p/diddy/source/browse/#svn%2Ftrunk%2Fmonkeymax |
| ||
Wow looking good, keep it up! |
| ||
"Compile error" local bbt_l:String=((bbt_lhs) as bb_StringObject).bb_value; I'm doing wrong? |
| ||
This is great! You efforts motivated me to have a look at all the trans module and dig in deeper :-) Mark really did a great job... Wow. From the tokenizer code and so on, it would be interesting to get a code beautifier. JungleIDE doesn't do it (yet) even if they parse everything. Is there anybody out there who started one? |