Esempio n. 1
0
 def setUp(self, screenWidth, screenHeight, FPS, fgcol):
     libtcod.console_set_custom_font(self.fontImageFileName,
             libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_ASCII_INROW)
     libtcod.console_init_root(screenWidth, screenHeight, 'List-editor', False)
     libtcod.sys_set_fps(FPS)
     libtcod.console_set_background_flag(0, libtcod.BKGND_SET)
     libtcod.console_set_default_foreground(0, fgcol)
Esempio n. 2
0
def init_libtcod():
    startup_msg = ("analyzing air quality...", "calculating primordial soup..."
        ,"reading the future...", "carbon dating your hard drive..."
        ,"finding prime numbers...")
    print(random.choice(startup_msg))
    libtcod.console_set_custom_font('data/fonts/terminal12x12_gs_ro.png', 
                                    libtcod.FONT_TYPE_GREYSCALE |
                                    libtcod.FONT_LAYOUT_ASCII_INROW)
    libtcod.console_init_root(C.SCREEN_WIDTH, C.SCREEN_HEIGHT, 
                              'top dog -- v%s' % (C.VERSION), C.FULLSCREEN)
    libtcod.sys_set_fps(C.LIMIT_FPS)
    # default font color
    libtcod.console_set_default_foreground(0, libtcod.white)
    # set color control codes for inline string formatting
    # listed by priority: think defcon levels
    # high alert, priority one
    libtcod.console_set_color_control(libtcod.COLCTRL_1
                                        ,libtcod.light_red
                                        ,libtcod.black)
    # warning, danger will robinson
    libtcod.console_set_color_control(libtcod.COLCTRL_2
                                        ,libtcod.light_yellow
                                        ,libtcod.black)
    # informational, you got a quest item
    libtcod.console_set_color_control(libtcod.COLCTRL_3
                                        ,libtcod.light_green
                                        ,libtcod.black)
    # tile and npc names
    libtcod.console_set_color_control(C.COL4
                                        ,libtcod.light_azure
                                        ,libtcod.black)
    # all other words
    libtcod.console_set_color_control(libtcod.COLCTRL_5
                                        ,libtcod.white
                                        ,libtcod.black)
    return libtcod.console_new(C.MAP_WIDTH, C.MAP_HEIGHT)
Esempio n. 3
0
    objects = file['objects']
    player = objects[file['player_index']]
    inventory = file['inventory']
    game_msgs = file['game_msgs']
    game_state = file['game_state']
    file.close()

    initialize_fov()


#########################################
#  3 INSTANTIATE OUR CLASSES FOR GAME   #
#                                       #
#########################################

libtcod.console_set_custom_font(
    'terminal10x10_gs_tc.png',
    libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD)
libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT,
                          'roguelike demo with libtcod', False)
con = libtcod.console_new(
    SCREEN_WIDTH, SCREEN_HEIGHT
)  #this has created an offscreen console we'll use instead of printing to the main console
libtcod.sys_set_fps(LIMIT_FPS)
panel = libtcod.console_new(SCREEN_WIDTH, PANEL_HEIGHT)

#########################################
#  4 MAIN LOOP                           #
#                                       #
#########################################
main_menu()
Esempio n. 4
0
    fov_recompute = True
    ambient_recompute = True
    game_state = 'playing'
    player_action = None

    frame_counter = 0
    next_random_frame = random_frame()

init_start()
init_mechanics()
init_ambience()

#libtcod.console_set_custom_font('arial10x10.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD)
libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'python/libtcod tutorial', False)
libtcod.sys_set_fps(LIMIT_FPS)
con = libtcod.console_new(MAP_WIDTH, MAP_HEIGHT)
panel = libtcod.console_new(SCREEN_WIDTH, PANEL_HEIGHT)

#a warm welcoming message!
message('Welcome stranger! Prepare to perish in the Tombs of the Ancient Kings.', libtcod.red)
sound_general_start.play()

while not libtcod.console_is_window_closed():

    #render the screen
    render_graphics()

    #recompute ambient sound voumes
    render_ambience()