battagline Posted August 7, 2015 Share Posted August 7, 2015 Ok, this is a total noob question here, but Pixi is the only thing that seems to render on an HTML page when I use Pixi JS for a game. Other HTML seems to not be visible. I'm sure there's something very basic I'm missing here. Thanks Quote Link to comment Share on other sites More sharing options...
xerver Posted August 8, 2015 Share Posted August 8, 2015 Likely just your styles, post a link to a running example and we can look at it. battagline 1 Quote Link to comment Share on other sites More sharing options...
battagline Posted August 10, 2015 Author Share Posted August 10, 2015 You are right, it's just a styles issue. I guess one thing I still don't understand is how you control where the game renders with PIXI. Right now it just puts the game above any html content I have in my body. Is there any way to place the game in a specific position on the screen with HTML surrounding it? Thanks for your help Quote Link to comment Share on other sites More sharing options...
andreas_d Posted August 10, 2015 Share Posted August 10, 2015 var renderer = PIXI.autoDetectRenderer( width, height, { backgroundColor : 0xffffff } ) // create renderer renderer.view // references the actual canvas element created somewherenInDOM.appendChild(renderer.view); // you can add the canvas wherever you like in your HTML DOM structure, assign class names with something like .setAttribute('class', 'myclass') etc. battagline 1 Quote Link to comment Share on other sites More sharing options...
battagline Posted August 10, 2015 Author Share Posted August 10, 2015 ahh... I had document.body.appendChild( render.view ) in my code, so that was just dropping it into the top of the body tag. I changed it to:var game_container = document.getElementById("game_container");game_container.appendChild( mahjong._renderer.view ); which worked great. Thank you so much! 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.