Example #1
0
    def setupInput(self):
        # Create the inputManager using the supplied renderWindow
        windowHnd = self.renderWindow.getCustomAttributeInt("WINDOW")
        paramList = [("WINDOW", str(windowHnd)), \
                     ("w32_mouse", "DISCL_FOREGROUND"), \
                     ("w32_mouse", "DISCL_NONEXCLUSIVE"), \
                     ("w32_keyboard", "DISCL_FOREGROUND"), \
                     ("w32_keyboard", "DISCL_NONEXCLUSIVE"),]
        # @todo: add mac/linux parameters
        self.inputManager = OIS.createPythonInputSystem(paramList)

        # Attempt to get the mouse/keyboard input device objects.
        try:
            self.mouse = self.inputManager.createInputObjectMouse(
                OIS.OISMouse, True)
            self.keyboard = self.inputManager.createInputObjectKeyboard(
                OIS.OISKeyboard, True)
        except Exception:  # Unable to obtain mouse/keyboard input
            raise

        # Use an InputHandler object to handle the callback functions.
        self.inputHandler = InputHandler(mouse=self.mouse,
                                         keyboard=self.keyboard,
                                         scene=self,
                                         player=self.player)
        self.mouse.setEventCallback(self.inputHandler)
        self.keyboard.setEventCallback(self.inputHandler)
Example #2
0
    def __init__(self, sceneManager):
        # Initialize the various listener classes we are a subclass from
        ogre.FrameListener.__init__(self)
        ogre.WindowEventListener.__init__(self)

        
        self.renderWindow = ogre.Root.getSingleton().getAutoCreatedWindow()
        self.sceneManager = sceneManager
        self.camera = self.sceneManager.getCamera("PrimaryCamera")
        self.cameraNode = self.sceneManager.getSceneNode("PrimaryCamera")
        
        self.viewport = self.camera.getViewport()
        
        # Create an empty list of nodes
        self.nodes = []
        
        # Create an empty list of GUI elements.
        self.gui_elements = [] 
        
        # Set up the overlay for the GUI.
        self.setupOverlay()
        
        # Set up the scene.
        self.setupScene()
        
        # Set up the GUI.
        self.setupGUI()
        
        # Create the inputManager using the supplied renderWindow
        windowHnd = self.renderWindow.getCustomAttributeInt("WINDOW")
        paramList = [("WINDOW", str(windowHnd)), \
                     ("w32_mouse", "DISCL_FOREGROUND"), \
                     ("w32_mouse", "DISCL_NONEXCLUSIVE"), \
                     ("w32_keyboard", "DISCL_FOREGROUND"), \
                     ("w32_keyboard", "DISCL_NONEXCLUSIVE"),]
                     # @todo: add mac/linux parameters
        self.inputManager = OIS.createPythonInputSystem(paramList)

        # Attempt to get the mouse/keyboard input device objects.
        try:
            self.mouse = self.inputManager.createInputObjectMouse(OIS.OISMouse, True)
            self.keyboard = self.inputManager.createInputObjectKeyboard(OIS.OISKeyboard, True)
        except Exception: # Unable to obtain mouse/keyboard input
            raise

        # Use an InputHandler object to handle the callback functions.
        self.inputHandler = InputHandler(mouse=self.mouse, keyboard=self.keyboard,
                                         scene=self, player=self.player)
        self.mouse.setEventCallback(self.inputHandler)
        self.keyboard.setEventCallback(self.inputHandler)

        # Set up initial window size.
        self.windowResized(self.renderWindow)

        # Set this to True when we get an event to exit the application
        self.quit = False

        # Listen for any events directed to the window manager's close button
        ogre.WindowEventUtilities.addWindowEventListener(self.renderWindow, self)
Example #3
0
 def __init__(self, spawn_x=100, spawn_y=100, entity=[]):
     Person.__init__(self, spawn_x, spawn_y, '0.png', 'player\\default')
     self.inputhandler = InputHandler()
     self.admin = self.physics = self.parkour = False
     self.add_basic_movement()
     self.add_physics()
     self.add_parkour()
     self.add_stats(entity)
Example #4
0
    def __init__(self, spawn_x=100, spawn_y=100, entity=[]):
        Person.__init__(self, spawn_x, spawn_y, '0.png', 'player\\default')
        self.inputhandler = InputHandler()
        self.admin = self.physics = self.parkour = False
        self.add_basic_movement()
        self.add_physics()
        self.add_parkour()
        self.add_stats(entity)
        self.state = 'idle'
        self.stage = 0
        self.next_stage = False
        self.brightness = 50

        #temporary
        self.stamina_regen = True

        self.direc = 1  #right
Example #5
0
def signal_handler(signum, frame):
    exit(0)


clear()
title = 'Arsatum v0.0.1'
os.system(f'title {title}')

world = World(WIDTH, HEIGHT)
world.init()

# clear()
# print(f'''Welcome to {title}''')
# print('''-------------------''')
# text = '''
# movement          windows                 actions
# 789 \\|/      i - inventory          p - pick up item
# 4.6 -.-      e - charecter window   space - descend/ascend stairs
# 123 /|\\      l - message log        num 5 - pass turn
#              j - journal
#              n - achievements
# '''.strip()
# print(text)

# input('Press [enter] to start.')

InputHandler(world).start()
world.update(False)
signal.signal(signal.SIGINT, signal_handler)
time.sleep(99999)
Example #6
0
from kivy.app import App
from lanedisplay import LaneDisplay
from lanesliders import LaneSliders
from lanecanvas import LaneCanvas
from gearshift import GearShift
from speedyawadjust import SpeedYawAdjust
from lanecenteringstatus import LaneCenteringStatus
from sliderinput import SliderInput
from inputhandler import InputHandler

input_handler = InputHandler()


class MockUIApp(App):
    def __init__(self, **kwargs):
        super(MockUIApp, self).__init__(**kwargs)
Example #7
0
 def reset_basic_movement(self):
     self.inputhandler = InputHandler()
     self.add_basic_movement()