Window.ClearColor vs canvas.Clear(color)

About Monkey 2 Forums Monkey 2 Programming Help Window.ClearColor vs canvas.Clear(color)

This topic contains 3 replies, has 3 voices, and was last updated by  therevills 1 year, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #11878

    therevills
    Participant

    I’m using a virtual resolution in letterbox mode and I want to change the background colour from black to a light bluish colour.

    When using ClearColor and when I “fade to black” using DrawRect(0, 0, width, height) the “border” color is still the bluish colour:

    If I keep the ClearColor as black and use canvas.Clear to have my background as the bluish colour the borders keep black, which is what I want but there is a performance hit:

    Is there any other solutions I am missing?

    Attachments:
    #11884

    AdamStrange
    Participant

    use clearcolor for the entire window color

    with your ‘own’ window you will need to clear the color to black first
    canvas.Color = Color.Black
    canvas.DrawRect( 0, 0, Width, Height )

    then the alpha stuff will fade to black as you wanted 🙂

    #11891

    Mark Sibly
    Keymaster

    Here’s a little demo of manually drawing letterbox borders yourself.

    This allows you to turn of windows clearing so there is 0 overdraw, I’m not sure it’ll be significantly faster, or even any faster at all as window clearing should be pretty fast. But it’s still nice to be able to customize letterbox borders…

    If it is significantly faster, it’s probably worth adding an option similar to Window.ClearEnabled to automate it.

    It uses the currently undocumented View.RenderBounds property, but it should be pretty obvious what this does, ie: it’s the view ‘bounds’  in windows coordinates. View bounds is view rect + padding + border + margin.

    #11912

    therevills
    Participant

    Thanks Mark, I’ll have a look 🙂

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

You must be logged in to reply to this topic.