Is there a concept of Virtual Resolution?

About Monkey 2 Forums Monkey 2 Programming Help Is there a concept of Virtual Resolution?

This topic contains 4 replies, has 4 voices, and was last updated by  cocon 2 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #7461

    AaronK
    Participant

    Hey guys, just installed Monkey 2 and wow, it’s looking good. What I want to know though, is there a way to handle virtual resolutions? I want to have a screen be some physical resolution (Don’t care what, ideally full res of the computer’s display) but then set a virtual resolution that I develop the game in and scaling is taken care of.

    Obviously this would require letter or pillar boxing, scaling and cropping or whatever.

     

    Does Monkey 2 support this easily?

     

    Cheers

    Aaron

    #7462

    Ethernaut
    Participant

    If you look inside Monkey2/bananas/viewLayout there’s a complete demonstration on how to use virtual resolution and layouts. The basic idea is that the Window method “OnMeasure:Vec2i()” should return the resolution you want, and the “Layout” property controls things like stretching, letterboxing, etc.

    Here’s a much simplified version that shows only what you want, scale the window to see the letter boxing in action:

    [/crayon]
    #7463

    AaronK
    Participant

    Thanks, that seems to do the resolution thing.

    Does Monkey 2 support the ability to provide multiple resolution versions of images that are loaded based on the physical to virtual ratio?

     

    Thanks

    #7477

    Mark Sibly
    Keymaster

    Not yet, you still have to do this manually.

    I want to support it though.

    #7672

    cocon
    Participant

    I had created a few weeks a test on this, however this is very unpolished and not tested. In the future once I come up with better ideas and a nice API for this I will post the results. For example autofit, change from portrait to landscape, dynamically, zooming, etc…

    My inspiration comes mostly from the 3D rendering and not from exactly from “virtual drawing”. In essence this might go for something like a “camera” approach. The essence is to consider that your game takes place in a “virtual space” and not on actual screen pixels (either real pixels or virtual pixels). For example lets say that you want to render the environment for basketball game, you might put instead of a pixel resolution the actual dimensions of the arena. This is a clever way to abstract your thinking from screen pixels.

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

You must be logged in to reply to this topic.