Пример #1
0
def test_console_rexpaint_save_load(console, tmpdir, ch, fg, bg):
    libtcodpy.console_print(console, 0, 0, 'test')
    libtcodpy.console_put_char_ex(console, 1, 1, ch, fg, bg)
    xp_file = tmpdir.join('test.xp').strpath
    assert libtcodpy.console_save_xp(console, xp_file, 1)
    xp_console = libtcodpy.console_from_xp(xp_file)
    assert xp_console
    assertConsolesEqual(console, xp_console)
    assert libtcodpy.console_load_xp(None, xp_file)
    assertConsolesEqual(console, xp_console)
Пример #2
0
def test_console_rexpaint_save_load(console, tmpdir, ch, fg, bg):
    libtcodpy.console_print(console, 0, 0, 'test')
    libtcodpy.console_put_char_ex(console, 1, 1, ch, fg, bg)
    xp_file = tmpdir.join('test.xp').strpath
    assert libtcodpy.console_save_xp(console, xp_file, 1)
    xp_console = libtcodpy.console_from_xp(xp_file)
    assert xp_console
    assertConsolesEqual(console, xp_console)
    assert libtcodpy.console_load_xp(None, xp_file)
    assertConsolesEqual(console, xp_console)
Пример #3
0
def test_console_rexpaint_load_test_file(console):
    xp_console = libtcodpy.console_from_xp('libtcod/data/rexpaint/test.xp')
    assert xp_console
    assert libtcodpy.console_get_char(xp_console, 0, 0) == ord('T')
    assert libtcodpy.console_get_char(xp_console, 1, 0) == ord('e')
    assert (libtcodpy.console_get_char_background(xp_console, 0, 1) ==
            libtcodpy.Color(255, 0, 0))
    assert (libtcodpy.console_get_char_background(xp_console, 1, 1) ==
            libtcodpy.Color(0, 255, 0))
    assert (libtcodpy.console_get_char_background(xp_console, 2, 1) ==
            libtcodpy.Color(0, 0, 255))
Пример #4
0
def test_console_rexpaint_load_test_file(console):
    xp_console = libtcodpy.console_from_xp('libtcod/data/rexpaint/test.xp')
    assert xp_console
    assert libtcodpy.console_get_char(xp_console, 0, 0) == ord('T')
    assert libtcodpy.console_get_char(xp_console, 1, 0) == ord('e')
    assert (libtcodpy.console_get_char_background(xp_console, 0, 1) ==
            libtcodpy.Color(255, 0, 0))
    assert (libtcodpy.console_get_char_background(xp_console, 1, 1) ==
            libtcodpy.Color(0, 255, 0))
    assert (libtcodpy.console_get_char_background(xp_console, 2, 1) ==
            libtcodpy.Color(0, 0, 255))
Пример #5
0
def main_menu(console: tcod.console.Console, bg_image: str, screen_width: int,
              screen_height: int) -> None:
    console.clear()

    bg_image = tcod.image_load(bg_image)
    bg_image.blit_2x(console, 0, 0)

    title_con = tcod.console_from_xp("arcturus.xp")

    title_con.blit(console, 24, 24, bg_alpha=0.0)

    menu(console,
         "", ["New Game", "Load Game", "Quit"],
         13,
         screen_width,
         screen_height,
         sy=31)