This repository was archived by the owner on Jun 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
43 lines (36 loc) · 1.29 KB
/
test.html
File metadata and controls
43 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Tengu Gamelib test page</title>
<script src="jquery.js"></script>
<script src="gamelib.js"></script>
</head>
<body>
This page is used to test if the game library works (on your browser). It can
also be used as a simple template for new games.
<script type="text/javascript">
Gamelib.init(640, 360, "debug progressbar");
var g = Gamelib; //Convenience! g stands for Gamelib.
//Create state and give it render commands
new g.State("test state");
g.STATES["test state"].loadResources(["placeholder.png"]);
g.STATES["test state"].update = function() {
this.vars.x = g.INPUT.getMouseX();
this.vars.y = g.INPUT.getMouseY()+10;
}
g.STATES["test state"].render = function() {
g.canvas.fillStyle = "#bbb";
g.canvas.fillRect(0, 0, g.SW, g.SH);
g.canvas.fillStyle = "#888";
g.canvas.fillRect(0, g.SH/4, g.SW, g.SH/2);
g.canvas.font = "18pt sans-serif";
g.canvas.textAlign = "center";
g.canvas.fillStyle = "darkblue";
g.canvas.fillText("Gamelib started!", this.vars.x, this.vars.y);
g.canvas.drawImage(g.RES["placeholder.png"], 10, 10);
}
g.STATES["test state"].start(); //Let the fun begin!
</script>
</body>
</html>