sdlterm/cython/sdlterm.pyx
changeset 57 911927edbdde
parent 55 1ab0edd5d784
child 67 71f60bf6ebb7
equal deleted inserted replaced
56:282a07d20680 57:911927edbdde
    46         void set_attr(int value)
    46         void set_attr(int value)
    47 
    47 
    48         void show_cursor(int x, int y)
    48         void show_cursor(int x, int y)
    49         void hide_cursor()
    49         void hide_cursor()
    50 
    50 
    51         void get_next_event(Event event)
    51         bool wait_event(Event event, int timeout) except +
    52 
    52 
    53         int get_width()
    53         int get_width()
    54         int get_height()
    54         int get_height()
    55 
    55 
    56 
    56 
    83     def show_cursor(self, x, y):
    83     def show_cursor(self, x, y):
    84         self.thisptr.show_cursor(x, y)
    84         self.thisptr.show_cursor(x, y)
    85     def hide_cursor(self):
    85     def hide_cursor(self):
    86         self.thisptr.hide_cursor()
    86         self.thisptr.hide_cursor()
    87 
    87 
    88     def get_next_event(self):
    88     def wait_event(self, timeout):
    89         self.thisptr.get_next_event(self.event)
    89         if not self.thisptr.wait_event(self.event, timeout or 0):
       
    90             # timeout
       
    91             return None
    90         event = self.event
    92         event = self.event
    91         if event.type == event.MOUSEMOVE:
    93         if event.type == event.MOUSEMOVE:
    92             return ('mousemove', event.mouse.x, event.mouse.y)
    94             return ('mousemove', event.mouse.x, event.mouse.y)
    93         if event.type == event.MOUSEDOWN:
    95         if event.type == event.MOUSEDOWN:
    94             return ('mousedown', event.mouse.x, event.mouse.y, event.mouse.button)
    96             return ('mousedown', event.mouse.x, event.mouse.y, event.mouse.button)