Mouse cursor example

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
madmark
Goblin
Posts: 292
Joined: Fri Jul 22, 2005 8:14 pm
Location: Midwest USA
Contact:

Mouse cursor example

Post by madmark » Wed Mar 08, 2006 9:07 pm

I wrote a short example program to show how to implement a mouse cursor without resorting to CEGUI and placed it in the Wiki.

Please reply here with feedback or use the forum private message function to madmark.
0 x

Scorch
Gremlin
Posts: 192
Joined: Fri Jan 27, 2006 6:28 am
Location: Las Vegas, NV

Post by Scorch » Wed Mar 08, 2006 11:51 pm

Cool! I don't have time to play with it yet, but I like it!
0 x

lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Post by lygyue » Mon Dec 11, 2006 4:47 pm

In your article, I had copied all the codes, and then create a new project. but the code below i don't understand:

Code: Select all

   m_pGuiOverlay = OverlayManager::getSingletonPtr()->create("GuiOverlay"); 
   m_pGuiOverlay->setZOrder(600); 
   m_pMousePanel = (PanelOverlayElement *)OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "GUIMouse"); 
   m_pMouseMat = MaterialManager::getSingleton().create("MouseCursor/default", "General"); 
                   m_pMouseContainer = (Ogre::OverlayContainer*) OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "GUIContainer"); 
   m_pGuiOverlay->add2D(m_pMouseContainer); 

   m_pMouseContainer->addChild(m_pMousePanel); 
   m_pGuiOverlay->show(); 
what is "MouseCursor/default" here? And where is it? i can't find it any where. In my app, An exception has occured while running "m_pMouseContainer->addChild(m_pMousePanel);" I think the problem is where the material been loaded. The app can't find the material script. But i don't know how to create a script fit for my app. what can i do now?
Thanks a lot!
0 x

User avatar
irrdev
Orc
Posts: 420
Joined: Sun Oct 15, 2006 7:30 pm
Contact:

Post by irrdev » Tue Dec 12, 2006 6:03 am

lygyue wrote:In your article, I had copied all the codes, and then create a new project. but the code below i don't understand:

Code: Select all

   m_pGuiOverlay = OverlayManager::getSingletonPtr()->create("GuiOverlay"); 
   m_pGuiOverlay->setZOrder(600); 
   m_pMousePanel = (PanelOverlayElement *)OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "GUIMouse"); 
   m_pMouseMat = MaterialManager::getSingleton().create("MouseCursor/default", "General"); 
                   m_pMouseContainer = (Ogre::OverlayContainer*) OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "GUIContainer"); 
   m_pGuiOverlay->add2D(m_pMouseContainer); 

   m_pMouseContainer->addChild(m_pMousePanel); 
   m_pGuiOverlay->show(); 
what is "MouseCursor/default" here? And where is it? i can't find it any where. In my app, An exception has occured while running "m_pMouseContainer->addChild(m_pMousePanel);" I think the problem is where the material been loaded. The app can't find the material script. But i don't know how to create a script fit for my app. what can i do now?
Thanks a lot!
MouseCursor/default refers to an Overlay. You can easily make that yourself. You will also have to make a material which is called from the Overlay script for loading the image(ie. Mouse Cursor). Make sure you include all the folder paths containing the scripts in your resources.cfg. :wink:
0 x
FeedLaunch .NET RSS and ATOM feed editor- open-source and released under the GPL. Visit Feed Launch .NET Project Website hosted at sourceforge.net

pchow
Gnoblar
Posts: 4
Joined: Wed Aug 08, 2007 8:31 am

Post by pchow » Wed Aug 08, 2007 9:21 am

I tried copying and pasting it but it gave me 28 errors

1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(15) : error C2504: 'MouseMotionListener' : base class undefined
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(16) : error C2504: 'MouseListener' : base class undefined
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(18) : error C2061: syntax error : identifier 'EventProcessor'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(38) : error C2061: syntax error : identifier 'MouseEvent'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(45) : error C2061: syntax error : identifier 'MouseEvent'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(50) : error C2061: syntax error : identifier 'MouseEvent'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(56) : error C2061: syntax error : identifier 'MouseEvent'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(65) : error C2061: syntax error : identifier 'MouseEvent'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(66) : error C2061: syntax error : identifier 'MouseEvent'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(67) : error C2061: syntax error : identifier 'MouseEvent'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(40) : error C2065: 'e' : undeclared identifier
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(40) : error C2227: left of '->getRelX' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(41) : error C2227: left of '->getRelY' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(42) : error C2227: left of '->consume' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(53) : error C2227: left of '->consume' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(62) : error C2227: left of '->consume' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(88) : error C2143: syntax error : missing ';' before '*'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(88) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(88) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(96) : error C2065: 'mEventProcessor' : undeclared identifier
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(96) : error C2061: syntax error : identifier 'EventProcessor'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(97) : error C2227: left of '->initialise' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\ogremouse.h(98) : error C2227: left of '->startProcessingEvents' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\main3.cpp(10) : error C2065: 'EventProcessor' : undeclared identifier
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\main3.cpp(10) : error C2065: 'pEventProcessor' : undeclared identifier
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\main3.cpp(10) : error C2065: 'pRoot' : undeclared identifier
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\main3.cpp(10) : error C2275: 'Ogre::Root' : illegal use of this type as an expression
1> c:\documents and settings\phill chow\my documents\ogrenew\ogremain\include\ogreroot.h(59) : see declaration of 'Ogre::Root'
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\main3.cpp(11) : error C2448: 'OgreMouseListener::{ctor}' : function-style initializer appears to be a function definition
1>c:\documents and settings\phill chow\my documents\term 4\vgd202w_graphicsprogramming\ogretest\ogretest\src\main3.cpp(52) : warning C4482: nonstandard extension used: enum 'Ogre::TextureUnitState::TextureAddressingMode' used in qualified name
1>13213
1>c1xx : fatal error C1083: Cannot open source file: '13213': No such file or directory
1>Generating Code...
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(OGRE_HOME)
1>Build log was saved at "file://c:\Documents and Settings\Phill Chow\My Documents\TERM 4\VGD202w_GraphicsProgramming\OgreTest\OgreTest\src\Debug\BuildLog.htm"
1>Manual - 29 error(s), 1 warning(s)
0 x

User avatar
madmark
Goblin
Posts: 292
Joined: Fri Jul 22, 2005 8:14 pm
Location: Midwest USA
Contact:

Post by madmark » Thu Aug 09, 2007 3:21 pm

This is pretty old and written for v1.2 (I think).

My bad for not getting it up to date...

Will do very soon.
0 x

abdurrahmanavci
Kobold
Posts: 25
Joined: Sun Sep 02, 2007 4:12 pm
Location: Turkey

Post by abdurrahmanavci » Sun Sep 02, 2007 5:20 pm

I've rewritten the mouse cursor code for 1.4.4 (Eihort).
Thanks for the initial work.
Last edited by abdurrahmanavci on Sun Sep 02, 2007 8:10 pm, edited 1 time in total.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Post by jacmoe » Sun Sep 02, 2007 7:43 pm

I would rather that you updated the article instead of spawning a new page.
I'd do it myself, but since you wrote the update, it would probably be best if you did it.
We don't want the wiki to have articles in multiple versions all over the place.
Ideally, all articles should match the current stable Ogre, in this case: Eihort. :wink:

I'll wait a day or two, and then I am going to delete the new page (after salvaging, of course).
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

lubnan
Gnoblar
Posts: 1
Joined: Wed Aug 26, 2009 10:17 pm

MouseCursor::setImage not working right

Post by lubnan » Mon Sep 14, 2009 4:26 am

Great code,
works like a charm setting up the cursor first time. But I cannot change the image. Calls to setImage do nothing. The image I am using works if I use it in the first call to setImage, but does not work on subsequent calls.
0 x

Post Reply