Can you actually get the size of the window?

Monkey Targets Forums/Desktop/Can you actually get the size of the window?

Cyber(Posted 2014) [#1]
I have been looking in the help section and cannot find any way to get the size of the app's canvas.

DeviceHeight() and DeviceWidth() aren't what I want since I'm using a resizable window, but these will always return a fixed value (the screen resolution of my desktop).


Salmakis(Posted 2014) [#2]
i think you will Need to wrap glfwGetWindowSize(); to archieve this
http://www.glfw.org/docs/latest/group__window.html#gaeea7cbc03373a41fb51cfbf9f2a5d4c6


ImmutableOctet(SKNG)(Posted 2014) [#3]
That's really weird, 'DeviceWidth' and 'DeviceHeight' are supposed to return the width and height of the "canvas". They do for me, and I always use resizable windows. Are you sure you're getting the desktop resolution? Because, I'm getting the size of the draw-area in the window. You shouldn't need GLFW external code for this, those commands you mentioned already return the correct resolution. Getting your screen's resolution (Not your game's "canvas" resolution) can either be done with platform-specific modules (GLFW2 and XNA have these), or using Mojo's 'DisplayMode' functionality (The 'DesktopMode' function).

Are you using a virtual display system, or something? For example, there's 'autofit' (Here's my implementation; Monkey comes with an old implementation if you want that), as well as other third party frameworks that do this.


Cyber(Posted 2014) [#4]
Thank you for that reply! I just did a check and indeed you are correct; the outlying problem was a bug in my code rather than an incorrect return value! Thank you very much!

(Edit: For those needing clarification, the problem was that a division by two int values resulted in an int when a float was needed, hence giving an incorrect scaling value, which made it appear as if the image was distorted and confused me into thinking those two functions did unintended things).