[solved] letterbox border color

About Monkey 2 Forums Monkey 2 Programming Help [solved] letterbox border color

This topic contains 8 replies, has 3 voices, and was last updated by  jihem 1 year ago.

Viewing 9 posts - 1 through 9 (of 9 total)

  • Author

    Posts

  • #6961


    jihem

    Participant

    Hi,
    How do you change the border color of the letterbox (in fullkscreen mode) ?
    How can I activate fullscreen at startup ? (uncommenting Self.BeginFullscreen() in the new method doesn’t work)
    Kind regards,
    jihem

    #6964


    peterigz

    Participant

    You need to use “WindowFlags.Fullscreen” when you create the window for fullscreen:

    I’m not sure about the border, it will be somewhere along these lines i think:

    Also, note that color ranges from 0-1 for example red would be: New Color(1, 0 , 0, 1)

    #6968


    jihem

    Participant

    Thanks

    The border color is set with ClearColor. I was using wrong args: 52, 48, 39 => 52/255, 48/255, 39/255.

    WindowFlags.Fullscreen and Self.BeginFullscreen aren’t working in the New method. The Window is fullscreen but display nothing except the ClearColor everywhere… ?!

    #6975


    Mark Sibly

    Keymaster

    If you use the ‘letterbox’ layout, you should also implement ‘OnMeasure’.

    This returns the ‘virtual’ size of the letterbox, while the size passed to the window constructor is the actual physical size of the window (or fullscreen).

    Have a look at the viewlayout.monkey2 banana. Also, I tweaked your code above:

    #6979


    jihem

    Participant

    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 (?!).

     

    #7003


    Mark Sibly

    Keymaster

    Well, there is no border as both the window and virtual res are 800,600, so the virtual display fits’ perfectly’. There will in fact be no border for any virtual res with the same aspect ratio as the window res.

    Your window’s Style.BackgroundColor is also overwriting the window clear color. Style.BackgroundColor defaults to Color.None (ie: fully transparent) so normally you only ever see Window.ClearColor. This implies Style.BackgroundColor is drawn *after* ClearColor – in fact, ClearColor is drawn *before* everything else, as it’s a window property.

    My advice would be to skip Style.BackgroundColor altogether for now and stick with canvas.Clear(), eg:

    #7017


    jihem

    Participant

    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:

    #7023


    Mark Sibly

    Keymaster

    Thanks for spending time with me

    No problem at all – I want people to  hammer this stuff and ask questions so I can make sure it works (and makes some sort of sense!) and so far it seems to be, so thank you!

    With your sample, there is a black border (left and right) at startup.

    Not doing quite the same thing here, but I think this is the difference between ‘real’ fullscreen and ‘fake’ fullscreen.

    When you use WindowFlags.Fullscreen to create the window, it actually causes the display resolution to change. However, BeginFullScreen() with no parameters (as in the Alt-Tab handler) instead takes you into fake fullscreen, where the window is really just resized to the size of the desktop.

    Try using BeginFullScreen( 800,600,60 ) instead in the Alt-Tab handler – this should also cause a display mode change.

    This highlights a bit of a limitation with using WindowFlags.Fullscreen to go into fullscreen mode – you can’t select refresh rate this way.

    #7064


    jihem

    Participant

    Thanks
    I understand the difference between the real/fake fullscreen modes. Now, with BeginFullScreen( 800,600,60 ) I can use the same fullscreen mode.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.