83 ContextResult(
bool handled,
bool needsRedraw ): _handled(handled), _redraw(needsRedraw){}
98 inline void setHandled(
bool state ) { _handled = state; }
127 inline void set(
bool handled,
bool redraw ) { _handled = handled; _redraw = redraw; }
174 virtual void drawGL(
int vWidth,
int vHeight ){}
188 virtual bool selectGL(
const GLScene * scene,
const GLCamera & camera,
int vWidth,
int vHeight,
int * selectPoint ) {
return false; }
239 void uiSetup(
int vWidth,
int vHeight );
255 virtual void drawUIGL(
int vWidth,
int vHeight,
bool select=
false ) {};
269 void getOpenGLView();
278 void writeText(
const std::string & txt,
const Vector2 & pos,
bool currColor=
false )
const;
287 void writeText(
const std::string & txt,
const Vector3 & pos,
bool currColor=
false )
const;
300 void writeTextRadially(
const std::string & txt,
const Vector2 & pos,
const Vector2 & dir,
bool currColor=
false )
const;
330 void writeToScreen(
const std::string & txt,
TextWriter::Alignment align,
int fontSize,
float hPad=0.f,
float vPad=0.f,
bool currColor=
false,
bool trans=
true )
const;
335 double _modViewMat[16];
366 virtual bool selectGL(
const GLScene * scene,
const GLCamera & camera,
int vWidth,
int vHeight,
int * selectPoint );
371 #endif // __CONTEXT_H__
virtual void update()
Allow the context to update any time-dependent state it might have to the given global time...
Definition: Context.h:214
Context()
Constructor.
Definition: Context.h:161
SDL_Event SDL_Event
Forward declaration of the SDL event type.
Definition: Context.h:53
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
bool _handled
Reports if the event has been handled (and no one else needs to worry about it).
Definition: Context.h:141
Sets up the proper compiler directives for platform and dll export/import.
Alignment
Enumeration for controlling text alignment.
Definition: TextWriter.h:98
bool _redraw
Reports if the event requires a redraw on the scene.
Definition: Context.h:146
virtual void newGLContext()
Callback for when the OpenGL context is changed.
Definition: Context.h:219
The base context class for defining a how events are handled. It also is responsible drawing UI eleme...
Definition: Context.h:156
bool needsRedraw() const
Reports if the result believes the event handling requires a redraw.
Definition: Context.h:119
A context that performs object selection by directly clicking on selectable entities in the OpenGL co...
Definition: Context.h:352
void setNeedsRedraw(bool state)
Sets the "needs redraw" state to the given boolean state.
Definition: Context.h:112
The SceneGraph (SceneGraph) name space, containing all elements to use in a SceneGraph.
Functionality for writing text on the OpenGL context.
virtual void activate()
Called when the context is activated.
Definition: Context.h:224
bool isHandled() const
Reports if the result considers the event handled.
Definition: Context.h:105
virtual ~Context()
Virtual destructor.
Definition: Context.h:166
virtual void drawUIGL(int vWidth, int vHeight, bool select=false)
Draw UI elements into the context.
Definition: Context.h:255
void combine(const ContextResult &res)
Combines the provided context result with this one; flags are combined with a boolean OR...
Definition: Context.h:134
virtual bool selectGL(const GLScene *scene, const GLCamera &camera, int vWidth, int vHeight, int *selectPoint)
Performs selection based on a click on screen space. Uses the OpenGL selection mechanism.
Definition: Context.h:188
void setHandled(bool state)
Sets the "handled" state to the given boolean state.
Definition: Context.h:98
The class which contains the entire drawable scene.
Definition: GLScene.h:72
ContextResult & operator=(const ContextResult &res)
Simple assignment operator overloaded.
Definition: Context.h:91
void set(bool handled, bool redraw)
Sets the handled and needs redraw state simultaneously.
Definition: Context.h:127
Defines the result of the context's consideration of user input.
Definition: Context.h:74
virtual ContextResult handleKeyboard(SDL_Event &e)
Give the context the opportunity to respond to a keyboard event.
Definition: Context.h:208
The class for controlling the view camera: it's position, orientation field of view, projection matrix, etc.
Definition: GLCamera.h:57
virtual void draw3DGL(bool select=false)
Draw context elements into the 3D world.
Definition: Context.h:263
virtual void deactivate()
Called when the context is deactivated.
Definition: Context.h:229
virtual ContextResult handleMouse(SDL_Event &e)
Give the context the opportunity to respond to a mouse event.
Definition: Context.h:198
ContextResult(bool handled, bool needsRedraw)
Constructor.
Definition: Context.h:83
virtual void drawGL(int vWidth, int vHeight)
The draw function for the context.
Definition: Context.h:174
Class to handle camera transformations in OpenGL.