-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.js
116 lines (77 loc) · 1.86 KB
/
graphics.js
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
var
graphics = (function() {
var
DCs = [],
graphicsObj = {},
defaultBg = '',
images = {},
objs = [],
screen = document.getElementById('screen'),
screenCtx = screen.getContext('2d'),
/* Private Methods */
loadImage = function(file) {
if (typeof(images[file]) === 'undefined') {
images[file] = {};
$.ajax({
url:'getImage.php?file=' + file,
dataType:'json',
async:false,
success:function(data) {
images[file] = data;
}
});
}
},
/* Public Methods */
methods = {
init:function() {
var obj;
for (var i = 0; i < 16; i++) {
obj = {};
obj.element = document.createElement('canvas');
obj.element.width = 640,
obj.element.height = 480,
obj.ctx = obj.element.getContext('2d');
DCs.push(obj);
}
},
fastBlit:function(src, x, y, height, width, dest, alpha) {
dest.drawImage(src, x, y, height, width);
},
refresh:function() {
screenCtx.drawImage(DCs[0].ctx, 0, 0, 640, 480, screenCtx);
},
newObj:function() {
},
getObj:function(type, layer) {
},
solid:function(layer, x, y, width, height, r, g, b) {
},
open:function(file, effect, opacity) {
loadImage(file);
},
load:function(file, type, layer, sub, visible) {
},
move:function(type, layer, x, y) {
},
setPattern:function(type, layer, pattern) {
},
displayRect:function(type, layer, x, y, width, height) {
},
adjust:function(type, layer, index, x, y) {
},
del:function(layer) {
},
clear:function(type, layer) {
},
clearLayer:function(layer) {
},
moveLayer:function(type, src, dest) {
},
alpha:function(type, layer, alpha) {
},
show:function(type, layer, visibility) {
}
};
return methods;
}());