CONFIG.TXT

Monkey Forums/Monkey Programming/CONFIG.TXT

MaxPower(Posted 2012) [#1]
Hi Guys

Is config.txt the only way i can change screen dimensions.Is there no way i can do it on the fly in Monkey.

thanks


therevills(Posted 2012) [#2]
For HTML5 and GLFW, we added native code within Diddy to change the resolution:

MonkeyCode via Diddy:
SetGraphics(1024, 768)

Which calls:
Function SetGraphics:Void(w:Int, h:Int)
	SetNativeGraphicsSize(w, h)
	DEVICE_WIDTH = w
	DEVICE_HEIGHT = h
	SCREEN_HEIGHT = h
	SCREEN_WIDTH = w
	SCREEN_WIDTH2 = SCREEN_WIDTH / 2
	SCREEN_HEIGHT2 = SCREEN_HEIGHT / 2
End

And for C++ (GLFW):
Extern
    Function SetNativeGraphicsSize:Void(w:Int, h:Int) = "diddy::setGraphics"


The C++ code:
        static void setGraphics(int w, int h)
        {
                glfwSetWindowSize(w, h);
                GLFWvidmode desktopMode;
                glfwGetDesktopMode( &desktopMode );
                glfwSetWindowPos( (desktopMode.Width-w)/2,(desktopMode.Height-h)/2 );
        }


At the moment there is no (easy) way to switch between window and full screen mode for GLFW.

I did read that the new version of GLFW (v3) will have this, but it depends if Mark will change over to it when it is released is another question.

http://wiki.glfw.org/wiki/Roadmap_for_GLFW_3


MaxPower(Posted 2012) [#3]
Just looked at Diddy very nice.To be honest i thought it was a game someone was making,so i didn`t take a lot of notice.Well Diddy sounds like a game to me. :) Anyway i take it i can use this to change screen dimensions on the fly.

thanks


therevills(Posted 2012) [#4]
LOL - Diddy is a play on Diddy Kong (from the Donkey Kong game), it was meant to be a small addition to Monkey and Diddy in the game is a small monkey.

And yes you can change the screen resolution on the fly, check out the testApp.monkey in the function examples:

http://code.google.com/p/diddy/source/browse/trunk/examples/Functions/testApp.monkey