How to change graphics resolution?
Monkey Forums/Monkey Code/How to change graphics resolution?
| ||
Hi Everybody In Monkey how can we to define graphics resolution? In BlitzMax we have Graphics x,y but in monkey i don't know what can i do. Can anybody help me please? |
| ||
depends on the target! On HTML5 its defined in the MONKEYGAME.HTML document, but you can manipulate it On ANDROID its definded by the smartphone. No chance to change it. In your monky code you can work with a virtuell resolution that easyly scales to the targets resolution. With this simple trick you can work as you would have 800x600 virtuell resolution: [monkeycode]Strict Import mojo Class Game Extends App Field PreScalingX#,PreScalingY#, MausX%,MausY% Method OnCreate%() SetUpdateRate 15 PreScalingX=DeviceWidth()/800.0 PreScalingY=DeviceHeight()/600.0 Return 0 End Method OnUpdate%() If KeyHit(KEY_ESCAPE) Then Error "" If TouchHit(0) MausX=ScaledMaus("X") MausY=ScaledMaus("Y") Endif Return 0 End Method OnRender%() Scale PreScalingX,PreScalingY ' your code based on 800x600 Cls DrawRect 5,5,790,590 Return 0 End Method ScaledMaus%(Welche$) Local loc# If Welche="X" loc=TouchX(0) loc=loc/PreScalingX Else loc=TouchY(0) loc=loc/PreScalingY Endif Print "SCALED MAUS pos=" + loc Return Int(loc) End End Function Main%() New Game Return 0 End [/monkeycode] Also the Touch returns 800/600 in the right down corner. |
| ||
Diddy has the command SetGraphics command which works for GLFW and HTML5. Midi's code acts like a virtual resolution and will not change the actual target resolution. |
| ||
Ah so it is possible to change the GLFW resolution on the fly? That's very interesting thanks. |
| ||
Jake, See here also: http://www.monkeycoder.co.nz/Community/posts.php?topic=4418 |
| ||
Thanks for the heads up. |