forked from tapio/unicodetiles.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctional-odd-tile-size.html
54 lines (46 loc) · 1.68 KB
/
functional-odd-tile-size.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Functional Test</title>
<link href="../unicodetiles/unicodetiles.css" rel="stylesheet" type="text/css" />
<link href="../docs/style.css" rel="stylesheet" type="text/css" />
<link href="../examples/style.css" rel="stylesheet" type="text/css" />
<style>
#game { font-size: 17px; }
</style>
<script src="../unicodetiles/unicodetiles.js"></script>
<script src="../unicodetiles/ut.WebGLRenderer.js"></script>
<script src="../unicodetiles/ut.CanvasRenderer.js"></script>
<script src="../unicodetiles/ut.DOMRenderer.js"></script>
<script src="../examples/renderer-switcher.js"></script>
<script>
var term; // Can't be initialized yet because DOM is not ready
function start() {
var w = 50, h = 25;
term = new ut.Viewport(document.getElementById("game"), w, h);
term.clear();
for (var j = 0; j < h; ++j) {
for (var i = 0; i < w; ++i) {
var c = 33 + (j * w + i) % 94;
var ch = String.fromCharCode(c);
if (Math.random() > 0.2) ch = "▒";
var tile = new ut.Tile(ch, (Math.random()*255)|0, (Math.random()*255)|0, (Math.random()*255)|0);
term.put(tile, i, j);
}
}
term.render();
}
</script>
</head>
<body onload="start(); createRendererSwitcher();"><div id="container">
<p class="centerer">Tests rendering with odd (not even pixel amount) tilesize.</p>
<div class="centerer">
<div id="game">Enable JavaScript and reload the page.</div>
</div>
<div class="centerer" id="renderer-switcher">
<!-- Populated by renderer-switcher.js -->
</div>
<a class="backlink" href="index.html"><-- Back to index</a>
</div></body>
</html>