mkandula
22-02-2009 16:00:03
I am building an applcation using Hikari , python-ogre. I have simply replicated the code as the example. But I am not seeing the mouse cursor.
I am attaching the code as a file. Please help me to get the cursor shown.
mkandula
23-02-2009 08:57:34
Is it possible to show mouse without doing anything with CEGUI ??
Is there a timeline for hikari running on opengl and linux ?
dermont
23-02-2009 09:54:21
What platform are you running under? From a quick look at your code on Windows it appears that you are calling the _inputSystemParameters and you need to move it to your GameFrameListener, e.g:
def _inputSystemParameters (self ):
""" the demo needs the system mouse
"""
if os.name == 'nt':
print "NT"
return [("w32_mouse","DISCL_FOREGROUND"), ("w32_mouse", "DISCL_NONEXCLUSIVE")]
else:
return [("x11_mouse_grab","false"), ("x11_mouse_hide", "false")] ## untested
def _setupInput(self):
# ignore buffered input
windowHnd = self.renderWindow.getCustomAttributeInt("WINDOW")
t= self._inputSystemParameters()
params = [("WINDOW",str(windowHnd))]
params.extend(t)
self.InputManager = OIS.createPythonInputSystem(params)
...
If not you should submit a simple example that illustrates your problem.
Is it possible to show mouse without doing anything with CEGUI ??
Yes simply add the above _inputSystemParameters method to any class that inherits from the sf.FrameListener.
mkandula
24-02-2009 04:51:42
what i posted itself is the complete code. I am not inheriting from sf.Application.
dermont
24-02-2009 05:21:26
what i posted itself is the complete code.
Doesn't appear so, no GameManager class for example.
I am not inheriting from sf.Application.
Then the anwser to your question should be in the above "_inputSystemParameters" code.
Look at how sample framework (sf_OIS.py) _setupInput calls _inputSystemParameters and applies the extra parameters, then define the _inputSystemParameters method as the Hikari demo does.
mkandula
24-02-2009 07:49:00
class GameManager:
def update(self):
# print "updating"
pass
pass
Thats the GameManager class for now.
>Look at how sample framework (sf_OIS.py) _setupInput calls _inputSystemParameters and applies the extra parameters, then define the _inputSystemParameters method as the Hikari demo does.
If you see the code, its the EXACT same code I am using from both sf_OIS.py and demo_kikari_01.py for both _setupInput and _inputSystemParameters functions.
FYI : The mouse cursor is not visible..but I can drag windows and toggle stuff
dermont
24-02-2009 08:30:12
If you see the code, its the EXACT same code I am using from both sf_OIS.py and demo_kikari_01.py for both _setupInput and _inputSystemParameters functions.
I've looked at the code and it isn't the same as sf_OIS.py and demo_kikari_01.py, you need to look those again. Your not extending/setting the OIS parameters to show the mouse. Did you even try the code, that works on Windows, I posted above?
Here again is your code refactored:
def _setupInput(self):
# ignore buffered input
windowHnd = self.renderWindow.getCustomAttributeInt("WINDOW")
if os.name == 'nt':
t = [("w32_mouse","DISCL_FOREGROUND"), ("w32_mouse", "DISCL_NONEXCLUSIVE")]
else:
t = [("x11_mouse_grab","false"), ("x11_mouse_hide", "false")] ## untested
params = [("WINDOW",str(windowHnd))]
params.extend(t)
self.InputManager = OIS.createPythonInputSystem(params)
#Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)
self.Keyboard = self.InputManager.createInputObjectKeyboard( OIS.OISKeyboard, self.bufferedKeys )
self.Mouse = self.InputManager.createInputObjectMouse( OIS.OISMouse, self.bufferedMouse )
try :
self.Joy = self.InputManager.createInputObjectJoyStick( OIS.OISJoyStick, bufferedJoy )
except:
self.Joy = False
#Set initial mouse clipping size
self.windowResized(self.renderWindow)
#Register as a Window listener
ogre.WindowEventUtilities.addWindowEventListener(self.renderWindow, self)
mkandula
24-02-2009 08:40:01
Hey,
Extremely sorry..i did not read through your code u posted.
I have applied it and now I can see the cursor.
If what I see is right, sf_OIS.py code what I have with my python-ogre SDK is different.
2 more questions
1)how to restrict the cursor inside window
2) how to change its skin or set mouse cursor animations
I am learning python at the same time, so please excuse me.