-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreen_interface_test.py
More file actions
34 lines (23 loc) · 897 Bytes
/
screen_interface_test.py
File metadata and controls
34 lines (23 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from ctypes import CDLL, c_void_p, c_int, c_float
import time
from screen import LOCAL_PALETTES_LENGTH
libscreen = CDLL("libscreen.so")
libscreen.ex_constructScreen.restype = c_void_p
libscreen.ex_setUniversalBg.argtypes = [c_void_p, c_int]
libscreen.ex_setLocalPalettes.argtypes = [c_void_p, (c_float * LOCAL_PALETTES_LENGTH)]
libscreen.ex_drawToBuffer.argtypes = [c_void_p]
libscreen.ex_draw.argtypes = [c_void_p]
libscreen.ex_draw.restype = c_int
drawval = 0
bg = 0
palettes = [0.0 for i in xrange(LOCAL_PALETTES_LENGTH)]
c_paletteInput = (c_float * LOCAL_PALETTES_LENGTH) (*palettes)
screen = libscreen.ex_constructScreen()
while drawval == 0:
libscreen.ex_setUniversalBg(screen, bg)
bg = (bg + 1) % 0x40
libscreen.ex_setLocalPalettes(screen, c_paletteInput)
libscreen.ex_drawToBuffer(screen)
drawval = libscreen.ex_draw(screen)
time.sleep(0.2)
print "done"