GG
|
#include <OgreGUI.h>
Public Member Functions | |
OgreGUI (Ogre::RenderWindow *window, const std::string &config_filename="") | |
virtual | ~OgreGUI () |
virtual boost::shared_ptr < ModalEventPump > | CreateModalEventPump (bool &done) |
virtual unsigned int | Ticks () const |
virtual X | AppWidth () const |
virtual Y | AppHeight () const |
const Ogre::SharedPtr < Ogre::DataStream > & | ConfigFileStream () const |
virtual void | Exit (int code) |
![]() | |
virtual | ~GUI () |
const std::string & | AppName () const |
Wnd * | FocusWnd () const |
Wnd * | GetWindowUnder (const Pt &pt) const |
unsigned int | DeltaT () const |
bool | RenderingDragDropWnds () const |
bool | FPSEnabled () const |
double | FPS () const |
std::string | FPSString () const |
double | MaxFPS () const |
unsigned int | ButtonDownRepeatDelay () const |
unsigned int | ButtonDownRepeatInterval () const |
unsigned int | DoubleClickInterval () const |
unsigned int | MinDragTime () const |
unsigned int | MinDragDistance () const |
bool | DragDropWnd (const Wnd *wnd) const |
bool | AcceptedDragDropWnd (const Wnd *wnd) const |
bool | MouseButtonDown (unsigned int bn) const |
Pt | MousePosition () const |
Pt | MouseMovement () const |
Flags< ModKey > | ModKeys () const |
virtual std::set< std::pair < CPSize, CPSize > > | FindWords (const std::string &str) const |
const boost::shared_ptr < StyleFactory > & | GetStyleFactory () const |
bool | RenderCursor () const |
const boost::shared_ptr< Cursor > & | GetCursor () const |
const_accel_iterator | accel_begin () const |
const_accel_iterator | accel_end () const |
AcceleratorSignalType & | AcceleratorSignal (Key key, Flags< ModKey > mod_keys=MOD_KEY_NONE) const |
void | SaveWndAsPNG (const Wnd *wnd, const std::string &filename) const |
void | operator() () |
void | HandleGGEvent (EventType event, Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys, const Pt &pos, const Pt &rel) |
void | SetFocusWnd (Wnd *wnd) |
virtual void | Wait (unsigned int ms) |
void | Register (Wnd *wnd) |
void | RegisterModal (Wnd *wnd) |
void | Remove (Wnd *wnd) |
void | WndDying (Wnd *wnd) |
void | MoveUp (Wnd *wnd) |
void | MoveDown (Wnd *wnd) |
void | RegisterDragDropWnd (Wnd *wnd, const Pt &offset, Wnd *originating_wnd) |
void | CancelDragDrop () |
void | RegisterTimer (Timer &timer) |
void | RemoveTimer (Timer &timer) |
void | EnableFPS (bool b=true) |
void | SetMaxFPS (double max) |
void | EnableMouseButtonDownRepeat (unsigned int delay, unsigned int interval) |
void | SetDoubleClickInterval (unsigned int interval) |
void | SetMinDragTime (unsigned int time) |
void | SetMinDragDistance (unsigned int distance) |
accel_iterator | accel_begin () |
accel_iterator | accel_end () |
void | SetAccelerator (Key key, Flags< ModKey > mod_keys=MOD_KEY_NONE) |
void | RemoveAccelerator (Key key, Flags< ModKey > mod_keys=MOD_KEY_NONE) |
void | RemoveAccelerator (accel_iterator it) |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts) |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts, const std::vector< unsigned char > &file_contents) |
template<class CharSetIter > | |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts, CharSetIter first, CharSetIter last) |
template<class CharSetIter > | |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts, const std::vector< unsigned char > &file_contents, CharSetIter first, CharSetIter last) |
boost::shared_ptr< Font > | GetFont (const boost::shared_ptr< Font > &font, unsigned int pts) |
void | FreeFont (const std::string &font_filename, unsigned int pts) |
boost::shared_ptr< Texture > | StoreTexture (Texture *texture, const std::string &texture_name) |
boost::shared_ptr< Texture > | StoreTexture (const boost::shared_ptr< Texture > &texture, const std::string &texture_name) |
boost::shared_ptr< Texture > | GetTexture (const std::string &name, bool mipmap=false) |
void | FreeTexture (const std::string &name) |
void | SetStyleFactory (const boost::shared_ptr< StyleFactory > &factory) |
void | RenderCursor (bool render) |
void | SetCursor (const boost::shared_ptr< Cursor > &cursor) |
GG_ABSTRACT_EXCEPTION (Exception) | |
GG_CONCRETE_EXCEPTION (BadFunctionPointer, GG::GUI, Exception) |
Static Public Member Functions | |
static OgreGUI * | GetGUI () |
![]() | |
static void | RenderWindow (Wnd *wnd) |
Public Attributes | |
boost::signal< void()> | HandleSystemEventsSignal |
boost::signal< void(X, Y)> | WindowResizedSignal |
boost::signal< void()> | WindowClosedSignal |
Protected Member Functions | |
virtual void | RenderBegin () |
virtual void | RenderEnd () |
virtual void | Run () |
virtual void | HandleSystemEvents () |
virtual void | Enter2DMode () |
virtual void | Exit2DMode () |
![]() | |
GUI (const std::string &app_name) | |
void | ProcessBrowseInfo () |
virtual void | Render () |
void | SetFPS (double FPS) |
void | SetDeltaT (unsigned int delta_t) |
Additional Inherited Members | |
![]() | |
enum | EventType { IDLE, KEYPRESS, KEYRELEASE, LPRESS, MPRESS, RPRESS, LRELEASE, MRELEASE, RRELEASE, MOUSEMOVE, MOUSEWHEEL } |
typedef std::set< std::pair < Key, Flags< ModKey > > >::iterator | accel_iterator |
typedef std::set< std::pair < Key, Flags< ModKey > > >::const_iterator | const_accel_iterator |
typedef boost::signal< bool(), OrCombiner > | AcceleratorSignalType |
This is an abstract singleton class that represents the GUI framework of an Ogre OpenGL application.
Usage:
Any application including an object of this class should declare that object as a local variable in main(). The name of this variable will herein be assumed to be "gui". It should be allocated on the stack; if it is created dynamically, a leak may occur.
OgreGUI serves as a driver of the main Ogre event loop, and mediates between the global GL state set by Ogre and the global GL state set by GG. It also provides important information to the input plugin via its public signals.
OgreGUI does not constitute a complete input driver for GG. This is because Ogre does not provide any direct input support at all (at the time of this writing, Ogre uses an input library called OIS to provide keyboard, mouse, and joystick input). Following the Ogre convention, OgreGUI relies upon the Ogre plugin system to provide the actual input system used by Ogre and GG. A plugin for OIS is provided in the Ogre/Plugins subtree of the GG sources.
Any plugin used with OgreGUI must grab input state (mouse, keyboard, etc.) in response to the firing of OgreGUI::HandleSystemEventsSignal. It is notified of changes in the window size via OgreGUI::WindowResizedSignal. OgreGUI::HandleWindowClose indicates that the Ogre::RenderWindow in which OgreGUI is operating has or is about to close, in case the plugin needs to perform cleanup.
To use OgreGUI, one must first create "gui", then load the input plugin using Ogre's plugin loading mechanism, then call "gui();". For example:
OgreGUI gui(ogre_window, "/path/to/input_plugin.cfg"); ogre_root->loadPlugin("/path/to/plugin"); gui();
When building GG and OgreGUI statically, the input plugin needs to be created and managed by the application, and installed into and uninstalled from the Ogre::Root singleton explicitly. The plugin must be constructed after Ogre::Root has been constructed:
#include <GG/Ogre/Plugins/OISIput.h> ... OgreGUI gui(ogre_window, "/path/to/input_plugin.cfg"); OISInput* ois_input_plugin = new OISInput; ogre_root->installPlugin(ois_input_plugin); gui(); ... ogre_root->uninstallPlugin(ois_input_plugin); delete ois_input_plugin;
|
explicit |
Basic ctor. A nonzero window is required, and an optional configuration filename, config_filename. If config_filename is supplied, it will be available via ConfigFileStream().
|
virtual |
Dtor.
|
virtual |
Creates a modal event pump suitable for use with Ogre.
Reimplemented from GG::GUI.
const Ogre::SharedPtr<Ogre::DataStream>& GG::OgreGUI::ConfigFileStream | ( | ) | const |
Returns an Ogre::DataStream containing the contents of the config_filename ctor parameter. This will be null if config_filename was not supplied to the ctor.
|
static |
Allows any code to access the gui framework by calling GG::OgreGUI::GetGUI().
Reimplemented from GG::GUI.
|
protectedvirtual |
boost::signal<void ()> GG::OgreGUI::HandleSystemEventsSignal |
Emitted whenever the OgreGUI's AppWidth() and/or AppHeight() change.
boost::signal<void ()> GG::OgreGUI::WindowClosedSignal |