Advertisement
keybode

h1z1 graphics class

Jan 19th, 2015
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. class CGraphics {
  2. public:
  3.     char                __pad0[0x28];
  4.     int             m_nScreenWidth;     // 0x0028
  5.     int             m_nScreenHeight;    // 0x002C
  6.     char                __pad1[0x18];
  7.     CCamera*            m_pCamera;          // 0x0048
  8.     char                __pad2[0x298];
  9.     CDisplay*           m_pDisplay;         // 0x02E8
  10.  
  11.     void DrawDebugText(const char* text, int x, int y, Color color) {
  12.         typedef int (__thiscall* DrawDebugTextFn)(void*, const char*, __int64, __int64, int);
  13.         static DrawDebugTextFn DrawText = (DrawDebugTextFn)0x1403071C0;
  14.         DrawText(this, text, x, y, color.Code());
  15.     }
  16.  
  17.     bool WorldToScreen(const Vector3& vOrigin, Vector3& vOut) {
  18.         float world[4];
  19.  
  20.         world[0] = vOrigin.x;
  21.         world[1] = vOrigin.y;
  22.         world[2] = vOrigin.z;
  23.         world[3] = 1.0f;
  24.  
  25.         int x = 0, y = 0;
  26.  
  27.         typedef bool (__thiscall* World2ScreenFn)(void*, float*, int*, int*);
  28.  
  29.         static World2ScreenFn World2Screen = (World2ScreenFn)0x14030B180;
  30.        
  31.         if (!World2Screen(this, world, &x, &y)) {
  32.             return false;
  33.         }
  34.  
  35.         vOut.x = x;
  36.         vOut.y = y;
  37.  
  38.         return true;
  39.     }
  40. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement