Mercurial > touhou
annotate pytouhou/ui/window.pxd @ 669:1bb8b34dbd32
Don’t allocate a Vec while reading a String in ECL.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 12 Aug 2019 15:10:19 +0200 |
parents | 80687f258001 |
children |
rev | line source |
---|---|
635
80687f258001
Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
617
diff
changeset
|
1 cimport pytouhou.lib.gui as gui |
458
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 |
617
a6af3ff86612
Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
606
diff
changeset
|
10 cdef bint tick(self) nogil except True |
458
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 |
617
a6af3ff86612
Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
606
diff
changeset
|
16 cdef bint start(self) except True |
a6af3ff86612
Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
606
diff
changeset
|
17 cdef bint finish(self) except True |
606
3c2f96f1d715
Fix compilation under Cython 0.22, by making the pyx and the pxd declarations’ except clause similar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
596
diff
changeset
|
18 cpdef bint update(self, bint render) except -1 |
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: |
635
80687f258001
Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
617
diff
changeset
|
22 cdef gui.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 |
596
ab131d04987d
Fix a regression introduced in the previous commit when the interface has a different resolution than 640×480 and framebuffer_blit is enabled.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
594
diff
changeset
|
26 cdef int width, height |
458
1b56d62250ab
Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
27 |
1b56d62250ab
Make pytouhou.ui.{window,shader,game{runner,renderer}} extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 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
|
29 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
|
30 cpdef run(self) |
606
3c2f96f1d715
Fix compilation under Cython 0.22, by making the pyx and the pxd declarations’ except clause similar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
596
diff
changeset
|
31 cdef bint run_frame(self) except -1 |
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
|
32 cdef double get_fps(self) nogil |
635
80687f258001
Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
617
diff
changeset
|
33 cdef list get_events(self) |
80687f258001
Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
617
diff
changeset
|
34 cdef int get_keystate(self) nogil |
80687f258001
Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
617
diff
changeset
|
35 cdef void toggle_fullscreen(self) nogil |