summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/TextureSurface.java
blob: eae6b72435fd4311c23962239c74e9df426098ed (plain) (blame)
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
/*    */ 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)
/*    */   {
/* 26 */     this._width = w;
/* 27 */     this._height = h;
/* 28 */     this._oldObject = 0;
/*    */     
/* 30 */     this._hwnd = nativeInit(w, h);
/* 31 */     this._offscreen = nativeMakeDC(this._hwnd, w, h);
/*    */     
/* 33 */     if (texList != null) {
/* 34 */       setTextures(texList, rows);
/*    */     }
/*    */   }
/*    */   
/*    */   public void finalize() {
/* 39 */     nativeDestroyDC(this._offscreen);
/* 40 */     this._oldObject = 0;
/*    */   }
/*    */   
/*    */   public void setTextures(Texture[] texList, int rows)
/*    */   {
/* 45 */     this._textures = texList;
/*    */     
/*    */ 
/* 48 */     this._rows = rows;
/* 49 */     this._cols = (texList.length / rows);
/* 50 */     this._texWidth = (this._width / this._cols);
/* 51 */     this._texHeight = (this._height / this._rows);
/*    */   }
/*    */   
/*    */ 
/*    */   public synchronized boolean draw(TextureSurfaceRenderer renderer)
/*    */   {
/* 57 */     renderer.renderTo(this._offscreen);
/*    */     
/*    */ 
/* 60 */     int idx = 0;
/* 61 */     for (int row = this._rows - 1; row >= 0; row--)
/*    */     {
/* 63 */       for (int col = 0; col < this._cols; col++)
/*    */       {
/* 65 */         if (this._textures[idx] != null)
/*    */         {
/* 67 */           this._textures[idx].copyFrom(this._offscreen, 
/* 68 */             col * this._texWidth, (col + 1) * this._texWidth, 
/* 69 */             row * this._texHeight, (row + 1) * this._texHeight);
/*    */         }
/* 71 */         idx++;
/*    */       }
/*    */     }
/*    */     
/* 75 */     return false;
/*    */   }
/*    */   
/*    */   public void sendLeftClick(int x, int y)
/*    */   {
/* 80 */     nativeLeftClick(this._hwnd, x, y);
/*    */   }
/*    */   
/* 83 */   public int getHwnd() { return this._hwnd; }
/* 84 */   public int getWidth() { return this._width; }
/* 85 */   public int getHeight() { return this._height; }
/*    */   
/*    */   private native int nativeInit(int paramInt1, int paramInt2);
/*    */   
/*    */   private native int nativeMakeDC(int paramInt1, int paramInt2, int paramInt3);
/*    */   
/*    */   private native int nativeGetDC(int paramInt);
/*    */   
/*    */   private native void nativeReleaseDC(int paramInt1, int paramInt2);
/*    */   
/*    */   private native void nativeDestroyDC(int paramInt);
/*    */   
/*    */   private native void nativeLeftClick(int paramInt1, int paramInt2, int paramInt3);
/*    */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\TextureSurface.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */