Exemplo n.º 1
0
def render_frame():
    offset_3d = os.get_3d_slider_state() * 30.0

    sf2d.start_frame(gfx.SCREEN_TOP, gfx.SIDE_LEFT)

    draw_shit()
    tex_yay3ds.draw(200 - int(offset_3d / 2.0),
                    120,
                    center=(tex_yay3ds.width / 2, tex_yay3ds.height / 2),
                    angle=angle)

    sf2d.end_frame()

    if offset_3d == 0:
        return

    sf2d.start_frame(gfx.SCREEN_TOP, gfx.SIDE_RIGHT)

    draw_shit()
    tex_yay3ds.draw(200 + int(offset_3d / 2.0),
                    120,
                    center=(tex_yay3ds.width / 2, tex_yay3ds.height / 2),
                    angle=angle)

    sf2d.end_frame()
Exemplo n.º 2
0
    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()
Exemplo n.º 3
0
    def __init__(self):
        sf2d.init()
        sftd.init()
        soc.init()

        sf2d.set_clear_color(sf2d.rgba8(0, 0, 0, 255))

        # clear screens
        sf2d.start_frame(gfx.SCREEN_TOP)
        sf2d.end_frame()
        sf2d.start_frame(gfx.SCREEN_BOTTOM)
        sf2d.end_frame()

        self.bg_tile = self.load_texture('bg_tile')
        self.pc_icon = self.load_texture('computer')
        self.arrow = self.load_texture('arrow')
        self.python = self.load_texture('script')
        self._3ds = self.load_texture('3ds')
        self.progress = self.load_texture('progress')
        self.progress_bg = self.load_texture('progress_bg')
        self.success = self.load_texture('success')

        self.font = sftd.Font('romfs:/netload_assets/DroidSans-Bold.ttf', 20, color=sf2d.rgba8(0, 0, 0, 255))

        self.state = STATE_WAITING

        for i in range(1, 9):
            self.spinner.append(self.load_texture('spinner%d' % i))

        self.setup_socket()
Exemplo n.º 4
0
    def draw_bottom(self):
        sf2d.start_frame(gfx.SCREEN_BOTTOM)

        self.bg_tile.draw_quad_uv(0, 0, BOT_WIDTH, BOT_HEIGHT, 0, 0, BOT_WIDTH / 8, BOT_HEIGHT / 8, REPEAT_TEX)

        if self.state == STATE_WAITING:
            self.font.draw_text(65, BOT_HEIGHT - 30, 'Press Start to Cancel')

        sf2d.end_frame()
Exemplo n.º 5
0
    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()
Exemplo n.º 6
0
    def draw_top(self):
        sf2d.start_frame(gfx.SCREEN_TOP)

        self.bg_tile.draw_quad_uv(0, 0, TOP_WIDTH, TOP_HEIGHT, 0, 0, TOP_WIDTH / 8, TOP_HEIGHT / 8, REPEAT_TEX)

        self.font.draw_text(0, 0, '')
        self.font.size = 30
        self.font.draw_text(45, 10, 'Monty3DS NetLoader')
        self.font.size = 20

        {STATE_WAITING: self.state_waiting,
         STATE_RECEIVING: self.state_receiving,
         STATE_DONE: self.state_done
         }[self.state]()

        sf2d.end_frame()
Exemplo n.º 7
0
def render_frame():
    offset_3d = os.get_3d_slider_state() * 30.0

    sf2d.start_frame(gfx.SCREEN_TOP, gfx.SIDE_LEFT)

    draw_shit()
    tex_yay3ds.draw(200 - int(offset_3d / 2.0), 120, center=(tex_yay3ds.width / 2, tex_yay3ds.height / 2), angle=angle)

    sf2d.end_frame()

    if offset_3d == 0:
        return

    sf2d.start_frame(gfx.SCREEN_TOP, gfx.SIDE_RIGHT)

    draw_shit()
    tex_yay3ds.draw(200 + int(offset_3d / 2.0), 120, center=(tex_yay3ds.width / 2, tex_yay3ds.height / 2), angle=angle)

    sf2d.end_frame()
Exemplo n.º 8
0
    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()
Exemplo n.º 9
0
import math

sf2d.init()
sf2d.set_clear_color(sf2d.rgba8(0x40, 0x40, 0x40, 0xFF))

console.init(gfx.SCREEN_BOTTOM)

rads = 0.0

while apt.main_loop():
    hid.scan_input()

    if hid.keys_down() & hid.KEY_START:
        break

    sf2d.start_frame(gfx.SCREEN_TOP, gfx.SIDE_LEFT)

    sf2d.draw_fill_circle(60, 100, 35, sf2d.rgba8(0, 255, 0, 255))
    sf2d.draw_fill_circle(180, 120, 55, sf2d.rgba8(255, 255, 0, 255))

    sf2d.draw_rectangle_rotate(260, 20, 40, 40, sf2d.rgba8(255, 255, 0, 255), 2.0 * rads)
    sf2d.draw_rectangle(20, 60, 40, 40, sf2d.rgba8(255, 0, 0, 255))
    sf2d.draw_rectangle(5, 5, 30, 30, sf2d.rgba8(0, 255, 255, 255))

    sf2d.end_frame()

    rads += 0.01

    print('\x1b[1;1H%6.0f fps' % sf2d.get_fps())

    sf2d.swapbuffers()
Exemplo n.º 10
0
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()