SCV  4.2.1
Simple Components for Visual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
scv::Kernel Class Reference

The main event loop handler. More...

#include <Kernel.h>

Inheritance diagram for scv::Kernel:
Singleton< T > scv::SCVCallbacks

Public Types

enum  TextureFilter { LINEAR, NEAREST }
 
typedef std::list< Component * > ComponentsList
 

Public Member Functions

virtual void onDisplay (void)
 
void run (void)
 Start the SCV event loop. Call this after setting up your form layout to run the GUI.
 
void showCopyrights (void)
 
void setFramesPerSecond (float fps)
 Sets the FPS the main loop runs at. Increase if you need smoother animation or higher responsiveness.
 
float getFramesPerSecond (void) const
 Returns the current FPS the interface is running at.
 
void setWindowSize (unsigned int width, unsigned int height)
 Resizes the window.
 
void setWindowTitle (const std::string &title)
 Changes the window title.
 
int getWidth (void) const
 Returns the current window width.
 
int getHeight (void) const
 Returns the current window height.
 
void setFullScreen (bool full)
 Enters or exits fullscreen mode.
 
void lockWindowSize (bool lock)
 Locks or unlocks the window size, so that the user can not resize it by dragging.
 
TextureFilter getFilterType (void)
 
void setFilterType (TextureFilter tex)
 
bool lockMouseUse (Component *component)
 
bool unlockMouseUse (Component *component)
 
bool requestMouseUse (Component *component)
 
bool requestComponentFocus (Component *component)
 
ComponentgetFocusedComponent (void) const
 
bool willAppearOnScreen (Component *component)
 
void applyDefaultTransformMatrix (void)
 
std::string getClipBoardString (void) const
 Returns the current contents of the clipboard.
 
void setClipBoardString (const std::string str)
 Replaces the clipboard's contents with the string strData.
 
void addWindow (InternalFrame *window)
 
void addComponent (Component *object)
 Adds component object to the window. If object already belongs to a panel, does nothing.
 
void removeComponent (Component *object)
 Removes object from any container it is in.
 
void setWidgetTexture (scv::Component::Type widget, ComponentTexture *texture)
 
ComponentTexturegetWidgetTexture (scv::Component::Type widget)
 
- Public Member Functions inherited from scv::SCVCallbacks
virtual ~SCVCallbacks ()
 
virtual void onMouseClick (const scv::MouseEvent &evt)
 
virtual void onMouseHold (const scv::MouseEvent &evt)
 
virtual void onMouseOver (const scv::MouseEvent &evt)
 
virtual void onMouseUp (const scv::MouseEvent &evt)
 
virtual void onMouseWheel (const scv::MouseEvent &evt)
 
virtual void onKeyPressed (const scv::KeyEvent &evt)
 
virtual void onKeyUp (const scv::KeyEvent &evt)
 
virtual void onSizeChange (void)
 
virtual void onPositionChange (void)
 

Public Attributes

ComponentsList _objects
 
bool isFullScreen
 
int currSize [2]
 
int userSize [2]
 
int count
 
int currTime
 
int prevTime
 
int baseTime
 
float fps
 
float currFps
 
int doubleClickTime
 
Point lastClickPosition
 
Timer lastTimeClicked
 
MouseEvent::Button lastButton
 
bool clicked
 
bool locked
 
ComponentcomponentRequestUse
 

Protected Member Functions

 Kernel (void)
 
virtual ~Kernel (void)
 
void initOpenGL (int argc, char *argv[])
 
void updateFramesPerSecond (void)
 
- Protected Member Functions inherited from Singleton< T >
 Singleton (void)
 
virtual ~Singleton (void)
 
 Singleton (const Singleton &source)
 

Static Protected Member Functions

static void cbMouseMotion (int x, int y)
 
static void cbMouseClick (int button, int state, int x, int y)
 
static void cbMouseWheel (int button, int dir, int x, int y)
 
static void cbKeySpecial (int key, int x, int y)
 
static void cbKeySpecialUp (int key, int x, int y)
 
static void cbKey (unsigned char key, int x, int y)
 
static void cbKeyUp (unsigned char key, int x, int y)
 
static void cbDisplay (void)
 

Protected Attributes

struct {
   bool   isFullScreen
 
   int   currSize [2]
 
   int   userSize [2]
 
Display
 
struct {
   int   count
 
   int   currTime
 
   int   prevTime
 
   int   baseTime
 
   float   fps
 
   float   currFps
 
FrameRate
 
struct {
   int   doubleClickTime
 
   Point   lastClickPosition
 
   Timer   lastTimeClicked
 
   MouseEvent::Button   lastButton
 
   bool   clicked
 
   bool   locked
 
   Component *   componentRequestUse
 
Mouse
 
ComponentTexture_loadedWidgets [Component::NOFWIDGETS]
 
std::string _windowTitle
 
TextureFilter _filterType
 
Component_focusedComponent
 
bool _allowResizing
 
bool _reshapeOnNextFrame
 
bool _componentRequestFocus
 
ContextMenu_contextMenu
 

Static Protected Attributes

static const std::string s_defaultTitle = "SCV - Simple Components for Visual - http://www-usr.inf.ufsm.br/~pozzer/scv/"
 
static const unsigned int s_defaultWidth = 1280
 
static const unsigned int s_defaultHeight = 720
 
static const unsigned int s_defaultFramesPerSecond = 30
 
- Static Protected Attributes inherited from Singleton< T >
static T * _instance = 0
 

Friends

class Singleton< Kernel >
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< T >
static void setInstance (T *instance)
 
static T * getInstance ()
 
static void destroyInstance ()
 

Detailed Description

The main event loop handler.

This class controls all components, interactions and OpenGL interfacing.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator:
LINEAR 
NEAREST 

Constructor & Destructor Documentation

scv::Kernel::Kernel ( void  )
protected
virtual scv::Kernel::~Kernel ( void  )
inlineprotectedvirtual

Member Function Documentation

void scv::Kernel::addComponent ( Component object)

Adds component object to the window. If object already belongs to a panel, does nothing.

void scv::Kernel::addWindow ( InternalFrame window)
void scv::Kernel::applyDefaultTransformMatrix ( void  )
void scv::Kernel::cbDisplay ( void  )
staticprotected
void scv::Kernel::cbKey ( unsigned char  key,
int  x,
int  y 
)
staticprotected
void scv::Kernel::cbKeySpecial ( int  key,
int  x,
int  y 
)
staticprotected
void scv::Kernel::cbKeySpecialUp ( int  key,
int  x,
int  y 
)
staticprotected
void scv::Kernel::cbKeyUp ( unsigned char  key,
int  x,
int  y 
)
staticprotected
void scv::Kernel::cbMouseClick ( int  button,
int  state,
int  x,
int  y 
)
staticprotected
void scv::Kernel::cbMouseMotion ( int  x,
int  y 
)
staticprotected
void scv::Kernel::cbMouseWheel ( int  button,
int  dir,
int  x,
int  y 
)
staticprotected
std::string scv::Kernel::getClipBoardString ( void  ) const

Returns the current contents of the clipboard.

Kernel::TextureFilter scv::Kernel::getFilterType ( void  )
inline
Component * scv::Kernel::getFocusedComponent ( void  ) const
inline
float scv::Kernel::getFramesPerSecond ( void  ) const
inline

Returns the current FPS the interface is running at.

int scv::Kernel::getHeight ( void  ) const
inline

Returns the current window height.

ComponentTexture * scv::Kernel::getWidgetTexture ( scv::Component::Type  widget)
inline
int scv::Kernel::getWidth ( void  ) const
inline

Returns the current window width.

void scv::Kernel::initOpenGL ( int  argc,
char *  argv[] 
)
protected
bool scv::Kernel::lockMouseUse ( Component component)
void scv::Kernel::lockWindowSize ( bool  lock)

Locks or unlocks the window size, so that the user can not resize it by dragging.

virtual void scv::Kernel::onDisplay ( void  )
inlinevirtual
void scv::Kernel::removeComponent ( Component object)

Removes object from any container it is in.

bool scv::Kernel::requestComponentFocus ( Component component)
bool scv::Kernel::requestMouseUse ( Component component)
void scv::Kernel::run ( void  )

Start the SCV event loop. Call this after setting up your form layout to run the GUI.

void scv::Kernel::setClipBoardString ( const std::string  str)

Replaces the clipboard's contents with the string strData.

void scv::Kernel::setFilterType ( TextureFilter  tex)
inline
void scv::Kernel::setFramesPerSecond ( float  fps)
inline

Sets the FPS the main loop runs at. Increase if you need smoother animation or higher responsiveness.

void scv::Kernel::setFullScreen ( bool  full)

Enters or exits fullscreen mode.

void scv::Kernel::setWidgetTexture ( scv::Component::Type  widget,
ComponentTexture texture 
)
inline
void scv::Kernel::setWindowSize ( unsigned int  width,
unsigned int  height 
)

Resizes the window.

void scv::Kernel::setWindowTitle ( const std::string &  title)

Changes the window title.

void scv::Kernel::showCopyrights ( void  )
bool scv::Kernel::unlockMouseUse ( Component component)
void scv::Kernel::updateFramesPerSecond ( void  )
protected
bool scv::Kernel::willAppearOnScreen ( Component component)

Friends And Related Function Documentation

friend class Singleton< Kernel >
friend

Member Data Documentation

bool scv::Kernel::_allowResizing
protected
bool scv::Kernel::_componentRequestFocus
protected
ContextMenu* scv::Kernel::_contextMenu
protected
TextureFilter scv::Kernel::_filterType
protected
Component* scv::Kernel::_focusedComponent
protected
ComponentTexture* scv::Kernel::_loadedWidgets[Component::NOFWIDGETS]
protected
ComponentsList scv::Kernel::_objects
bool scv::Kernel::_reshapeOnNextFrame
protected
std::string scv::Kernel::_windowTitle
protected
int scv::Kernel::baseTime
bool scv::Kernel::clicked
Component* scv::Kernel::componentRequestUse
int scv::Kernel::count
float scv::Kernel::currFps
int scv::Kernel::currSize[2]
int scv::Kernel::currTime
struct { ... } scv::Kernel::Display
int scv::Kernel::doubleClickTime
float scv::Kernel::fps
struct { ... } scv::Kernel::FrameRate
bool scv::Kernel::isFullScreen
MouseEvent::Button scv::Kernel::lastButton
Point scv::Kernel::lastClickPosition
Timer scv::Kernel::lastTimeClicked
bool scv::Kernel::locked
struct { ... } scv::Kernel::Mouse
int scv::Kernel::prevTime
const unsigned int scv::Kernel::s_defaultFramesPerSecond = 30
staticprotected
const unsigned int scv::Kernel::s_defaultHeight = 720
staticprotected
const std::string scv::Kernel::s_defaultTitle = "SCV - Simple Components for Visual - http://www-usr.inf.ufsm.br/~pozzer/scv/"
staticprotected
const unsigned int scv::Kernel::s_defaultWidth = 1280
staticprotected
int scv::Kernel::userSize[2]

The documentation for this class was generated from the following files: