Jump to content

Help understanding createContainer


Recommended Posts

I'm on Phaser 3.14

If I have the following HTML shell setup...

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

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


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?


Link to comment
Share on other sites


  • Recently Browsing   0 members

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