About Monkey 2 › Forums › Monkey 2 Development › Bug: Full Screen at the start
This topic contains 5 replies, has 4 voices, and was last updated by
therevills 1 year, 6 months ago.
-
AuthorPosts
-
September 28, 2017 at 10:15 am #10856
When I execute the following code in Windows the screen isnt centered in full screen mode, if I press alt-enter to enter window mode it ends full screen and displays the window in the middle of the screen and then full screen is okay:
[/crayon]Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455[crayon-5cba15ab05cc1202403875 inline="true" ]Namespace myapp#Import "<std>"#Import "<mojo>"Using std..Using mojo..Const Size:=New Vec2i( 512,480 )Class MyWindow Extends WindowMethod New()Super.New( "My Window",1027,768,WindowFlags.Resizable )Layout="letterbox"BeginFullscreen()EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()ClearColor = Color.Blackcanvas.DrawText( "Hello World",Width/2,Height/2,.5,.5 )EndMethod OnKeyEvent( event:KeyEvent ) OverrideIf event.Type=EventType.KeyDown And event.Key=Key.Enter And event.Modifiers & Modifier.AltFullscreen=Not FullscreenEndifEndMethod OnMeasure:Vec2i() OverrideReturn SizeEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndSeptember 28, 2017 at 12:25 pm #10858Confirmed same here — 1.1.0.7 itch.io version.
Screenshot shows uncleared grey area, too, which goes away when windowed/re-fullscreened.
Attachments:
September 29, 2017 at 4:31 am #10875I suppose it’s incorrect to set screen mode inside of constuctor.
Better way to do it when window done with layout.
Monkey123456789101112131415161718192021Method New()Super.New( "My Window",1027,768,WindowFlags.Resizable )Layout="letterbox"EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()Global justStarted:=TrueIf justStartedjustStarted=FalseBeginFullscreen()'Return 'maybe better to skip this frame?EndifClearColor = Color.Blackcanvas.DrawText( "Hello World",Width/2,Height/2,.5,.5 )EndSeptember 29, 2017 at 5:40 am #10877Hmm, seems like it should work to me and could be an SDL thing. Will have a look.
September 29, 2017 at 6:11 am #10878I think it’s an SDL/windows thing. This fixes it for me:
Monkey1234App.Idle+=Lambda()BeginFullscreen()End(Note: you should be able to just go ‘App.Idle+=BeginFullscreen’ but that doesn’t work right now due to a bug I just fixed!)
This effectively delays the call to BeginFullscreen until the next ‘batch’ of OS events has been processed. I’m not 100% sure why this necessary but I will keep looking.Worse case, I can just implement this ‘delay’ actually inside BeginFullscreen.
September 29, 2017 at 9:08 am #10882@nerobot – yeah that was my first thought, but its fugly and it would be so much nicer to do it in the CTOR.
@Mark – look forward to the fix
-
AuthorPosts
You must be logged in to reply to this topic.
