ScreenChangeEvent

ScreenChangeEvent

Run >
<!DOCTYPE html>
<html>
<head>
<script src="scripts/tbgs_min.js"></script>
<script src="scripts/ControllerPad.js"></script>
<link type="text/css" rel="stylesheet" href="styles/ControllerPad.css">
</head>
<body>
<input type="button" name="title" id="title" value="title screen" />
<input type="button" name="game" id="game" value="game screen" />
<input type="button" name="over" id="over" value="game over screen" />
<script type="text/javascript">
(function() {
var gameContainer = new tabageos.CanvasObjectContainer(null,240,240, null);
document.body.appendChild(gameContainer.div);
var titleScreen = new tabageos.CanvasObjectContainer(null,240,240, null, "#6495ed");
titleScreen.floor.drawRect(new tabageos.Rectangle(24,24,32,32), "#00c800");
var adv = document.createElement("div");
adv.setAttribute("style", "text-align:center;width:240px;height:240px");
titleScreen.div.appendChild(adv);
adv.innerText = "title screen";
var gameCanvas = new tabageos.CanvasObject(null,240,240);
gameCanvas.drawCircle(120,120,25);
var gameOverScreen = new tabageos.CanvasObjectContainer(null,240,240, null, "#c8c8c8");
//A ScreenOrganizer orders CanvasObjectContainers and CanvasObjects displayed in a game CanvasObjectContainer
//and shows a transition when switching between them.
//internally the class is using ScreenChangeEvents after transitions
var screenOrganizer =
new tabageos.ScreenOrganizer(gameContainer,[titleScreen, gameCanvas, gameOverScreen], null);
function doTransition(e) {
if(e.target.name == "title") {
screenOrganizer.switchScreen(0);
}
if(e.target.name == "game") {
screenOrganizer.switchScreen(1);
}
if(e.target.name == "over") {
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

new ScreenChangeEvent()