GUI II Ogre 3 D GUI with My
- Slides: 21
GUI II. Ogre 3 D GUI with My. GUI
Project initialization http: //cg. iit. bme. hu/gamedev/KIC/06_GUI/ 06_02_Ogre 3 D_My. Gui_Base. zip Extract Run: Ogre. My. Gui. sln Set include and library paths (if not correct) Set working directory (if not $(Solution. Dir)/bin) Compile Run Play !!
Ghost Game with Overlays
My. GUI • free, open source library • targeted at Ogre 3 D • relatively simple and flexible • visual tools for GUI editing • dismal documentation for coding 2012. 11. 8.
My. GUI compilation • there is no downloadable SDK – but included in guibase. zip for you • if code had to be compiled – requires Ogre 3 D SDK – requires Free. Type library • for Windows, install Free. Type for Windows from gnuwin 32. sourceforge. net – requires CMake build tool 2012. 11. 8.
My. GUI configuration • in CMake specify Ogre and Free. Type directories as dependencies • click “Generate” • open generated My. GUI. sln in Visual Studio – verify that boost version of the Ogre SDK is included (addition include dirs) • compile My. GUIEngine and Ogre. Platform 2012. 11. 8.
My. GUI includes • include directories –. . My. GUI_3. 2. 0My. GUIEngineinclude –. . My. GUI_3. 2. 0PlatformsOgre. Platfo rminclude main. cpp #include "My. GUI. h" #include "My. GUI_Ogre. Platform. h" 2012. 11. 8.
Channeling events to the GUI class Gui. Input. Handler : public OIS: : Mouse. Listener , public OIS: : Key. Listener { public: bool mouse. Moved( const OIS: : Mouse. Event &arg ) { return My. GUI: : Input. Manager: : get. Instance(). inject. Mouse. Move( arg. state. X. abs, arg. state. Y. abs, arg. state. Z. abs); } bool mouse. Pressed( const OIS: : Mouse. Event &arg, OIS: : Mouse. Button. ID id ){ return My. GUI: : Input. Manager: : get. Instance(). inject. Mouse. Press( arg. state. X. abs, arg. state. Y. abs, My. GUI: : Mouse. Button: : Enum(id)); } bool mouse. Released( const OIS: : Mouse. Event &arg, OIS: : Mouse. Button. ID id ) { return My. GUI: : Input. Manager: : get. Instance(). inject. Mouse. Release( arg. state. X. abs, arg. state. Y. abs, My. GUI: : Mouse. Button: : Enum(id)); } bool key. Pressed( const OIS: : Key. Event &arg ) { return My. GUI: : Input. Manager: : get. Instance(). inject. Key. Press( My. GUI: : Key. Code: : Enum(arg. key), arg. text); } bool key. Released( const OIS: : Key. Event &arg ) { return My. GUI: : Input. Manager: : get. Instance(). inject. Key. Release( My. GUI: : Key. Code: : Enum(arg. key)); } }; 2012. 11. 8.
Input. Manager modification (inputs. h) public: OIS: : Keyboard* m. Keyboard; OIS: : Mouse* m. Mouse; m. Keyboard = static_cast<OIS: : Keyboard*>( OISInput. Manager->create. Input. Object( OIS: : OISKeyboard, true )); m. Mouse = static_cast<OIS: : Mouse*>( OISInput. Manager->create. Input. Object( OIS: : OISMouse, true )); 2012. 11. 8.
Listener registration in main. cpp: setup. Listeners Gui. Input. Handler* gui. Input. Hander = new Gui. Input. Handler(); input. Manager->m. Mouse-> set. Event. Callback(gui. Input. Hander); input. Manager->m. Keyboard-> set. Event. Callback(gui. Input. Hander); 2012. 11. 8.
GUI initialization main. cpp: setup. Scene platform = new My. GUI: : Ogre. Platform(); platform->initialise(render. Window, scene. Manager); gui = new My. GUI: : Gui(); gui->initialise(); // GUI element creation may commence here 2012. 11. 8.
Let us create a progress bar! //global My. GUI: : Progress. Ptr progress. Bar; // in setup. Scene() // GUI element creation may commence here progress. Bar = gui->create. Widget<My. GUI: : Progress. Bar> ("Progress. Bar", 100, 10, 500, 30, My. GUI: : Align: : Center, "Main"); // skin^ position^ progress. Bar->set. Enabled(true); progress. Bar->set. Progress. Range(stop. Times[num. Stops-1]); progress. Bar->set. Progress. Position(0); 2012. 11. 8.
Indicate progress in every frame! progress. Bar->set. Progress. Position(anim. Time); 2012. 11. 8.
Result 2012. 11. 8.
Add checkbox to toggle music on/off! My. GUI: : Button. Ptr button = gui->create. Widget<My. GUI: : Button> ("Check. Box", 10, 40, 300, 26, My. GUI: : Align: : Default, "Main"); button->set. Caption("Music"); 2012. 11. 8.
Result 2012. 11. 8.
Game. Audio. h: new method void set. Music. Volume(float music. Volume) { this->music. Volume = music. Volume; AL_SAFE_CALL( al. Sourcef (ambient. Source, AL_GAIN, music. Volume), "unable to set ambient volume"); } 2012. 11. 8.
Global function void gui. Toggle. Music(My. GUI: : Widget* _sender) { My. GUI: : Button. Ptr checkbox = _sender->cast. Type<My. GUI: : Button>(); if(checkbox->get. State. Selected()) { checkbox->set. State. Selected(false); game. Audio->set. Music. Volume(0); } else { checkbox->set. State. Selected(true); game. Audio->set. Music. Volume(10); } } 2012. 11. 8.
Add event listener button->event. Mouse. Button. Click += My. GUI: : new. Delegate( gui. Toggle. Music); 2012. 11. 8.
Result 2012. 11. 8.
The End 2012. 11. 8.
- Ogre manualobject
- Metaphor figure of speech
- Ogres sociālais dienests
- Shrek 2
- Sky fog ogre
- Ogre citra
- Ogre game engine tutorial
- Ge gi gue gui güe güi
- Ostegra
- Processing gui tutorial
- Immediate mode ui
- R gui
- Jui gui
- Valiant gui
- Gui xt
- Aplikasi desktop linux yang banyak digunakan pada mode gui
- Java swing responsive gui
- Guisite
- Gui
- Instalasi sistem operasi berbasis gui dapat dilakukan dari
- Interface python 3
- Java gui tutorial