Esempio n. 1
0
 def __init__(self):
     pygame.init()
     self.running = True
     self.size = App.WINDOW_SIZE
     self.surface = pygame.display.set_mode(self.size, pygame.RESIZABLE)
     self.text = geo.RenderText('Hello World!')
     self.rect = geo.Rect((10, 10), (20, 20), Color.RED)
     imp.IMP().register(self.text)
     imp.IMP().register(self.rect)
     imp.IMP().event_dispatcher = events.EventDispatcher()
     self.wire_events()
Esempio n. 2
0
 def __init__(self, nick, mode="+B", auto_handle=True):
     self.nickname = nick
     self.user = nick
     self.real_name = self.software
     self.filter_formatting = True
     self.channels = collections.defaultdict(protocol.Channel)
     self.events = events.EventDispatcher()
     self._prev_nickname = None
     self._mode = mode
     self._register_default_listeners()
     if auto_handle:
         self._add_built_in_handlers()
Esempio n. 3
0
 def __init__(self, debug=True, window_size=WINDOW_SIZE):
     pygame.init()
     self.success = True
     imp.IMP().init(Screen(window_size), None, events.EventDispatcher(),
                    debug)
Esempio n. 4
0
        pygame.quit()

    def run(self):
        self.start()
        while imp.IMP().running:
            for event in pygame.event.get():
                imp.IMP().on_event(event)
            self.game()
            self.draw()
        self.free()

    def game(self):
        if not self.is_paused:
            self.update()
            self.tick()


if __name__ == '__main__':
    import acts
    from config import Config

    actions = acts.UndoActions()
    config = Config('data/config_file.txt')
    event_dispatcher = events.EventDispatcher()
    screen = Screen(config.try_get('WINDOW_SIZE', (640, 400)))
    debug = config.try_get('DEBUG', False)
    imp.IMP().init(screen, config, event_dispatcher, actions, debug)

    game = Game()
    game.run()
Esempio n. 5
0
            self.set_position(self.origin)
            self.post_update = False
        self.display_text.update()
        self.box.update()

    def draw(self, surface):
        self.box.draw(surface)
        self.display_text.draw(surface)
        super().draw(surface)


if __name__ == '__main__':
    import pygame
    pygame.init()

    imp.IMP().event_dispatcher = events.EventDispatcher()

    left_btn = Button('Left')
    right_btn = Button('Right')
    top_btn = Button('Top')
    bottom_btn = Button('Bottom')
    disable_btn = Button('Disable')
    check_box = CheckBox('Checked',
                         on_checked=lambda event: print('(Un)Checked!'))
    counter_box = CounterBox(4, can_grow=True)
    increment_btn = Button('Increment',
                           lambda event: counter_box.increment(1000))
    stop_watch = StopWatch()
    start_btn = Button('Start', lambda event: stop_watch.start())
    stop_btn = Button('Stop', lambda event: stop_watch.stop())
    reset_btn = Button('Reset', lambda event: stop_watch.reset())