How to use Overlays or CEGUI?

squeakypants

05-04-2007 19:27:07

I'm trying to render a 2d mouse-controlled crosshair on the screen. However, regardless if I use CEGUI or Overlays, I can't get it to work. Here is my code right now (using CEGUI) in my frameListener:
def frameStarted(self, frameEvent):
self.Keyboard.capture()
self.Mouse.capture()

ms = self.Mouse.getMouseState()
CEGUI.System.getSingleton().injectMouseMove(ms.X.rel * 1024, ms.Y.rel * 768)

I got that from here. I already have CEGUI set up. However, in that tutorial, there's nothing about actually rendering anything on the screen.

Also, all the tutorials I've found are using both buffered input and inputDevice, while I'm using unbuffered input and OIS, which complicates things further.

griminventions

06-04-2007 00:48:44

Unfortunately I don't have a solution for you, but I've found it useful in the past to ask questions in the main OGRE forum if it's not directly a Python-Ogre problem. Good luck with it, and if you figure it out, please post here or point to the solution for others. :)

andy

06-04-2007 09:11:21

You can use the 'mousecursor' in CEGui to do this (and load it with the image you want)..

Look in demos/OgreNewt/Demo04_Raycasting as a start...

Cheers
Andy

Tubez

06-04-2007 15:20:39

As long as we're on the subject, is there also a way to keep using the system pointer (e.g. in windowed mode), perhaps with a new image?

WoW does this in windowed mode so I know it's possible, though whether it's supported by OIS/Cegui I have no idea.

willism

09-04-2007 16:00:10

I just had the same problem while moving my app from an ancient version of PyOgre to the latest stable Python-Ogre. I finally got it working, here's my CEGUI setup code:


self.guiRenderer = cegui.OgreCEGUIRenderer(self.renderWindow, \
ogre.RENDER_QUEUE_OVERLAY, False, 0, self.sceneManager)
self.guiSystem = cegui.System(self.guiRenderer)
cegui.Logger.getSingleton().loggingLevel = cegui.Insane

cegui.SchemeManager.getSingleton().loadScheme("TaharezLookSkin.scheme")
self.guiSystem.setDefaultMouseCursor("TaharezLook", "MouseArrow")
self.guiSystem.setDefaultFont( "BlueHighway-12")

cegui.MouseCursor.getSingleton().setImage(self.guiSystem.getDefaultMouseCursor())


The main part that I was missing was the last line. I have code similar to yours for injecting mouse events into CEGUI, so I think you have that part right.