@@ 212-240 (lines=29) @@ | ||
209 | self.ortho = matrix.orthographic(0.0, self.width, self.height, 0.0, -1.0, 1.0) |
|
210 | self.view.set_projection('ortho', self.ortho) |
|
211 | ||
212 | def process_event(self, event, data): |
|
213 | if event == 'quit' or event == 'window_close': |
|
214 | self.running = False |
|
215 | elif event == 'window_resized': |
|
216 | winID, x, y = data |
|
217 | self.resize(x, y) |
|
218 | elif event == 'mouse_move': |
|
219 | print (data) |
|
220 | ||
221 | if cursor.is_relative(): |
|
222 | xrel, yrel = data |
|
223 | self.mousePosX += xrel |
|
224 | self.mousePosY += yrel |
|
225 | else: |
|
226 | self.mousePosX, self.mousePosY = data |
|
227 | elif event == 'key_down': |
|
228 | if data[0] == 'r': |
|
229 | cursor.set_relative_mode(True) |
|
230 | elif data[0] == 'd': |
|
231 | cursor.set_relative_mode(False) |
|
232 | self.keys.append(data[0]) |
|
233 | print(self.keys) |
|
234 | elif event == 'key_up': |
|
235 | self.keys.remove(data[0]) |
|
236 | elif event == 'mouse_button_down': |
|
237 | self.mouseButtons.append(data[0]) |
|
238 | print(self.mouseButtons) |
|
239 | elif event == 'mouse_button_up': |
|
240 | self.mouseButtons.remove(data[0]) |
|
241 | ||
242 | def update(self): |
|
243 | self.scenegraph.update() |
@@ 215-240 (lines=26) @@ | ||
212 | ||
213 | self.vpFull.set_rect(0, 0, self.width, self.height) |
|
214 | ||
215 | def process_event(self, event, data): |
|
216 | if event == 'quit' or event == 'window_close': |
|
217 | self.running = False |
|
218 | elif event == 'window_resized': |
|
219 | winID, x, y = data |
|
220 | self.resize(x, y) |
|
221 | elif event == 'mouse_move': |
|
222 | if cursor.is_relative(): |
|
223 | self.mouseRelX, self.mouseRelY = data |
|
224 | else: |
|
225 | self.mousePosX, self.mousePosY = data |
|
226 | elif event == 'key_down': |
|
227 | if data[0] == 'c': |
|
228 | cursor.set_relative_mode(True) |
|
229 | elif data[0] == 'r': |
|
230 | cursor.set_relative_mode(False) |
|
231 | cursor.move_cursor(self.mousePosX, self.mousePosY) |
|
232 | self.keys.append(data[0]) |
|
233 | print(self.keys) |
|
234 | elif event == 'key_up': |
|
235 | self.keys.remove(data[0]) |
|
236 | elif event == 'mouse_button_down': |
|
237 | self.mouseButtons.append(data[0]) |
|
238 | print(self.mouseButtons) |
|
239 | elif event == 'mouse_button_up': |
|
240 | self.mouseButtons.remove(data[0]) |
|
241 | ||
242 | def keyUpdate(self): |
|
243 |