예제 #1
0
def handle_input(key, mouse):
    if key.vk == libtcod.KEY_ENTER and key.lalt:
        print 'fullscreen'
        libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen())
    elif key.vk == libtcod.KEY_PRINTSCREEN or key.c == 'p':
        print "screenshot"
        if key.lalt :
            libtcod.console_save_apf(None,"samples.apf")
            print "apf"
        else :
            libtcod.sys_save_screenshot()
            print "png"
    elif key.vk == libtcod.KEY_ESCAPE:
        return True
예제 #2
0
def test_console_apf_read_write(console, offscreen, tmpdir):
    libtcodpy.console_print(console, 0, 0, 'test')

    apf_file = tmpdir.join('test.apf').strpath
    assert libtcodpy.console_save_apf(console, apf_file)
    assert libtcodpy.console_load_apf(offscreen, apf_file)
    assertConsolesEqual(console, offscreen)
예제 #3
0
파일: logica.py 프로젝트: jmptable/logica
	if mouse.lbutton_pressed:
		x = mouse.x/FONT_WIDTH
		y = mouse.y/FONT_HEIGHT
	
	if mouse.rbutton_pressed:
		x = mouse.x/FONT_WIDTH
		y = mouse.y/FONT_HEIGHT
	
	# key handler
	player.control(key.vk)

	if key.vk == libtcod.KEY_ENTER and key.lalt:
		libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen())
	elif key.vk == libtcod.KEY_PRINTSCREEN or key.c == 'p':
		print ("screenshot")
		if key.lalt :
			libtcod.console_save_apf(None,"samples.apf")
			print ("apf")
		else :
			libtcod.sys_save_screenshot()
			print ("png")
	elif key.vk == libtcod.KEY_ESCAPE:
		break
	elif key.vk == libtcod.KEY_F1:
		libtcod.sys_set_renderer(libtcod.RENDERER_GLSL)
	elif key.vk == libtcod.KEY_F2:
		libtcod.sys_set_renderer(libtcod.RENDERER_OPENGL)
	elif key.vk == libtcod.KEY_F3:
		libtcod.sys_set_renderer(libtcod.RENDERER_SDL)
	libtcod.console_flush()