annotate pytouhou/ui/window.pxd @ 589:0768122da817

Add a frameskip option, and use swap interval to implement it.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 10 Oct 2014 15:59:11 +0200
parents 00f228b57840
children 12756994a92c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
458
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 from pytouhou.lib cimport sdl
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
2
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
3
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
4 cdef class Clock:
491
2276229282fd Fix gcc’s warnings with -Wall -Wextra.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
5 cdef unsigned long _ref_tick
2276229282fd Fix gcc’s warnings with -Wall -Wextra.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
6 cdef long _target_fps, _ref_frame, _fps_tick, _fps_frame
533
de778a80820a Optimise Clock a bit more.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 512
diff changeset
7 cdef double fps
458
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
8
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
9 cdef void set_target_fps(self, long fps) nogil
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
10 cdef void tick(self) nogil except *
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
11
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
12
463
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
13 cdef class Runner:
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
14 cdef long width, height
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
15
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
16 cdef void start(self) except *
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
17 cdef void finish(self) except *
578
00f228b57840 Make Runner.update callable from Python code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 553
diff changeset
18 cpdef bint update(self) except? False
463
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
19
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
20
458
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
21 cdef class Window:
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
22 cdef sdl.Window win
463
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
23 cdef Runner runner
458
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
24 cdef Clock clock
589
0768122da817 Add a frameskip option, and use swap interval to implement it.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 578
diff changeset
25 cdef int frame, frameskip
458
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
26
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
27 cdef void set_size(self, int width, int height) nogil
463
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
28 cpdef set_runner(self, Runner runner=*)
458
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
29 cpdef run(self)
1b56d62250ab Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
30 cdef bint run_frame(self) except? False
463
11708a1d0a1a Make GameRunner inherit from a Runner base class, to bypass Python calls in Window.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 458
diff changeset
31 cdef double get_fps(self) nogil