TapestryEngine

A 2D Platformer Game Engine
Log | Files | Refs

e0a2ac6181c8a1190ee45c101a5604ee0bb607f2.svn-base (927B)


      1 #include "DiagnosticDraw.h"
      2 
      3 DiagnosticDraw* gDiagDraw = NULL;
      4 
      5 bool DiagnosticDraw::DrawRect(SDL_Rect WrldPos)
      6 {
      7 	SDL_Rect ScreenPos;
      8 	ScreenPos.h = (int)((float)(WrldPos.h)*((float)(SCREEN_H) / (float)(mCam.GetCamView()->h)));
      9 	ScreenPos.w = (int)((float)(WrldPos.w)*((float)(SCREEN_W) / (float)(mCam.GetCamView()->w)));
     10 
     11 	ScreenPos.x = (int)((float)(WrldPos.x - mCam.GetCamX())*((float)(SCREEN_W) / (float)(mCam.GetCamView()->w)));
     12 	ScreenPos.y = (int)((float)(WrldPos.y - mCam.GetCamY())*((float)(SCREEN_H) / (float)(mCam.GetCamView()->h)));
     13 
     14 	SDL_Point pts[5];
     15 	pts[0].x = ScreenPos.x;
     16 	pts[0].y = ScreenPos.y;
     17 	pts[1].x = ScreenPos.x + ScreenPos.w;
     18 	pts[1].y = ScreenPos.y;
     19 	pts[2].x = ScreenPos.x + ScreenPos.w;
     20 	pts[2].y = ScreenPos.y + ScreenPos.h;
     21 	pts[3].x = ScreenPos.x;
     22 	pts[3].y = ScreenPos.y + ScreenPos.h;
     23 	pts[4].x = ScreenPos.x;
     24 	pts[4].y = ScreenPos.y;
     25 
     26 	SDL_RenderDrawLines(mRen, pts, 5);
     27 
     28 	return false;
     29 }