AaronCameron.net
No ads. No Profit. No Master, But Truth.
Not a Member? - Login or Create an Account
Sunday the 20th of May 2012 @ 04:35pm
Front Page Journal Projects Your Profile About
[]

LibN2L-4 Library Code Reference

Classes
Compounds
Files
Members
Method Index
Full Reference

cGuiApp.h

Go to the documentation of this file.
00001 /************************************************************************
00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library
00003 Copyright (C) 2002  Aaron Cameron
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation; either
00008 version 2.1 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 
00019 A copy of the GNU Lesser General Public License has been provided with
00020 this library in the file 'COPYING'.
00021 
00022 Contact information for the author of this library has been provided
00023 with this library in the file 'AUTHOR'.
00024 ************************************************************************/
00025 #ifndef _n2l4_cGuiApp_H
00026 #define _n2l4_cGuiApp_H
00027 
00028 #include "n2l/n2l.h"
00029 #include "n2l/events.h"
00030 #include "n2l/ngl.h"
00031 
00032 #include "gui/cGuiACSetVar.h"
00033 
00034 #include <vector>
00035 
00036 namespace n2l
00037 {
00038     class cDynVar;
00039 
00040     class cGuiCanvas;
00041     class cOpenGLDisplay;
00042 
00043     /**************************************************************************/
00046     class cGuiApp
00047     {
00048     public:
00049         cGuiApp( const cAutoPtr<cGuiCanvas> &ioCanvas );
00050         virtual ~cGuiApp();
00051 
00052         const cAutoPtr<cGuiCanvas> canvas() { return mCanvas; }
00053         const cAutoPtr<const cGuiCanvas> canvas() const { return mCanvas; }
00054 
00055         const cAutoPtr<cGuiACSetVar<tBool> > newQuitAction();
00056 
00057         void run();
00058 
00059         const tBool &wasSystemQuit() const { return mSystemQuitEvent; }
00060 
00061         void addSystemEventFunction( 
00062             void (*iFunc)(const cAutoPtr<const cEventInterface>&) );
00063 
00064         void addUpdateLoopFunction( void (*iFunc)(const tUint) );
00065 
00066         void addPreDrawFunction( void (*iFunc)(void) );
00067         void addPostDrawFunction( void (*iFunc)(void) );
00068 
00073         void clearPixelBuffer( const cAutoPtr<cNGLPixelBuffer> &iPB ) {
00074             mClearBuffer = iPB;
00075         }
00076 
00077     private:
00078         
00079         typedef std::vector<void (*)(const cAutoPtr<const cEventInterface>&) >
00080             tSysFuncList;
00081 
00082         typedef std::vector<void (*)(const tUint)>
00083             tUpdateList;
00084 
00085         typedef std::vector<void (*)(void)> tDrawList;
00086         
00087         cAutoPtr<cGuiCanvas> mCanvas;
00088 
00089         tBool mUsingMouseMap;
00090         tMousePos mOldTopLeft;
00091         tMousePos mOldBottomRight;
00092 
00093         cAutoPtr<tBool> mKeepRunning;
00094         tBool mSystemQuitEvent;
00095 
00096         tSysFuncList mSysFuncList;
00097         tUpdateList mUpdateList;
00098         tDrawList mPreDrawList;
00099         tDrawList mPostDrawList;
00100 
00101         cAutoPtr<cNGLPixelBuffer> mClearBuffer;
00102 
00103         cGuiApp();
00104         cGuiApp( const cGuiApp& );
00105 
00106      }; // class cGuiApp
00107 
00108 } // namespace n2l
00109 
00110 #endif
©2012 Aaron Cameron