Changeset 48
- Timestamp:
- 04/05/08 01:16:08 (8 months ago)
- Location:
- muckaround
- Files:
-
- 1 removed
- 4 modified
- 4 copied
- 1 moved
-
blobworld/source/game.py (modified) (2 diffs)
-
blobworld/source/level.py (modified) (3 diffs)
-
blobworld/source/video.py (modified) (1 diff)
-
blobworld/test.py (modified) (2 diffs)
-
cython-game-optimise-tutorial (moved) (moved from muckaround/cython-getting-started-tutorial)
-
cython-game-optimise-tutorial/fast_circles.pyx (copied) (copied from muckaround/cython-getting-started-tutorial/fast_circles.pyx)
-
cython-game-optimise-tutorial/main.py (copied) (copied from muckaround/cython-getting-started-tutorial/main.py)
-
cython-game-optimise-tutorial/setup.py (copied) (copied from muckaround/cython-getting-started-tutorial/setup.py)
-
cython-game-optimise-tutorial/slow_circles.py (copied) (copied from muckaround/cython-getting-started-tutorial/slow_circles.py)
-
cython-getting-started-tutorial/circles.py (deleted)
Legend:
- Unmodified
- Added
- Removed
-
muckaround/blobworld/source/game.py
r43 r48 14 14 self.video = Video() 15 15 self.video.init() 16 self.video.window.on_mouse_press = self.on_mouse_press 16 17 17 18 def think(self, dt): … … 21 22 def input(self): 22 23 self.video.window.dispatch_events() 23 x, y = self.video.window._mouse_x, self.video.window._mouse_y 24 25 def on_mouse_press(self, x, y, button, modifiers): 26 self.level.add_blob((x, y), 10) 24 27 25 28 def render(self): -
muckaround/blobworld/source/level.py
r43 r48 4 4 from pyglet.gl import * 5 5 6 from blobs import Blob 6 7 7 8 class Level(object): … … 9 10 def __init__(self, game): 10 11 self.game = game 12 self.blobs = [] 11 13 12 14 def think(self, dt): 13 pass 15 for b in self.blobs: 16 b.think(dt) 17 18 def add_blob(self, pos, radius): 19 b = Blob(pos, radius) 20 self.blobs.append(b) 14 21 15 22 … … 25 32 glLoadIdentity() 26 33 34 for b in self.blobs: 35 b.render() 36 -
muckaround/blobworld/source/video.py
r43 r48 15 15 glMatrixMode(GL_PROJECTION) 16 16 glLoadIdentity() 17 glOrtho(0, 800, 600, 0, -1.0, 1.0)18 #glOrtho(0, 800, 0, 600, -1.0, 1.0)17 # glOrtho(0, 800, 600, 0, -1.0, 1.0) 18 glOrtho(0, 800, 0, 600, -1.0, 1.0) 19 19 glMatrixMode(GL_MODELVIEW) 20 20 -
muckaround/blobworld/test.py
r43 r48 14 14 game.level = LevelRenderable(game) 15 15 16 last_think = time.time() 16 17 t = time.time() 18 fr = 1. / 30 17 19 frames = 0 20 21 for a in xrange(100): 22 game.level.add_blob((random.random() * 640, random.random() * 480), 1) 23 18 24 while not game.video.window.has_exit: 19 game.think(1) 25 while last_think + fr <= time.time(): 26 game.think(fr) 27 last_think += fr 20 28 game.input() 21 29 game.render() … … 24 32 if frames % 100 == 0: 25 33 print frames / (time.time() - t) 34 t = time.time() 35 frames = 0 36 26 37 27 38 if __name__ == '__main__':