def run(self): print('App::run') while apt.main_loop(): hid.scan_input() if hid.keys_down() & hid.KEY_START: break sf2d.start_frame(gfx.SCREEN_TOP) self.shit.draw(10, 10) self.shit.draw(10, TOP_HEIGHT - 10, center=(0, 15)) self.shit.draw(TOP_WIDTH - 10, 10, center=(15, 0)) self.shit.draw(TOP_WIDTH - 10, TOP_HEIGHT - 10, center=(15, 15)) self.yay.draw(CENTER_X, CENTER_Y, center=(20, 13), angle=self.yay_angle) self.yay_angle += 0.1 sf2d.end_frame() sf2d.swap_buffers() self.cleanup()
def display_state(self): if hid.keys_down() & hid.KEY_START: self.state = ST_END sf2d.start_frame(gfx.SCREEN_TOP, gfx.SIDE_LEFT) self.bg.draw(0, 0) sf2d.end_frame() sf2d.swap_buffers()
def run(self): while apt.main_loop(): hid.scan_input() self.draw_top() self.draw_bottom() if self.quit or self.complete: break sf2d.swap_buffers() self._cleanup()
def load_state(self): tex = self.bg_loader.get_image() if tex is not None: del self.bg_loader self.bg = sf2d.Texture(tex[0], tex[1], sf2d.TEXFMT_RGBA8, sf2d.PLACE_RAM, tex[3]) self.state = ST_DISP print('\x1b[1;1H' + (' ' * 50)) return print('\x1b[1;1HLoading %s' % self.load_pat[self.load_pat_idx]) self.load_pat_idx += 1 if self.load_pat_idx >= len(self.load_pat): self.load_pat_idx = 0 sf2d.swap_buffers()
tex = sf2d.Texture(png[0], png[1], sf2d.TEXFMT_RGBA8, sf2d.PLACE_RAM, png[3]) x = 0 y = 0 while apt.main_loop(): hid.scan_input() if hid.keys_down() & hid.KEY_START: break held = hid.keys_held() if held & hid.KEY_DPAD_RIGHT: x += 1 elif held & hid.KEY_DPAD_LEFT: x -= 1 if held & hid.KEY_DPAD_DOWN: y += 1 elif held & hid.KEY_DPAD_UP: y -= 1 sf2d.start_frame(gfx.SCREEN_TOP, gfx.SIDE_LEFT) tex.draw(x, y) sf2d.end_frame() sf2d.swap_buffers() print('\x1b[1;1H%6.0f fps' % sf2d.get_fps()) sf2d.fini()