2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file KX_BlenderCanvas.h
32 #ifndef __KX_BLENDERCANVAS_H__
33 #define __KX_BLENDERCANVAS_H__
41 #include "RAS_ICanvas.h"
44 #include "KX_BlenderGL.h"
46 #ifdef WITH_CXX_GUARDEDALLOC
47 #include "MEM_guardedalloc.h"
54 * 2D Blender device context abstraction.
55 * The connection from 3d rendercontext to 2d Blender surface embedding.
58 class KX_BlenderCanvas : public RAS_ICanvas
61 /** Rect that defines the area used for rendering,
62 relative to the context */
63 RAS_Rect m_displayarea;
66 /* Construct a new canvas.
68 * \param area The Blender ARegion to run the game within.
70 KX_BlenderCanvas(struct wmWindow* win, class RAS_Rect &rect, struct ARegion* ar);
124 GetMouseNormalizedX(int x
128 GetMouseNormalizedY(int y
135 return m_displayarea;
139 SetDisplayArea(RAS_Rect *rect
141 m_displayarea= *rect;
156 RAS_MouseState mousestate
171 * Nothing needs be done for BlenderCanvas
172 * Begin/End Draw, as the game engine GL context
173 * is always current/active.
188 /** Blender area the game engine is running within */
189 struct wmWindow* m_win;
190 RAS_Rect m_frame_rect;
191 RAS_Rect m_area_rect;
196 #ifdef WITH_CXX_GUARDEDALLOC
197 MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderCanvas")
201 #endif // __KX_BLENDERCANVAS_H__