At the moment, I'm learning HaxeFlixel, and I can centre the text in the canvas, but i can't position the canvas in the centre of chrome the chrome window. Is there a way to do it and Main.hx?
PlayState.hx :
package;
import flixel.FlxG;
import flixel.FlxState;
import flixel.text.FlxText;
class PlayState extends FlxState
{
override public function create()
{
super.create();
var text = new FlxText(0, 0, 0, "Hello World\n", 64);
text.screenCenter();
add(text);
}
override public function update(elapsed:Float)
{
super.update(elapsed);
enterFullscreen();
}
public function enterFullscreen()
{
if (FlxG.keys.justPressed.ENTER)
{
FlxG.fullscreen = !FlxG.fullscreen;
}
}
}
Main.hx :
package;
import flixel.FlxGame;
import openfl.display.Sprite;
class Main extends Sprite
{
public function new()
{
super();
addChild(new FlxGame(0, 0, PlayState));
}
}
Please help, Thanks.