示例#1
0
    def __init__(
        self, screen, frame_rate=20, sensor=None, queue=None,
        group=None, name='ScreenClock', verbose=None
    ):
        super(ScreenClock, self).__init__(
            group=group, name=name, verbose=verbose
        )
        self.__spf = 1.0 / float(frame_rate)
        self.__sensor = sensor
        self.__queue = queue
        self.__stop = threading.Event()

        # Clock related config
        self.__c = Object({
            'bitmap': screen.Bitmap(128, 64),
            'font': input_mono_24,
            'font_small': tahoma_16,
            'timestring': None,
            'datestring': None,
            'sensorstring': None,
        })

        # sensor related config
        self.__sr = Object({
            'last_read': 0,
            'last_value': None,
            'interval': 15,
        })
示例#2
0
MAP_WIDTH = 80
MAP_HEIGHT = 45

#FPS = 30

lcod.console_set_custom_font('arial10x10.png' , lcod.FONT_LAYOUT_TCOD | lcod.FONT_TYPE_GREYSCALE)


lcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT,'Rogue, more like Thief',False)
con = lcod.console_new(SCREEN_WIDTH, SCREEN_HEIGHT)
MAPcon = lcod.console_new(SCREEN_WIDTH, SCREEN_HEIGHT)

#prossima riga usata solo in real time 
#lcod.sys_set_fps(FPS)

player = Object(SCREEN_WIDTH/2,SCREEN_HEIGHT/2, '@', lcod.white)

npc = Object(SCREEN_WIDTH/2 - 5,SCREEN_HEIGHT/2, '@', lcod.white)

oggetti = [npc, player]

mappa = Mappa(MAP_HEIGHT, MAP_WIDTH)


def checkKeys():
    #key = lcod.console_check_for_keypress()
    key = lcod.console_wait_for_keypress(True)
    if key.vk == lcod.KEY_ENTER and key.lalt:
        # alt+enter to toggle fullscreen
        lcod.console_set_fullscreen(not lcod.console_is_fullscreen()) # console.is_fullscreen return true if fullscreen, false otherwise
    elif key.vk == lcod.KEY_ESCAPE: