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.
Mouse cursor example
- madmark
- Goblin
- Posts: 292
- Joined: Fri Jul 22, 2005 8:14 pm
- Location: Midwest USA
- Contact:
-
- Greenskin
- Posts: 122
- Joined: Wed Nov 29, 2006 4:07 pm
In your article, I had copied all the codes, and then create a new project. but the code below i don't understand:
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!
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();
Thanks a lot!
- irrdev
- Orc
- Posts: 420
- Joined: Sun Oct 15, 2006 7:30 pm
- Contact:
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.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: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?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();
Thanks a lot!
FeedLaunch .NET RSS and ATOM feed editor- open-source and released under the GPL. Visit Feed Launch .NET Project Website hosted at sourceforge.net
-
- Gnoblar
- Posts: 4
- Joined: Wed Aug 08, 2007 8:31 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)
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)
- madmark
- Goblin
- Posts: 292
- Joined: Fri Jul 22, 2005 8:14 pm
- Location: Midwest USA
- Contact:
-
- Kobold
- Posts: 25
- Joined: Sun Sep 02, 2007 4:12 pm
- Location: Turkey
I've rewritten the mouse cursor code for 1.4.4 (Eihort).
Thanks for the initial work.
Thanks for the initial work.
Last edited by abdurrahmanavci on Sun Sep 02, 2007 8:10 pm, edited 1 time in total.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
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.
I'll wait a day or two, and then I am going to delete the new page (after salvaging, of course).
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.
I'll wait a day or two, and then I am going to delete the new page (after salvaging, of course).
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Gnoblar
- Posts: 1
- Joined: Wed Aug 26, 2009 10:17 pm
MouseCursor::setImage not working right
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.
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.