Advertisement
Guest User

RenderComponent class using GDI+

a guest
Jan 6th, 2013
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <windows.h>
  4. #include "Library/ObjComponent.h"
  5. #include "Library/Bitmap.h"
  6. #include <gdiplus.h>
  7. //#include <gdiplus/gdiplusgraphics.h>
  8. //#include <Graphics>
  9.  
  10.  
  11. // Component Type Val: 3
  12. class RenderComponent : public ObjComponent
  13. {
  14. public:
  15.   RenderComponent(int parentid, const wchar_t * a_ImagePath); // Create RenderComponent from File
  16.   virtual ~RenderComponent();
  17.  
  18.   virtual void OnUpdate() {};
  19.   virtual void OnMessage(ObjMessage&);
  20.  
  21.   Gdiplus::Image*  Image_Get()         { return m_pImage; };
  22.   Bitmap*          Bitmap_Get()        { return m_pBitmap; };
  23.   int              RenderType_Get()    { return RenderType; };
  24. protected:
  25.   Gdiplus::Image* m_pImage;
  26.   const wchar_t* m_ImagePath;
  27.   int RenderType; // 0 for bitmap, 1 for Gdiplus::Image
  28.   Bitmap* m_pBitmap;
  29. };
  30.  
  31. RenderComponent::RenderComponent(int parentid, const wchar_t * a_ImagePath)
  32.   : ObjComponent(parentid)
  33. {
  34.   RenderType = 1;
  35.   SetType(3);
  36.   m_pImage = new Gdiplus::Image(L"Player.bmp");
  37. }
  38.  
  39. RenderComponent::~RenderComponent()
  40. {
  41.     delete m_pImage;
  42. }
  43.  
  44. void RenderComponent::OnMessage(ObjMessage& m)
  45. {
  46.   if (m.msgType == "Set Rotation") // Will work on once images work
  47.   {
  48.     /*//Gdiplus::Image* pIm = NULL;
  49.     //pIm = new Image("");
  50.     Gdiplus::Graphics *g;
  51.     Gdiplus::Image *i;
  52.     g->FromImage(m_pBitmap);*/
  53.   }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement