Jump to content

Help understanding createContainer


blackhawx
 Share

Recommended Posts

I'm on Phaser 3.14

If I have the following HTML shell setup...

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>

</body>
</html>

and within my game.js file have the following configurations setup...

const config = {
  type: Phaser.AUTO,
  width: 500,
  height: 300,
  parent: 'mphaser',
  dom: {
    createContainer: true
  },
  title: 'my game',
  backgroundColor: '#ffcc00',
  scene: [PreloadScene, MainScene]
};
let game = new Phaser.Game(config);

 

and run the game...I don't see a <div id="mphaser"> wrapping around my canvas, or within the DOM at all.  I think I understand the purpose of dom: { createContainer },  but from my testing, it's just as good as removing it from my configurations. Am I missing something?

Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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