Ghost Context Refactor
[blender-staging.git] / source / gameengine / Rasterizer / RAS_ICanvas.h
index f3f817a943dbddda23ea18899547638674503f47..d90cbea286e5d8d5524368e1be545932d5ee2189 100644 (file)
@@ -1,6 +1,4 @@
-/**
- * $Id$
- *
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -15,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef __RAS_ICANVAS
-#define __RAS_ICANVAS
 
-/**
- * 2D rendering device context. The connection from 3d rendercontext to 2d surface.
+/** \file RAS_ICanvas.h
+ *  \ingroup bgerast
  */
 
-class RAS_Rect;
+#ifndef __RAS_ICANVAS_H__
+#define __RAS_ICANVAS_H__
 
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
 
+class RAS_Rect;
+
+/**
+ * 2D rendering device context. The connection from 3d rendercontext to 2d surface.
+ */
 class RAS_ICanvas
 {
 public:
@@ -54,7 +59,7 @@ public:
        virtual 
        ~RAS_ICanvas(
        ) {
-       };
+       }
 
        virtual 
                void 
@@ -75,8 +80,8 @@ public:
         * Initializes the canvas for drawing.  Drawing to the canvas is
         * only allowed between BeginDraw() and EndDraw().
         *
-        * @retval false Acquiring the canvas failed.
-        * @retval true Acquiring the canvas succeeded.
+        * \retval false Acquiring the canvas failed.
+        * \retval true Acquiring the canvas succeeded.
         *
         */
 
@@ -100,6 +105,18 @@ public:
                void 
        SwapBuffers(
        )=0;
+       
+       virtual
+               void
+       SetSwapInterval(
+               int interval
+       )=0;
+
+       virtual
+               bool
+       GetSwapInterval(
+               int& intervalOut
+       )=0;
  
        virtual 
                void 
@@ -126,14 +143,34 @@ public:
        GetHeight(
        ) const = 0;
 
-       virtual 
+       virtual
+               int
+       GetMouseX(int x
+       )=0;
+
+       virtual
+               int
+       GetMouseY(int y
+       )= 0;
+
+       virtual
+               float
+       GetMouseNormalizedX(int x
+       )=0;
+
+       virtual
+               float
+       GetMouseNormalizedY(int y
+       )= 0;
+
+       virtual
                const RAS_Rect &
        GetDisplayArea(
        ) const = 0;
 
-       virtual 
-               RAS_Rect &
-       GetDisplayArea(
+       virtual
+               void
+       SetDisplayArea(RAS_Rect *rect
        ) = 0;
 
        /**
@@ -145,7 +182,7 @@ public:
        ) = 0;
 
        /**
-        * Set the visible vieport 
+        * Set the visible view-port 
         */
 
        virtual
@@ -153,7 +190,26 @@ public:
        SetViewPort(
                int x1, int y1,
                int x2, int y2
-       ) = 0; 
+       ) = 0;
+
+       /**
+        * Update the Canvas' viewport (used when the viewport changes without using SetViewPort()
+        * eg: Shadow buffers and FBOs
+        */
+
+       virtual
+               void
+       UpdateViewPort(
+               int x1, int y1,
+               int x2, int y2
+       ) = 0;
+
+       /**
+        * Get the visible viewport
+        */
+       virtual
+               const int*
+       GetViewPort() = 0;
 
        virtual 
                void 
@@ -168,12 +224,45 @@ public:
                int y
        )=0;
 
+       virtual
+               RAS_MouseState
+       GetMouseState()
+       {
+               return m_mousestate;
+       }
+
        virtual 
                void 
        MakeScreenShot(
                const char* filename
        )=0;
-};
 
-#endif //__RAS_ICANVAS
+       virtual
+               void 
+       ResizeWindow(
+               int width,
+               int height
+       )=0;
+
+       virtual
+               void
+       SetFullScreen(
+               bool enable
+       )=0;
+
+       virtual
+               bool
+       GetFullScreen()=0;
+
+               
+       
+protected:
+       RAS_MouseState m_mousestate;
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+       MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_ICanvas")
+#endif
+};
 
+#endif  /* __RAS_ICANVAS_H__ */