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

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...