Jump to content

Fixed game canvas width+height


jcwhall
 Share

Recommended Posts

Is it possible to run PandaJS in a a div which has a fixed width and height?

 

i.e. instead of PandaJS taking up the whole window, can I set it to run in a div which is say 640px x 480x?

 

Thanks a lot. Keep up the great work with the engine

Link to comment
Share on other sites

Sure.

 

http://www.pandajs.net/docs/classes/game.Core.html#method_start

 

As you can see, you can define width and height in start method.

 

Example:

game.start(SceneGame, 640, 480);

Or you can create your canvas element before starting the engine:

<div><canvas id="myCanvas"></canvas></div>
game.start(SceneGame, 640, 480, null, 'myCanvas');
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...