35 """Scene Viewer Window"""
43 LIBAMINOGL = ctypes.CDLL(
"libamino-gl.so")
46 class RxWin(ctypes.Structure):
47 """Opaque type for scene window"""
50 """Scene Viewer Window."""
51 __slots__ = [
'_ptr',
'_scenegraph',
'_q']
61 """Create a new window.
64 title: the window title
65 width: window width in pixels
66 height: window width in pixels
67 start: whether to immediatly start the window
68 background: whether to run the window in an asynchronous background thread
69 scenegraph: scene to display
70 config: configuration of the scene
72 title = ensure_cstring(title)
73 self.
_ptr_ptr = LIBAMINOGL.aa_rx_win_default_create(title, width, height)
82 self.
startstart(background)
85 LIBAMINOGL.aa_rx_win_destroy(self.
_ptr_ptr)
87 def start(self, background=False):
91 background: whether to run the window in an asynchronous background thread
95 LIBAMINOGL.aa_rx_win_run_async()
97 LIBAMINOGL.aa_rx_win_run()
100 def scenegraph(self):
101 """The displayed scenegraph."""
105 def scenegraph(self, scenegraph):
107 self.
_q_q =
DVec(scenegraph.config_count)
108 LIBAMINOGL.aa_rx_win_set_sg(self.
_ptr_ptr, scenegraph._ptr)
112 """The current configuration."""
116 def config(self, config):
117 self.
_q_q = self.
_scenegraph_scenegraph.config_vector(config, self.
_q_q)
118 LIBAMINOGL.aa_rx_win_set_bconfig(self.
_ptr_ptr, self.
_q_q)
122 """The current configuration FK."""
124 fk.config = self.
_q_q
132 """Stop the window."""
133 LIBAMINOGL.aa_rx_win_stop(self.
_ptr_ptr)
136 """Returns True if the window is still running."""
137 return bool(LIBAMINOGL.aa_rx_win_is_running(self.
_ptr_ptr))
140 """Lock the window"""
141 LIBAMINOGL.aa_rx_win_lock(self.
_ptr_ptr)
144 """Lock the window"""
145 LIBAMINOGL.aa_rx_win_unlock(self.
_ptr_ptr)
148 LIBAMINOGL.aa_gl_init.argtypes = []
150 LIBAMINOGL.aa_rx_win_default_create.argtypes = [
151 ctypes.c_char_p, ctypes.c_int, ctypes.c_int
153 LIBAMINOGL.aa_rx_win_default_create.restype = ctypes.POINTER(RxWin)
155 LIBAMINOGL.aa_rx_win_destroy.argtypes = [ctypes.POINTER(RxWin)]
157 LIBAMINOGL.aa_rx_win_set_bconfig.argtypes = [
158 ctypes.POINTER(RxWin), ctypes.POINTER(DVec)
161 LIBAMINOGL.aa_rx_win_run.argtypes = []
162 LIBAMINOGL.aa_rx_win_run_async.argtypes = []
163 LIBAMINOGL.aa_rx_win_stop.argtypes = [ctypes.POINTER(RxWin)]
165 LIBAMINOGL.aa_rx_win_set_sg.argtypes = [
166 ctypes.POINTER(RxWin), ctypes.POINTER(RxSg)
169 LIBAMINOGL.aa_rx_win_is_running.argtypes = [ctypes.POINTER(RxWin)]
170 LIBAMINOGL.aa_rx_win_is_running.restype = ctypes.c_int
172 LIBAMINOGL.aa_rx_win_lock.argtypes = [ctypes.POINTER(RxWin)]
173 LIBAMINOGL.aa_rx_win_unlock.argtypes = [ctypes.POINTER(RxWin)]
def start(self, background=False)
Start the window.
def fk(self)
The current configuration FK.
def __init__(self, title="PyAmino", width=800, height=600, start=True, background=True, scenegraph=None, config=None)
Create a new window.
def scenegraph(self, scenegraph)
def config(self)
The current configuration.
def is_runnining(self)
Returns True if the window is still running.
def scenegraph(self)
The displayed scenegraph.
def stop(self)
Stop the window.
def lock(self)
Lock the window.
def unlock(self)
Lock the window.