-
Notifications
You must be signed in to change notification settings - Fork 20
/
index.html
166 lines (152 loc) · 4.67 KB
/
index.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<link href="css/start/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<script src="lib/jquery-1.10.2.min.js"></script>
<script src="lib/jquery-ui-1.10.3.custom.min.js"></script>
<!-- GAME -->
<script src="js/config.js"></script>
<script src="js/map.js"></script>
<script src="js/renderer.js"></script>
<script src="js/builder.js"></script>
<script src="js/editor.js"></script>
<script src="js/resources.js"></script>
<!-- Application -->
<script src="js/app.js"></script>
<script src="js/anim.js"></script>
<script src="tiles.js"></script>
<script src="entities.js"></script>
<script src="save/map72x72.js"></script>
<script>
$(function() {
app.start();
initToolBar();
$("#builder-outer").draggable();
});
</script>
<script>
function initToolBar() {
$("#tool button, #tool input").focus(function(e) { $("#screen").focus() })
$( "#action-fill" ).button({
}).click(function() {
app.game.editor.fill();
app.renderer.renderAll();
return false;
});
$( "#action-copy" ).button({
icons: {
primary: "ui-icon-copy"
}
}).click(function() {
app.game.editor.copy();
app.saveSettings();
app.renderer.renderAll();
return false;
}).next().button({
icons: {
primary: "ui-icon-clipboard"
}
}).click(function() {
var canvas = $("#screen")[0];
app.game.editor.paste(app.renderer.point(canvas.width/2, canvas.height/2));
app.renderer.renderAll();
$("#tool-cursor").click();
return false;
}).parent().buttonset();
$( "#action-undo" ).button({
icons: {
primary: "ui-icon-arrowreturn-1-w"
}
}).click(function() {
app.undo();
return false;
}).next().button({
icons: {
primary: "ui-icon-arrowreturn-1-e"
}
}).click(function() {
app.redo();
return false;
}).parent().buttonset();
$( "#action-zoom" ).button({
icons: {
primary: "ui-icon-zoomin"
}
}).click(function(){
if (app.renderer.camScale == 1.0)
app.renderer.camScale = 1.5;
else app.renderer.camScale = 1.0;
app.renderer.renderAll();
return false;
});
$( "#tool-cursor" ).click(function() {
app.tool = 0;return false;
}).next().next().click(function() {
app.tool = 1;return false;
}).next().next().click(function() {
app.tool = 2;return false;
}).parent().buttonset();
$( "#add_entities" ).button().click(function() {
app.game.randomize(app.resources.entities);
app.renderer.renderAll();
return false;
}).next().button().click(function() {
app.game.clearEntities();
app.renderer.renderAll();
return false;
}).parent().buttonset();
$( "#debug_chunks" ).button().click(function() {
app.renderer.debug_chunks = !app.renderer.debug_chunks;
app.renderer.renderAll();
})
$( "#debug_zones" ).button().click(function() {
app.renderer.debug_zones = !app.renderer.debug_zones;
app.renderer.renderAll();
}).parent().buttonset();
$("#builder-dialog").dialog({dialogClass: "build_dialog", width:320, height:400, minWidth:240, minHeight: 200, position: [20, 60], resize: function() { app.builder.render(); }});
}
//
</script>
<style>
#toolbar { padding: 4px; display: inline-block;position: absolute; left: 20px; top: 20px; }
body {
font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
font-size: 62.5%;
}
#builder { }
.build_dialog .ui-dialog-content { padding: 0 }
.build_dialog .ui-dialog-titlebar-close { display:none }
</style>
</head>
<body>
<canvas id="screen" border="0"></canvas>
</body><div id="toolbar" class="ui-widget-header ui-corner-all">
<span id="tool">
<input type="radio" id="tool-cursor" name="tool" checked="checked" /><label for="tool-cursor">Cursor</label>
<input type="radio" id="tool-pencil" name="tool" /><label for="tool-pencil">Pencil</label>
<input type="radio" id="tool-select" name="tool" /><label for="tool-select">Select</label>
</span>
<button id="action-fill">Fill</button>
<span>
<button id="action-copy">Copy</button>
<button id="action-paste">Paste</button>
</span>
<button id="action-zoom">Zoom</button>
<span>
<button id="action-undo">Undo</button>
<button id="action-redo">Redo</button>
</span>
<span>
<button id="add_entities">Add entities</button>
<button id="remove_entities">Remove entities</button>
</span>
<span>
<input type="checkbox" id="debug_chunks" /><label for="debug_chunks">Show chunks</label>
<input type="checkbox" id="debug_zones" /><label for="debug_zones">Show zones</label>
</span>
</div>
<div id="builder-dialog" title="Select a tile">
<canvas id="builder"></canvas>
</div>
</html>