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
|
package NET.worlds.scape;
public class TextureSurface {
private Texture[] _textures;
private int _hwnd;
private int _oldObject;
private int _offscreen;
private int _texWidth;
private int _texHeight;
private int _width;
private int _height;
private int _rows;
private int _cols;
public TextureSurface(Texture[] texList, int rows, int w, int h) {
this._width = w;
this._height = h;
this._oldObject = 0;
this._hwnd = this.nativeInit(w, h);
this._offscreen = this.nativeMakeDC(this._hwnd, w, h);
if (texList != null) {
this.setTextures(texList, rows);
}
}
@Override
public void finalize() {
this.nativeDestroyDC(this._offscreen);
this._oldObject = 0;
}
public void setTextures(Texture[] texList, int rows) {
this._textures = texList;
this._rows = rows;
this._cols = texList.length / rows;
this._texWidth = this._width / this._cols;
this._texHeight = this._height / this._rows;
}
public synchronized boolean draw(TextureSurfaceRenderer renderer) {
renderer.renderTo(this._offscreen);
int idx = 0;
for (int row = this._rows - 1; row >= 0; row--) {
for (int col = 0; col < this._cols; col++) {
if (this._textures[idx] != null) {
this._textures[idx]
.copyFrom(this._offscreen, col * this._texWidth, (col + 1) * this._texWidth, row * this._texHeight, (row + 1) * this._texHeight);
}
idx++;
}
}
return false;
}
public void sendLeftClick(int x, int y) {
this.nativeLeftClick(this._hwnd, x, y);
}
public int getHwnd() {
return this._hwnd;
}
public int getWidth() {
return this._width;
}
public int getHeight() {
return this._height;
}
private native int nativeInit(int var1, int var2);
private native int nativeMakeDC(int var1, int var2, int var3);
private native int nativeGetDC(int var1);
private native void nativeReleaseDC(int var1, int var2);
private native void nativeDestroyDC(int var1);
private native void nativeLeftClick(int var1, int var2, int var3);
}
|