gxscene.h

Go to the documentation of this file.
00001 
00004 
00005 //
00006 // Copyright (c) 2002-2004 California Institute of Technology
00007 // Copyright (c) 2004-2007 University of Southern California
00008 // Rob Peters <rjpeters at usc dot edu>
00009 //
00010 // created: Sat Nov 23 17:42:38 2002
00011 // commit: $Id: gxscene.h 10065 2007-04-12 05:54:56Z rjpeters $
00012 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/gfx/gxscene.h $
00013 //
00014 // --------------------------------------------------------------------
00015 //
00016 // This file is part of GroovX.
00017 //   [http://ilab.usc.edu/rjpeters/groovx/]
00018 //
00019 // GroovX is free software; you can redistribute it and/or modify it
00020 // under the terms of the GNU General Public License as published by
00021 // the Free Software Foundation; either version 2 of the License, or
00022 // (at your option) any later version.
00023 //
00024 // GroovX is distributed in the hope that it will be useful, but
00025 // WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027 // General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with GroovX; if not, write to the Free Software Foundation,
00031 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00032 //
00034 
00035 #ifndef GROOVX_GFX_GXSCENE_H_UTC20050626084024_DEFINED
00036 #define GROOVX_GFX_GXSCENE_H_UTC20050626084024_DEFINED
00037 
00038 #include "gfx/canvas.h"
00039 #include "gfx/gxcamera.h"
00040 #include "gfx/gxemptynode.h"
00041 #include "gfx/gxnode.h"
00042 
00043 #include "nub/ref.h"
00044 #include "nub/timer.h"
00045 #include "nub/volatileobject.h"
00046 
00047 #include "rutz/shared_ptr.h"
00048 
00049 namespace nub
00050 {
00051   class scheduler;
00052 }
00053 
00055 class GxScene : public nub::volatile_object
00056 {
00057 public:
00059   GxScene(nub::soft_ref<Gfx::Canvas> canvas,
00060           rutz::shared_ptr<nub::scheduler> sched);
00061 
00063   virtual ~GxScene() throw();
00064 
00066   void undraw();
00067 
00069 
00072   void render();
00073 
00075 
00078   void fullRender();
00079 
00081 
00083   void clearscreen();
00084 
00086 
00088   void fullClearscreen();
00089 
00091 
00094   void setVisibility(bool val);
00095 
00097   const nub::ref<GxCamera>& getCamera() const
00098   { return itsCamera; }
00099 
00101   void setCamera(const nub::ref<GxCamera>& cam);
00102 
00104   void setDrawable(const nub::ref<GxNode>& node);
00105 
00107   void reshape(int width, int height);
00108 
00110   void setHold(bool val) { isItHolding = val; }
00111 
00113   void allowRefresh(bool allow)
00114   { isItRefreshing = allow; flushChanges(); }
00115 
00117   void animate(unsigned int framesPerSecond);
00118 
00119 private:
00120   void flushChanges();
00121   void onNodeChange();
00122 
00123   GxScene(const GxScene&);
00124   GxScene& operator=(const GxScene&);
00125 
00126   nub::soft_ref<Gfx::Canvas> itsCanvas;
00127   nub::ref<GxNode> itsDrawNode;
00128   nub::ref<GxNode> itsUndrawNode;
00129   bool isItVisible;
00130 
00131   nub::ref<GxCamera> itsCamera;
00132   int itsWidth;
00133   int itsHeight;
00134   bool isItHolding;
00135   bool isItRefreshing;
00136   bool isItRefreshed;
00137 
00138   const rutz::shared_ptr<nub::scheduler> itsScheduler;
00139   nub::timer itsTimer;
00140 
00141   nub::ref<nub::slot0> slotNodeChanged;
00142 };
00143 
00144 static const char __attribute__((used)) vcid_groovx_gfx_gxscene_h_utc20050626084024[] = "$Id: gxscene.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00145 #endif // !GROOVX_GFX_GXSCENE_H_UTC20050626084024_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:38 2008 by Doxygen version 1.5.5.