game window position & size
Monkey Forums/Monkey Programming/game window position & size
| ||
Hi all, I would like to know how could I change the window position and size, I mean, I need to have the window centered and with a size of 900x400.. is this possible? could you please help me out with this matter? thanks a lor in advance :) |
| ||
Depending on the target, you need to change some files in the source files which where created for each platform. You can set these sizes from within your source code or form Monk. |
| ||
Thanks for your help MikeHart, but all of the links make reference to iOS or Android.. or Flash. I forgot to specify the target I'm looking for, what is HTML 5. I'm concerned trying to know how change position of the window in the browser window (default is at 0,0) and its size (I guess default is 640x480..). |
| ||
HTML5 uses the Canvas element for drawing, which is positioned and sized in MonkeyGame.html file. |
| ||
I've achieved to change its size, simply altering the values at monkeygame.hmtl, but not its position.. :P it's a headhache. I'm not capable of figure out how to do this.. |
| ||
it's a web page, try opening monkeygame.html in any html wysiwyg editor. you could either put the canvas inside another html table, or inside a div tag and position with css. http://www.w3.org/TR/WD-positioning-19970819 |
| ||
As a simple example, you can put the canvas element inside a div element, and set the style of that div element to center its contents, using text-align:<body> <div style="text-align:center;"> Welcome to my game!<br> <br> <canvas id="GameCanvas" onclick="javascript:this.focus();" width="640" height="480" tabindex="1"></canvas><br> <script language="javascript" src="main.js">Javascript not supported!</script> <br> Game instructions: press space to fire! </div> </body> |
| ||
Wow! thanks a lot Foppy, and Dima and Mikehart! Foppy example works great! :) thanks so much, to be honest I'm not familiar with HTML so it's a headache. Thanks again. |