game window position & size

Monkey Forums/Monkey Programming/game window position & size

pinete(Posted 2011) [#1]
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 :)


MikeHart(Posted 2011) [#2]
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.


MikeHart(Posted 2011) [#3]
Here are some links about all this:

http://www.monkeycoder.co.nz/Community/posts.php?topic=819#6800
http://www.monkeycoder.co.nz/Community/posts.php?topic=705#5629
http://www.monkeycoder.co.nz/Community/posts.php?topic=531
http://www.monkeycoder.co.nz/Community/posts.php?topic=428#5605
http://www.monkeycoder.co.nz/Community/posts.php?topic=90#927


pinete(Posted 2011) [#4]
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..).


Dima(Posted 2011) [#5]
HTML5 uses the Canvas element for drawing, which is positioned and sized in MonkeyGame.html file.


pinete(Posted 2011) [#6]
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..


Dima(Posted 2011) [#7]
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


Foppy(Posted 2011) [#8]
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>



pinete(Posted 2011) [#9]
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.