Ejemplo n.º 1
0
    pass

  def unhandled_handler_func(event):
    print("Unknown:", event)
    pass

  def key_handler_func(sourceType, sourceIndex, key, value):
    #print(nameOf[key],"[",sourceIndex,"] =",value)
    print("key="+str(key),code_to_key(key),"[",sourceIndex,"] =",value)
    pass

  def syn_handler_func(sourceType, sourceIndex, code, value):
    #print("SYN",code,value)
    pass

  inputs = InputEvents( key_handler_func, mouse_handler_func, joystick_handler_func, syn_handler_func, unhandled_handler_func)
  #inputs = InputEvents(key_handler_func)

  while not inputs.key_state("KEY_ESC"):
    inputs.do_input_events()
    if inputs.key_state("KEY_LEFTCTRL"):
      inputs.grab_by_type("keyboard", grab=False)
      print("Name:",)
      s = raw_input()
      print("Hello",s)
      inputs.grab_by_type("keyboard", True)
    if inputs.key_state("BTN_LEFT"):
      v = inputs.get_mouse_movement()
      if v != (0,0,0,0,0):
          print(v)
    if inputs.key_state("BTN_RIGHT"):
Ejemplo n.º 2
0
    def unhandled_handler_func(event):
        print("Unknown:", event)
        pass

    def key_handler_func(sourceType, sourceIndex, key, value):
        #print(nameOf[key],"[",sourceIndex,"] =",value)
        print("key=" + str(key), code_to_key(key), "[", sourceIndex, "] =",
              value)
        pass

    def syn_handler_func(sourceType, sourceIndex, code, value):
        #print("SYN",code,value)
        pass

    inputs = InputEvents(key_handler_func, mouse_handler_func,
                         joystick_handler_func, syn_handler_func,
                         unhandled_handler_func)
    #inputs = InputEvents(key_handler_func)

    while not inputs.key_state("KEY_ESC"):
        inputs.do_input_events()
        if inputs.key_state("KEY_LEFTCTRL"):
            inputs.grab_by_type("keyboard", grab=False)
            print("Name:", )
            s = raw_input()
            print("Hello", s)
            inputs.grab_by_type("keyboard", True)
        if inputs.key_state("BTN_LEFT"):
            v = inputs.get_mouse_movement()
            if v != (0, 0, 0, 0, 0):
                print(v)
Ejemplo n.º 3
0
inFlag = True

#screenshot number
scshots = 1

#avatar camera
rot=0.0
tilt=0.0
avhgt = 5.0
aveyelevel = 4.0

aveyeleveladjust = aveyelevel - avhgt/2

man = SolidObject("man", Size(1, avhgt, 1), Position(0, (mymap.calcHeight(5, 5) + avhgt/2), 0), 1)

inputs = InputEvents()

inputs.get_mouse_movement()
mouseOn = True

frame = 400
record = False
CAMERA = Camera.instance()
while DISPLAY.loop_running() and not inputs.key_state("KEY_ESC"):
  CAMERA.reset()
  CAMERA.rotate(tilt, rot, 0)
  CAMERA.position((man.x(), man.y(), man.z() - aveyeleveladjust))

  myecube.position(man.x(), man.y(), man.z() - aveyeleveladjust)

  SolidObject.drawall()