PunyOne Posted May 30, 2014 Share Posted May 30, 2014 So I finished a game that originated at a Jam with the topic "Russian Invasion".You can play it here: http://www.justaconcept.org/Games/1968/index.html .A tiny screenshot: With that I have a little question, I tried to position the game inside my page as you can see, but I had trouble that PandaJS takes the canvas it is put in and places it to it's own preferred coordinates. I achieved the above effect by explicitly removing the absolute positioning from the engine source, but that's quite a hack. Basically what I need is for panda to position the canvas w.r.t. its parent (e.g. a <div>) instead of the whole window. Any suggestions? Quote Link to comment Share on other sites More sharing options...
enpu Posted May 30, 2014 Share Posted May 30, 2014 Try to disable centering: game.System.center = false; Quote Link to comment Share on other sites More sharing options...
PunyOne Posted May 30, 2014 Author Share Posted May 30, 2014 Try to disable centering: game.System.center = false;Thanks for reply but it does not help - when I set the above, it puts the canvas to the topleft corner of the whole page, so it lies over the buttons and others.I tried all the combinations of the System parameters I could find, without success. Quote Link to comment Share on other sites More sharing options...
enpu Posted May 30, 2014 Share Posted May 30, 2014 Hmm, try to put your canvas inside div, like:<div id="myDiv"> <canvas id="myCanvasId"></canvas></div>Then tell Panda to use that canvas, by giving it's id:game.start(SceneStart, 1024, 768, null, 'myCanvasId');or use game.System.canvasId property (latest develop version). Quote Link to comment Share on other sites More sharing options...
PunyOne Posted May 30, 2014 Author Share Posted May 30, 2014 Hmm, try to put your canvas inside div, like:<div id="myDiv"> <canvas id="myCanvasId"></canvas></div>Then tell Panda to use that canvas, by giving it's id:game.start(SceneStart, 1024, 768, null, 'myCanvasId'); That is exactly what I have in the code (you can check it on the page, the canvasId is "1968_canvas").I can see that it is in the canvas because it moves the frame of the canvas too (I used blue frame in the debug and I clearly saw that the frame got moved to the topleft corner). Quote Link to comment Share on other sites More sharing options...
enpu Posted May 30, 2014 Share Posted May 30, 2014 Can you try latest develop version, with game.System.center set to false. https://github.com/ekelokorpi/panda.js/tree/develop PunyOne 1 Quote Link to comment Share on other sites More sharing options...
PunyOne Posted May 30, 2014 Author Share Posted May 30, 2014 Can you try latest develop version, with game.System.center set to false. https://github.com/ekelokorpi/panda.js/tree/developThanks, that solved it!Previously I was using "Panda.js node toolkit v1.3.5", installed on 25.5.2014. Quote Link to comment Share on other sites More sharing options...
enpu Posted May 30, 2014 Share Posted May 30, 2014 Panda.js node toolkit and Panda.js game engine are different things. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.