package brickbreaker;
import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.paint.*;
public var mainFrame: MainFrame;
def IS_MOBILE = FX.getProperty("javafx.me.profiles") != null;
function run(__ARGS__ : String[]) {
Config.initialize(IS_MOBILE);
mainFrame = MainFrame {
title: "Brick Breaker"
resizable: false
scene: Scene {
fill: Color.BLACK
width: Config.screenWidth
height: Config.screenHeight
}
}
}
public class MainFrame extends Stage {
var splash: Splash;
var level: Level;
public var lifeCount: Integer;
public var score: Integer;
public function startGame() {
lifeCount = 3;
score = 0;
state = 1;
}
public var state: Integer = 0 on replace {
if (state < 1 or state > LevelData.getLevelsCount()) {
splash.stop();
level.stop();
level = null;
splash = Splash {};
scene.content = [
splash
];
splash.start();
} else {
splash.stop();
level.stop();
splash = null;
level = Level {
levelNumber: state
}
scene.content = [
level
];
level.start();
}
};
}