Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Following the Enchant.js tutorial I cannot find a way to define the place the game is rendered in the page. It either takes the maximum possible area or limits itself to the given size (using game.scale = 1).

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

There are two possible ways to do this.

The "fast" hack is to call your game's html page from an iframe. This is not recommended because of the iframe implications and cross-browser differences regarding attributes and, more important, you will not be able to capture input from keyboard.

The best way is to create the div and give it the id 'enchant-stage'. It's direct, 100% cross-browser compliant and lets you capture keyboard input.

<div id="enchant-stage"></div>
share|improve this answer
1  
how did you know about "enchant-stage" ? –  onmyway133 Dec 14 '13 at 17:04
    
@entropy around 5-6 months ago I ended up here and it was awesome! haha reddit.com/r/enchantjs –  pctroll Dec 17 '13 at 13:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.