31 lines
792 B
JavaScript
31 lines
792 B
JavaScript
import Phaser from '../vendor/phaser.js';
|
|
import { config } from './Config.js';
|
|
|
|
/**
|
|
* Builds the Phaser game config from data/game.json.
|
|
* Scenes are attached in main.js (createGameConfig() + .scene = [...]).
|
|
*/
|
|
export function createGameConfig() {
|
|
const g = config.section('game');
|
|
|
|
return {
|
|
type: Phaser.AUTO,
|
|
parent: g.parent ?? 'game', // element id in index.html
|
|
width: g.width ?? 1280,
|
|
height: g.height ?? 720,
|
|
backgroundColor: g.backgroundColor ?? '#04060d',
|
|
banner: false,
|
|
scale: {
|
|
mode: Phaser.Scale.FIT,
|
|
autoCenter: Phaser.Scale.CENTER_BOTH,
|
|
},
|
|
physics: {
|
|
default: g.physics?.default ?? 'arcade',
|
|
arcade: {
|
|
debug: g.debug ?? false,
|
|
gravity: { x: 0, y: 0 }, // we're in space
|
|
},
|
|
},
|
|
};
|
|
}
|