diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-27 02:00:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-27 02:00:06 +0300 |
commit | 491463c41659d791c09787ad5975c84a42ada74a (patch) | |
tree | 2a47e68c13ab4c467cf0e874a71c08ed77be0108 /source/gameengine | |
parent | 839ac92f651d456db40ffaebefab87172fdeedba (diff) |
remove ARegion from the Canvas, use a RAS_Rect instead. (pair programming with Dalai ;) )
Diffstat (limited to 'source/gameengine')
3 files changed, 27 insertions, 15 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index ca5faf00bb6..5c7e18b5304 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -127,7 +127,13 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw struct Scene *scene= CTX_data_scene(C); struct Main* maggie1= CTX_data_main(C); - + + RAS_Rect area_rect; + area_rect.SetLeft(ar->winrct.xmin); + area_rect.SetBottom(ar->winrct.ymin); + area_rect.SetRight(ar->winrct.xmax); + area_rect.SetTop(ar->winrct.ymax); + int exitrequested = KX_EXIT_REQUEST_NO_REQUEST; Main* blenderdata = maggie1; @@ -167,7 +173,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 0) != 0); bool novertexarrays = (SYS_GetCommandLineInt(syshandle, "novertexarrays", 0) != 0); // create the canvas, rasterizer and rendertools - RAS_ICanvas* canvas = new KX_BlenderCanvas(win, ar); + RAS_ICanvas* canvas = new KX_BlenderCanvas(win, area_rect); canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); RAS_IRenderTools* rendertools = new KX_BlenderRenderTools(); RAS_IRasterizer* rasterizer = NULL; @@ -589,6 +595,12 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win, Main* blenderdata = maggie; + RAS_Rect area_rect; + area_rect.SetLeft(ar->winrct.xmin); + area_rect.SetBottom(ar->winrct.ymin); + area_rect.SetRight(ar->winrct.xmax); + area_rect.SetTop(ar->winrct.ymax); + char* startscenename = scenename; char pathname[FILE_MAXDIR+FILE_MAXFILE]; STR_String exitstring = ""; @@ -619,7 +631,7 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win, bool usemat = false; // create the canvas, rasterizer and rendertools - RAS_ICanvas* canvas = new KX_BlenderCanvas(win, ar); + RAS_ICanvas* canvas = new KX_BlenderCanvas(win, area_rect); //canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); RAS_IRenderTools* rendertools = new KX_BlenderRenderTools(); RAS_IRasterizer* rasterizer = NULL; diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index 360794ceb33..73803846d70 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -35,9 +35,9 @@ #endif -KX_BlenderCanvas::KX_BlenderCanvas(struct wmWindow *win, ARegion *ar) : +KX_BlenderCanvas::KX_BlenderCanvas(struct wmWindow *win, RAS_Rect &rect) : m_win(win), -m_ar(ar) +m_frame_rect(rect) { } @@ -96,12 +96,12 @@ void KX_BlenderCanvas::ClearBuffer(int type) int KX_BlenderCanvas::GetWidth( ) const { - return m_ar->winx; + return m_frame_rect.GetWidth(); } int KX_BlenderCanvas::GetHeight( ) const { - return m_ar->winy; + return m_frame_rect.GetHeight(); } RAS_Rect & @@ -119,8 +119,8 @@ SetViewPort( ){ int vp_width = (x2 - x1) + 1; int vp_height = (y2 - y1) + 1; - int minx = m_ar->winrct.xmin; - int miny = m_ar->winrct.ymin; + int minx = m_frame_rect.GetLeft(); + int miny = m_frame_rect.GetBottom(); m_area_rect.SetLeft(minx + x1); m_area_rect.SetBottom(miny + y1); @@ -162,9 +162,9 @@ void KX_BlenderCanvas::SetMouseState(RAS_MouseState mousestate) // (0,0) is top left, (width,height) is bottom right void KX_BlenderCanvas::SetMousePosition(int x,int y) { - int winX = m_ar->winrct.xmin; - int winY = m_ar->winrct.ymin; - int winH = m_ar->winy; + int winX = m_frame_rect.GetLeft(); + int winY = m_frame_rect.GetBottom(); + int winH = m_frame_rect.GetHeight(); BL_warp_pointer(winX + x, winY + (winH-y-1)); } @@ -173,5 +173,5 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y) void KX_BlenderCanvas::MakeScreenShot(const char* filename) { - BL_MakeScreenShot(m_ar, filename); +// BL_MakeScreenShot(m_ar, filename); } diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h index f3228f4b524..5967ce78b46 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h @@ -64,7 +64,7 @@ public: * * @param area The Blender ARegion to run the game within. */ - KX_BlenderCanvas(struct wmWindow* win, struct ARegion* ar); + KX_BlenderCanvas(struct wmWindow* win, struct RAS_Rect &rect); ~KX_BlenderCanvas(); void @@ -167,8 +167,8 @@ public: private: /** Blender area the game engine is running within */ - struct ARegion* m_ar; struct wmWindow* m_win; + RAS_Rect m_frame_rect; RAS_Rect m_area_rect; |