Forum Replies Created
-
AuthorPosts
-
The semantic tree is a tree… You have to use tree or stack objects to store it. You must use recursive functions only to use the language (monkey, c++) native call stack to build the tree. If you manage your own ‘call stack’ (as a stack object) you can use non-recursive functions. Sometime the semantic is so big that you can’t use recursive functions (stack overflow) so you have to manage your own stack. The source of my (pico8) cartridge is available on lexaloffle.com (search ‘jihem’, then select ‘i editor’). When displayed press the ‘code’ button.
Thanks
This game (i_editor) is used by children to discover some basic programming concepts : sequences, variables, stacks, loops, … They use a pad (or 6 keys) to do all the job. They can see what they do in real time. Fractals and harder things are puzzles to solve for the elders. I played TIS-100 and had the idea to do this (free) game.Thanks
I understand the difference between the real/fake fullscreen modes. Now, with BeginFullScreen( 800,600,60 ) I can use the same fullscreen mode.Thanks for spending time with me
With your sample, there is a black border (left and right) at startup. If you press [alt][enter] to switch in windowed mode and another time to return in fullscreen it disappears (and the red rectangle is bigger).
Attachments:
Hi, Simon
I have read this : http://en.cppreference.com/w/cpp/language/eval_order
If I understood correctly (I’m not a native english speaker), I ‘m right :10) In list-initialization, every value computation and side effect of a given initializer clause is sequenced before every value computation and side effect associated with any initializer clause that follows it in the brace-enclosed comma-separated list of initalizers.
Thanks for your help. I will take care to write :
Monkey12Local s:Double=myStack.Pop(),n:Double=myStack.Pop()Print(n-s)instead of :
Monkey1Print(-myStack.Pop()+myStack.Pop())This is the first time I got this issue. The others languages I used manage the call from left to right.
I have learnt a lot todayArg… This seems to be bind to the windows version. I have the same result on another windows PC.
Maybe a bug ???@tomtoad> Yes, you’re right. I understand this is a MingW issue. But this can’t stay as is…
I found documentation about this problem :
https://stackoverflow.com/questions/949433/why-are-these-constructs-using-pre-and-post-increment-undefined-behavior— / —
C99 standard are 6.5 Expressions, §2Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.
and 6.5.16 Assignment operators, §4:
The order of evaluation of the operands is unspecified. If an attempt is made to modify the result of an assignment operator or to access it after the next sequence point, the behavior is undefined.
Question :
Should Monkey2 leave us with “undefined behavior” (or manage the call order to have the same result on every OS) ?Attachments:
Same result with Mx2xx 1.1.03…
Mx2cc version 1.1.03
-5
5
Finished debugging app.Have you tried my test ?
Monkey123456789101112Function Main()Local myStack:=New Stack()myStack.Push(10)myStack.Push(5)Print(-myStack.Pop()+myStack.Pop())myStack.Push(10)myStack.Push(5)Local s:Double=myStack.Pop(),n:Double=myStack.Pop()Print(n-s)EndI’m on Windows 10 and I’m using the monthly build from the patreon download link.
I’ll download the last version from github and try again.
Thanks for the replyI am getting:
Mx2cc version 1.1.02
-5
5Finished debugging app.
which is not correct… if RVAL is evaluated from left to right :-/
I agree with you it should be :
5
5Yes
This was the most interesting part.Thanks
OnMeasure helps. Now the app starts in fullscreen mode and shows the picture but… the border color of the letterbox is not set (always black). If you use [Alt]-[Enter] to switch in windowed mode, then again to switch back in fullscreen mode the border color is set properly (?!).Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#Import "<std>"#Import "<mojo>"#Import "assets/splash.png"Using std..Using mojo..Class Splash Extends WindowField image:ImageMethod New()Super.New("Splash",800,600,WindowFlags.Fullscreen)image=Image.Load( "asset::splash.png" )image.Handle=New Vec2f( .5,.5 )Self.Layout="letterbox"Self.ClearColor=New Color(0.2039,0.1882,0.1529,1) ' 52 48 39Self.Style.BackgroundColor=Color.BlackMouse.PointerVisible=FalseEndMethod OnMeasure:Vec2i() OverrideReturn New Vec2i( 800,600 )EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()canvas.DrawImage(image,Self.Width/2,Self.Height/2)EndMethod OnKeyEvent( event:KeyEvent ) OverrideIf event.Type=EventType.KeyDown ThenIf event.Key=Key.Enter And event.Modifiers & Modifier.AltIf Not Self.Fullscreen ThenSelf.BeginFullscreen()ElseSelf.EndFullscreen()EndEndIf event.Key=Key.EscapeApp.Terminate()EndEndEndEndFunction Main()New AppInstanceNew SplashApp.Run()EndThanks
The border color is set with ClearColor. I was using wrong args: 52, 48, 39 => 52/255, 48/255, 39/255.
Monkey1234567891011Method New()Super.New("Splash",800,600,Null) ' Flags.Fullscreenimage=Image.Load( "asset::splash.png" )image.Handle=New Vec2f( .5,.5 )Self.Layout="letterbox"Self.ClearColor=New Color(0.2039,0.1882,0.1529,1) ' 52 48 39Self.Style.BackgroundColor=Color.BlackSelf.MinSize=New Vec2i(800,600)Self.MaxSize=New Vec2i(800,600)Mouse.PointerVisible=FalseEndWindowFlags.Fullscreen and Self.BeginFullscreen aren’t working in the New method. The Window is fullscreen but display nothing except the ClearColor everywhere… ?!
Very good work. I like to use ted21. Just a question: how can we change the font in the text editor?
Regards,
jihem
I don’t like “first come first served”… This is a good idea to use the login name as prefix (or a domain name owned by the user, ie com.domain.module_name).
-
AuthorPosts