New Monkey Syntax. Max Equivalent?
BlitzMax Forums/BlitzMax Programming/New Monkey Syntax. Max Equivalent?
| ||
Some weird Monkey syntax I noticed for the first time.. #1 Const Bar:Int = 10 Foo = New Float[Bar] (It works) Is it the same as??.. Foo:Float[Bar] Then this is probably I saw in C #2 Foo += Bar (which fails on Blitzmax) is Foo = Foo + Bar??? #3 Field Foo:Float = 60-30 (I'm not sure if this is just a reference or the minus sign happens to do something, should just put 30 in the first place??) |
| ||
#1 yes - or alternatively: local foo:Float[] = new Float[bar] #2 yes - foo :+1 is possible too #3 yes, this is 30 bye Ron |
| ||
Thanks Derron, I figured and saw it before with the ':+' works the same.. I was also wondering how you copy Monkey's floats. I have read somewhere there's some issue in how Blitzmax handles floats. I'm trying to do some accurate conversion from Monkey and by checking some computations on both, they output different float or decimal values.. Do you happen to know this? |
| ||
floating point problems happen everywhere... so on computer 1 the results wont be the same as on computer 2. Exception might be with certain compiler flags (gcc). bye Ron |
| ||
No I mean Monkey vs BMX. I got a monkey example I need to convert and it does the same with other monkey installation of course. I'm converting a computation to Bmx. is Method OnRender() anything special? |
| ||
Do you have an example of the values that appear different for you? |
| ||
So far they are all basic math and trying to debug the values are almost the same. Maybe there's a big difference in functionality. I'm trying to convert from mojo1 to mojo2 (bmx) without any extra modules other than those 2 renderers First thing I notice is the Image.Load function, where in mojo 1 it has a flag set to 1 after the filename Image.Load("image.png",1) and the most part I'm suspicious about is Image.SetHandle(). Are they exactly the same with mojo1 and 2? Im getting nothing if I invert the X and Y SetHandle(Y,X) (which it needs to be, following some actual monkey1 snippets) If I make it SetHandle(X ,Y) (Where X and Y are computed before and are Floats) the output is quite similar as the actual mojo1 code. |
| ||
Another follow-up question, can I animate or flip my 2d stuff without the TRenderer Canvas method/function? I've seen in mojo1 code where the rendering is done inside a Class Method Class Game extends App OnCreate() blah,blah ... ... OnRender() Cls DrawImage this, that... (There's no flip?) End End |
| ||
Also Floats always has 4 decimal places where in max its more than that. no formatting done just print, and I don't know if it makes any difference |