Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I found this page: https://stackoverflow.com/questi... That page says this: In vanilla JavaScript, this will give you the AVAILABLE width/height: I tried this in CopperCube's scripting window: var test = window.screen.height; Using that code causes this error: script:3:TypeError: window is undefined Does CopperCube not support those functions? Being able to detect the resolution of the game's window is not super important. I won't become depressed if it cannot be done. My game uses mouse movement and knowing the resolution of the window would allow me to create a script that would automatically adjust the functionality of the X and Y positions of the mouse depending on the resolution of the game. Example: I hard-coded the numbers based on the assumption that I will always test my game with a resolution of 800 x 600. The top and bottom vertical halves have different effects, and the left and right horizontal halves also have different effects. I detect the exact position of the mouse to change the turning speed of the character, and I slightly alter it based on a setting that allows players to change the intensity of the turning speed. Some people want to turn faster, and some people want to turn slower. I thought that automating the detection of the halfway points and writing one big script that accommodates all possibles levels of granularity would avoid the long-term stress of having to hard-code new numbers again every time I decide to change the resolution of my game. Haha. |
||||
|
i think you can do something like that using: ccbGetScreenWidth(); ccbGetScreenHeight(); |
||||
|
I am so stupid! I previously pressed "CTRL + F" to check the JavaScript Reference page for the word "resolution" instead of "width" and "height" and missed those functions. They solve my problem! I'm foolish like a toddler! Thanks Tim. |
||||
|
I implemented resolution-independent mouse movement in my game! I feel rejuvenated! |
|