-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest6.html
More file actions
99 lines (76 loc) · 1.98 KB
/
Copy pathtest6.html
File metadata and controls
99 lines (76 loc) · 1.98 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
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
<html>
<head>
<script src="./data/screen.js"></script>
</head>
<style>
body{ padding:0; margin:0; background:#cccccc; width:100%; height:100%; overflow:hidden; }
</style>
<center>
color : <input type="number" id="hdl1" min="0" max="8" value="0" ><br>
font: <input type="number" id="hdl2" min="0" max="8" value="1" ><br>
<button id="hdl3">red</button>
</center>
<center><canvas style="border:1px solid #cecece; margin:10px; cursor:cross;" width="480px" height="600px" id="screen"> </canvas></center>
<script>
var test = function( setting ){
var monitor, gui = graphicalUserInterface( ( monitor = {
width: 720, height:600,
monitor: document.getElementById('screen'),
} ) ).resetScreen( 0 ).refresh( ), sp= gui.tiles({
// mod
mod:2,
// colors palette
palette:[
0xffffff,
0x555555,
0x00aa00,
0x0000aa,
0xbbbbbb,
0xaaaaaa,
0x006666,
0x2f4f4f,
0x000000,
],
// size Tiles
offsetTilesX:9,
offsetTilesY:16,
}),
/*
* sprite warriors
*/
tile = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,1,1,0,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
function light ( offset, clr, fnt ){
sp.setTilesByOffset(
offset,
tile,
clr,
fnt,
);
gui.refresh( );
return true;
}
return {
offset:0,
read: function( clr, fnt ){
return light(
this.offset++,
clr,
fnt
);
},
};
}
/**/
var gm = test( ),
hdl1 = document.getElementById('hdl1'),
hdl2 = document.getElementById('hdl2'),
hdl3 = document.getElementById('hdl3'); ;
hdl3.onclick = function( ){
gm.read(
parseInt( hdl1.value ),
parseInt( hdl2.value )
);
};
gm.read( 0,1 );
</script>
</html>