Beispiel #1
0
    def init_program(self):
        """Setup method that is run when program starts."""
        libt.console_set_custom_font(config.get_img_path('char_sheet'), 
                                     libt.FONT_TYPE_GREYSCALE 
                                     | libt.FONT_LAYOUT_TCOD)
        libt.console_init_root(config.SCREEN_WIDTH, config.SCREEN_HEIGHT, 
                               "BOGEY", False)
        libt.console_credits()
        libt.console_set_keyboard_repeat(50, 100)
        libt.sys_set_fps(60)

        # Screen consoles
        self.game_map = libt.console_new(config.MAP_WIDTH, config.MAP_HEIGHT)
        self.gui = libt.console_new(config.GUI_WIDTH, config.GUI_HEIGHT)

        # Set up input
        self.key = libt.Key()
        self.mouse = libt.Mouse()

        # Create main menu
        self.main_menu = gui.MainMenu()
        self.main_menu.draw()
        self.main_menu.select()
Beispiel #2
0
    # for obj in objects:
    #     obj.clear()

    action = m.handle()
    print action                # debug message log to console
    if action == 'new game':
      new_game()
    if action == 'continue':
      load_game()
    if action == 'exit':
      break

  print 'Thank you for playing%s\nGoodbye!'%GAME_TITLE


if __name__ == '__main__':
  # initialization
  tl.console_set_custom_font('arial12x12.png',
               tl.FONT_TYPE_GREYSCALE | tl.FONT_LAYOUT_TCOD)
  tl.console_init_root(SCREEN_W, SCREEN_H, GAME_TITLE, False)   # window
  tl.sys_set_fps(LIMFPS)                   # frame rate limit
  tl.console_set_keyboard_repeat(250, 30)  # init', rep. delay[ms]
  # globals' IDs: scr(een), key(board), mouse
  scr = tl.console_new(SCREEN_W, SCREEN_H)
  key, mouse = tl.Key(), tl.Mouse()
  # show intro if it is set up to be shown
  if INTRO: tl.console_credits()
  # enter main loop
  main()
Beispiel #3
0
def test_credits_long(console):
    libtcodpy.console_credits()
Beispiel #4
0
tcod.console_set_custom_font(os.path.join('fonts', 'terminal8x8_aa_ro.png'),
                             tcod.FONT_LAYOUT_ASCII_INROW)

tcod.console_init_root(constant.SCREEN_WIDTH, constant.SCREEN_HEIGHT, 'S.T.A.L.K.E.R RL', False)

# Console for any temporary UI elements (inventory, equipment, etc)
ui_con   = tcod.console_new(constant.SCREEN_WIDTH, constant.SCREEN_HEIGHT)
# Main console that the map and constant UI elements are rendered to
game_con = tcod.console_new(constant.SCREEN_WIDTH, constant.SCREEN_HEIGHT)

tcod.sys_set_fps(constant.FPS_CAP)
tcod.console_set_keyboard_repeat(10, 50)
tcod.mouse_show_cursor(False)

tcod.console_credits()

img = tcod.image_load(os.path.join('images', 'menu_background.png'))
tcod.image_blit_2x(img, game_con, 0, 0)
tcod.console_blit(game_con, 0, 0, 0, 0, 0, 0, 0)
tcod.console_flush()

main_menu_index = 0
while not tcod.console_is_window_closed():
    tcod.image_blit_2x(img, game_con, 0, 0)
    tcod.console_blit(game_con, 0, 0, 0, 0, 0, 0, 0)
    tcod.console_clear(ui_con)
    ui.draw_menu(ui_con, "S.T.A.L.K.E.R. RL", ['New Game', 'Load Game', 'Highscores', 'Exit'],
                 MAIN_MENU_WIDTH, MAIN_MENU_HEIGHT, main_menu_index)
    tcod.console_blit(ui_con, 0, 0, MAIN_MENU_WIDTH, MAIN_MENU_HEIGHT, 0, MAIN_MENU_X, MAIN_MENU_Y, 1.0, 0.7)
    tcod.console_flush()