Canvas resolution

Monkey Targets Forums/HTML5/Canvas resolution

Virtech(Posted 2011) [#1]
Hi

For debugging purposes, I would like to set the default html5 screen res of 640x480 to something else. I can do this for android and glfw, but I cant figure out how to change it on the html5 target. I tried to edit the screen metrics in the generated .html file. But that does not work.


Xaron(Posted 2011) [#2]
You have to edit MonkeyGame.html in the /targets/html5 folder.

line:
<canvas id="GameCanvas" onclick="javascript:this.focus();" width=480 height=320 tabindex=1></canvas><br>


At least this works for me for IE8/9, Firefox 3/4 and Google Chrome...

Ah, and you have to delete your build folder after editing!


Virtech(Posted 2011) [#3]
I was hoping I could change res in the build folder, so that it would affect only the app Im currently working on. Not the default settings for every new project. But its not a big deal. Thanks!

Edit:
I changed the settings you described in the html file under the build folder instead. That changed the res for only the app Im working on, and not all other. Exactly what I wanted. Hmm strange this didnt work the first time around I tried this.


marksibly(Posted 2011) [#4]
Hi,

> I was hoping I could change res in the build folder, so that it would affect only the app Im currently working on

You can, and this is the whole point of the build folders! They represent the 'target project' side of things and should be considered to be as much part of your project as the monkey code, as this is where you implement your target specific tweaks.

You should never need to edit the stuff in /targets - unless, of course, you want to change how all future projects work. And from your initial post, it did sound a bit like you wanted to do this...

The README.TXT in /targets covers this and more too.


therevills(Posted 2011) [#5]
Could it be possible to add a precompiler to monkey to alter the relative files when building the project, therefor the user wouldnt need to alter the build files?

Strict

#WIDTH="480"
#HEIGHT="320"
#ORIENTATION="landscape"

Function Main:Int()
End


For HTML5 this would alter the MonkeyGame.html (and of course ignore the orientation).


Neuro(Posted 2012) [#6]
Could it be possible to add a precompiler to monkey to alter the relative files when building the project, therefor the user wouldnt need to alter the build files?

Is something like this possible yet or do we still have to modify it in the build folders?


Paul - Taiphoz(Posted 2012) [#7]
Yeah that would be nice I tend to set my html and then lock it so the compiler cant write over it, but it gets annoying some times and freaks out, having something like that would be cool.


EdzUp(Posted 2012) [#8]
I asked for that ages ago and nothing came of it, it would be a very useful set of commands that would mean the whole process could be automated and if the resolution didnt fit with fixed res devices it could be ignored.