# Path: pygaze/display.py
# class Display(BaseDisplay):
# 
#     # see BaseDisplay
# 
#     def __init__(self, disptype=settings.DISPTYPE, **args):
# 
#         # see BaseDisplay
# 
#         if disptype == "pygame":
#             from pygaze._display.pygamedisplay import PyGameDisplay as Display
#         elif disptype == "psychopy":
#             from pygaze._display.psychopydisplay import PsychoPyDisplay  as Display
#         elif disptype == "opensesame":
#             from pygaze._display.osdisplay import OSDisplay as Display
#         else:
#             raise Exception("Unexpected disptype : %s" % disptype)
#         self.__class__ = Display
#         self.__class__.__init__(self, **args)
#         copy_docstr(BaseDisplay, Display)
# 
# Path: pygaze/screen.py
# class Screen(BaseScreen):
# 
#     """
#     A class for Screen objects, for visual stimuli (to be displayed via a
#     Display object)
#     """
# 
#     def __init__(self, disptype=settings.DISPTYPE, **args):
# 
#         """
#         Initializes the Screen object.
#         
#         Keyword arguments:
#         disptype    --    Type of display: either "pygame" or "psychopy"
#                     (default = DISPTYPE)
#         dispsize    -- size of the display in pixels: a (width, height)
#                    tuple (default = DISPSIZE)
#         fgc        -- the foreground colour: a colour name (e.g. "red") or 
#                    a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))
#                    (default = FGC)
#         bgc        -- the background colour: a colour name (e.g. "red") or 
#                    a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))
#                    (default = BGC)
#         screennr    -- the screen number: 0, 1 etc. (default =
#                    SCREENNR)
#         mousevisible    -- Boolean indicating mouse visibility (default = 
#                        MOUSEVISIBLE)
#         screen    -- a Screen object to be presented on the new Display
#                    (default=None)
#         """
# 
#         if disptype == "pygame":
#             from pygaze._screen.pygamescreen import PyGameScreen as Screen
#         elif disptype == "psychopy":
#             from pygaze._screen.psychopyscreen import PsychoPyScreen as Screen
#         elif disptype == "opensesame":
#             from pygaze._screen.osscreen import OSScreen as Screen
#         else:
#             raise Exception("Unexpected disptype: {}".format(disptype))
#         self.__class__ = Screen
#         self.__class__.__init__(self, **args)
#         copy_docstr(BaseScreen, Screen)
# 
# Path: pygaze/joystick.py
# class Joystick(BaseJoystick):
# 
#     # see BaseJoystick
# 
#     def __init__(self, disptype=settings.DISPTYPE, **args):
# 
#         # see BaseJoystick
# 
#         if disptype in ("pygame", "psychopy"):
#             from pygaze._joystick.pygamejoystick import PyGameJoystick
#             self.__class__ = PyGameJoystick
#         else:
#             raise Exception("Unexpected disptype: {}".format(disptype))
#         self.__class__.__init__(self, **args)
#         copy_docstr(BaseJoystick, Joystick)


import ctypes
import pygaze.libtime as timer
from constants import *
from pygaze.display import Display
from pygaze.screen import Screen
from pygaze.joystick import Joystick

			("wRightMotorSpeed", ctypes.c_ushort)]
	# load Xinput.dll
	try:
		print("trying to import xinput1_1.dll")
		xinput = ctypes.windll.xinput1_1
	except:
		try:
			print("trying to import xinput1_3.dll")
			xinput = ctypes.windll.xinput1_3
		except:
			try:
				print("trying to import XInput9_1_0.dll")
				xinput = ctypes.windll.XInput9_1_0
			except:
				print("ERROR: No xinput DLL found, cannot use rumble function.")
				RUMBLE = False
	# set up function argument types and return type
	XInputSetState = xinput.XInputSetState
	XInputSetState.argtypes = [ctypes.c_uint, ctypes.POINTER(XINPUT_VIBRATION)]
	XInputSetState.restype = ctypes.c_uint
	# define helper function
	def set_vibration(controller, left_motor, right_motor):
	    vibration = XINPUT_VIBRATION(int(left_motor * 65535), int(right_motor * 65535))
	    XInputSetState(controller, ctypes.byref(vibration))


# # # # #
# PYGAZE INSTANCES

# visual

# Path: pygaze/display.py
# class Display(BaseDisplay):
# 
#     # see BaseDisplay
# 
#     def __init__(self, disptype=settings.DISPTYPE, **args):
# 
#         # see BaseDisplay
# 
#         if disptype == "pygame":
#             from pygaze._display.pygamedisplay import PyGameDisplay as Display
#         elif disptype == "psychopy":
#             from pygaze._display.psychopydisplay import PsychoPyDisplay  as Display
#         elif disptype == "opensesame":
#             from pygaze._display.osdisplay import OSDisplay as Display
#         else:
#             raise Exception("Unexpected disptype : %s" % disptype)
#         self.__class__ = Display
#         self.__class__.__init__(self, **args)
#         copy_docstr(BaseDisplay, Display)
# 
# Path: pygaze/screen.py
# class Screen(BaseScreen):
# 
#     """
#     A class for Screen objects, for visual stimuli (to be displayed via a
#     Display object)
#     """
# 
#     def __init__(self, disptype=settings.DISPTYPE, **args):
# 
#         """
#         Initializes the Screen object.
#         
#         Keyword arguments:
#         disptype    --    Type of display: either "pygame" or "psychopy"
#                     (default = DISPTYPE)
#         dispsize    -- size of the display in pixels: a (width, height)
#                    tuple (default = DISPSIZE)
#         fgc        -- the foreground colour: a colour name (e.g. "red") or 
#                    a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))
#                    (default = FGC)
#         bgc        -- the background colour: a colour name (e.g. "red") or 
#                    a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))
#                    (default = BGC)
#         screennr    -- the screen number: 0, 1 etc. (default =
#                    SCREENNR)
#         mousevisible    -- Boolean indicating mouse visibility (default = 
#                        MOUSEVISIBLE)
#         screen    -- a Screen object to be presented on the new Display
#                    (default=None)
#         """
# 
#         if disptype == "pygame":
#             from pygaze._screen.pygamescreen import PyGameScreen as Screen
#         elif disptype == "psychopy":
#             from pygaze._screen.psychopyscreen import PsychoPyScreen as Screen
#         elif disptype == "opensesame":
#             from pygaze._screen.osscreen import OSScreen as Screen
#         else:
#             raise Exception("Unexpected disptype: {}".format(disptype))
#         self.__class__ = Screen
#         self.__class__.__init__(self, **args)
#         copy_docstr(BaseScreen, Screen)
# 
# Path: pygaze/joystick.py
# class Joystick(BaseJoystick):
# 
#     # see BaseJoystick
# 
#     def __init__(self, disptype=settings.DISPTYPE, **args):
# 
#         # see BaseJoystick
# 
#         if disptype in ("pygame", "psychopy"):
#             from pygaze._joystick.pygamejoystick import PyGameJoystick
#             self.__class__ = PyGameJoystick
#         else:
#             raise Exception("Unexpected disptype: {}".format(disptype))
#         self.__class__.__init__(self, **args)
#         copy_docstr(BaseJoystick, Joystick)


# Path: examples/joystick_test/experiment.py
import ctypes
import pygaze.libtime as timer
from constants import *
from pygaze.display import Display
from pygaze.screen import Screen
from pygaze.joystick import Joystick

			("wRightMotorSpeed", ctypes.c_ushort)]
	# load Xinput.dll
	try:
		print("trying to import xinput1_1.dll")
		xinput = ctypes.windll.xinput1_1
	except:
		try:
			print("trying to import xinput1_3.dll")
			xinput = ctypes.windll.xinput1_3
		except:
			try:
				print("trying to import XInput9_1_0.dll")
				xinput = ctypes.windll.XInput9_1_0
			except:
				print("ERROR: No xinput DLL found, cannot use rumble function.")
				RUMBLE = False
	# set up function argument types and return type
	XInputSetState = xinput.XInputSetState
	XInputSetState.argtypes = [ctypes.c_uint, ctypes.POINTER(XINPUT_VIBRATION)]
	XInputSetState.restype = ctypes.c_uint
	# define helper function
	def set_vibration(controller, left_motor, right_motor):
	    vibration = XINPUT_VIBRATION(int(left_motor * 65535), int(right_motor * 65535))
	    XInputSetState(controller, ctypes.byref(vibration))


# # # # #
# PYGAZE INSTANCES

# visual

disp = Display()
