73 /** |
74 /** |
74 * Constructor. |
75 * Constructor. |
75 * |
76 * |
76 * @param suppressKeyEvents supress game key events. |
77 * @param suppressKeyEvents supress game key events. |
77 */ |
78 */ |
78 protected GameCanvas(boolean suppressKeyEvents) { |
79 protected GameCanvas(boolean suppressKeyEvents) |
|
80 { |
79 super(); |
81 super(); |
80 LCDUIInvoker.initGameCanvas(this, suppressKeyEvents); |
82 LCDUIInvoker.initGameCanvas(this, suppressKeyEvents); |
81 } |
83 } |
82 |
84 |
83 /** |
85 /** |
84 * Get frameBuffer's Graphics object. |
86 * Get frameBuffer's Graphics object. |
85 * |
87 * |
86 * @return frameBuffer's Graphics |
88 * @return frameBuffer's Graphics |
87 */ |
89 */ |
88 protected Graphics getGraphics() { |
90 protected Graphics getGraphics() |
|
91 { |
89 return (Graphics) LCDUIInvoker.getGraphics(this); |
92 return (Graphics) LCDUIInvoker.getGraphics(this); |
90 } |
93 } |
91 |
94 |
92 /** |
95 /** |
93 * Get game key states. |
96 * Get game key states. |
94 * |
97 * |
95 * @return game key states |
98 * @return game key states |
96 */ |
99 */ |
97 public int getKeyStates() { |
100 public int getKeyStates() |
|
101 { |
98 return LCDUIInvoker.getKeyStates(this); |
102 return LCDUIInvoker.getKeyStates(this); |
99 } |
103 } |
100 |
104 |
101 /** |
105 /** |
102 * By default this renders the frameBuffer at (0,0). |
106 * By default this renders the frameBuffer at (0,0). |
103 * |
107 * |
104 * @param g Graphics object |
108 * @param g Graphics object |
105 */ |
109 */ |
106 public void paint(javax.microedition.lcdui.Graphics g) { |
110 public void paint(javax.microedition.lcdui.Graphics g) |
|
111 { |
107 // If the Graphics doesn't belong to the frame buffer |
112 // If the Graphics doesn't belong to the frame buffer |
108 LCDUIInvoker.renderGraphics(this, g); |
113 LCDUIInvoker.renderGraphics(this, g); |
109 } |
114 } |
110 |
115 |
111 /** |
116 /** |
114 * @param x clip X |
119 * @param x clip X |
115 * @param y clip Y |
120 * @param y clip Y |
116 * @param w clip width |
121 * @param w clip width |
117 * @param h clip height |
122 * @param h clip height |
118 */ |
123 */ |
119 public void flushGraphics(int x, int y, int w, int h) { |
124 public void flushGraphics(int x, int y, int w, int h) |
120 if (w > 0 && h > 0) { |
125 { |
|
126 if(w > 0 && h > 0) |
|
127 { |
121 LCDUIInvoker.flushGraphics(this, x, y, w, h); |
128 LCDUIInvoker.flushGraphics(this, x, y, w, h); |
122 } |
129 } |
123 } |
130 } |
124 |
131 |
125 /** |
132 /** |
126 * Flushes the frameBuffer to the display. |
133 * Flushes the frameBuffer to the display. |
127 */ |
134 */ |
128 public void flushGraphics() { |
135 public void flushGraphics() |
|
136 { |
129 LCDUIInvoker.flushGraphics(this, 0, 0, getWidth(), getHeight()); |
137 LCDUIInvoker.flushGraphics(this, 0, 0, getWidth(), getHeight()); |
130 } |
138 } |
131 |
139 |
132 } |
140 } |