Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cXSpritePage.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cXSpritePage_H
7 #define _INC_cXSpritePage_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cXTextureFile.h"
16 
17 namespace Gray3D
18 {
20  {
21  // a source texture for a bunch of sprites.
22  // A texture plus a map of elements inside .
23 
24  cSpriteMap m_Map;
25  cXTextureFilePtr m_pTex; // The associated texture.
26 
27  };
28 
29  typedef void * cXSpritePagePtr;
30 
32  {
36 
37  friend class cDXSpriteDC;
38 
39  public:
42 
43  private:
44  // render params
45  cColorDX m_Color;
46  cVector2f m_vScaling;
47  cVector2f m_vRotationCenter;
48  RADIANf_t m_Rotation;
49 
50  protected:
52 
53  public:
54 
55  cXSpriteElem(const cXSpriteElem& Sprite);
57 
59 
60  bool isRenderable() const noexcept
61  {
62  // is m map set and texture loaded ?
63  return true;
64  }
65 
66 
67  PIXELS_t get_ElemWidth(void) const noexcept
68  {
70  return 0;
71  }
72  PIXELS_t get_ElemHeight(void) const noexcept
73  {
74  return 0;
75  }
76 
78  D3DCOLOR get_SpriteColor(void) const noexcept
79  {
80  return m_Color;
81  }
83  void put_ObjectColor(D3DCOLOR Hue, COLOR_ELEM_t HuePercent);
84 
85  COLOR_ELEM_t get_Alpha() const noexcept
86  {
87  return m_Color.get_A();
88  }
89  void put_Alpha(COLOR_ELEM_t bVal) noexcept
90  {
92  m_Color.put_A(bVal);
93  }
94 
96  const cVector2f& get_Scaling(void) const noexcept
97  {
99  return m_vScaling;
100  }
101  void put_Scaling(const cVector2f& vScaling) noexcept
102  {
104  m_vScaling = vScaling;
105  }
106  void SetScalingDest(int cx, int cy);
107 
109  cVector2f get_RotationCenter(void) const noexcept
110  {
111  return m_vRotationCenter;
112  }
113  void put_RotationCenter(cVector2f vRotationCenter) noexcept
114  {
115  m_vRotationCenter = vRotationCenter;
116  }
117  RADIANf_t get_Rotation(void) const noexcept
118  {
119  return m_Rotation;
120  }
121  void put_Rotation(RADIANf_t Rotation) noexcept
122  {
123  m_Rotation = Rotation;
124  }
125  };
126 
127 
128 }
129 
130 #endif
131 
#define GRAY3D_LINK
Definition: Gray3D.h:15
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
DWORD D3DCOLOR
Stuff normally defined in windows.h or DirectX headers.
Definition: cColorRef.h:24
Definition: cXSpritePage.h:32
void put_Rotation(RADIANf_t Rotation) noexcept
Definition: cXSpritePage.h:121
void put_Alpha(COLOR_ELEM_t bVal) noexcept
Definition: cXSpritePage.h:89
cXSpritePagePtr m_pSpritePage
source texture loaded from a file or memory + map.
Definition: cXSpritePage.h:40
PIXELS_t get_ElemWidth(void) const noexcept
Definition: cXSpritePage.h:67
void put_RotationCenter(cVector2f vRotationCenter) noexcept
Definition: cXSpritePage.h:113
COLOR_ELEM_t get_Alpha() const noexcept
Definition: cXSpritePage.h:85
PIXELS_t get_ElemHeight(void) const noexcept
Definition: cXSpritePage.h:72
D3DCOLOR put_SpriteColor(D3DCOLOR color)
cSpriteMap::ELEM_t m_nElem
element within the m_pSpritePage. (for sprite type operations)
Definition: cXSpritePage.h:41
cVector2f get_RotationCenter(void) const noexcept
Rotation.
Definition: cXSpritePage.h:109
D3DCOLOR get_SpriteColor(void) const noexcept
Color.
Definition: cXSpritePage.h:78
void SetScalingDest(int cx, int cy)
HRESULT UpdateTexureSize()
bool SetCopyElem(const cXSpriteElem &src)
void put_ObjectColor(D3DCOLOR Hue, COLOR_ELEM_t HuePercent)
cXSpriteElem(const cXSpriteElem &Sprite)
void put_Scaling(const cVector2f &vScaling) noexcept
Definition: cXSpritePage.h:101
RADIANf_t get_Rotation(void) const noexcept
Definition: cXSpritePage.h:117
bool isRenderable() const noexcept
Definition: cXSpritePage.h:60
const cVector2f & get_Scaling(void) const noexcept
Scaling.
Definition: cXSpritePage.h:96
Definition: cXSpritePage.h:20
Definition: cColorRef.h:147
COLOR_ELEM_t get_A() const noexcept
Definition: cColorRef.h:241
void put_A(COLOR_ELEM_t a) noexcept
Definition: cColorRef.h:246
Definition: cSpriteMap.h:20
int ELEM_t
what element/icon number of this sprite map?
Definition: cSpriteMap.h:34
Definition: cVector.h:36
Definition: Gray3D.cpp:12
void * cXSpritePagePtr
Definition: cXSpritePage.h:29
BYTE COLOR_ELEM_t
A single 8 bit color element. alpha, red, green, or blue intensity as 0-255.
Definition: cColorRef.h:34
float RADIANf_t
type is float radians
Definition: Calc.h:27
int PIXELS_t
Count of pixels in a dimension of some image/surface.
Definition: cSurfaceInfo.h:20
Definition: cDebugAssert.h:29