Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cPoint2.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cPoint2_H
7 #define _INC_cPoint2_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../Math/cVecT.h"
13 
14 namespace GrayLib
15 {
18 
19  class GRAYLIB_LINK cPoint2i : public cVecT2<int>
20  {
24 
25  typedef cVecT2<int> SUPER_t;
26 
27  public:
28  cPoint2i() // NO INIT
29  {
30  }
31  cPoint2i(int x, int y)
32  : cVecT2<int>(x, y)
33  {}
34  cPoint2i(const SUPER_t& pt)
35  : cVecT2<int>(pt)
36  {}
37 
38 #ifdef _WIN32
39  // Cast directly to/from the Windows POINT type.
40  cPoint2i(const POINT& pt)
41  : cVecT2<int>(*((const SUPER_t*)&pt))
42  {}
43  inline operator POINT&()
44  {
45  return *((POINT*)this);
46  }
47  inline operator const POINT&() const
48  {
49  return *((const POINT*)this);
50  }
51  inline operator POINT*()
52  {
53  return (POINT*) this;
54  }
55  inline operator const POINT*() const
56  {
57  return (const POINT*) this;
58  }
59 #endif
60  };
61 
62  //**************************************************************
63 
64 #if ! defined(_MFC_VER) // && !defined(__ATLTYPES_H__)
65  typedef cPoint2i CPoint;
66 #endif // ! _MFC_VER
67 
68 #ifdef _WIN32
69  // convert windows native types to Gray types.
70  inline cPoint2i& Cvt(POINT& pt)
71  {
72  return *((cPoint2i*)&pt);
73  }
74  inline const cPoint2i& Cvt(const POINT& pt)
75  {
76  return *((const cPoint2i*)&pt);
77  }
78 #endif
79 };
80 
81 #endif // _INC_cPoint2_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Definition: cPoint2.h:20
cPoint2i(int x, int y)
Definition: cPoint2.h:31
cPoint2i()
Definition: cPoint2.h:28
cPoint2i(const SUPER_t &pt)
Definition: cPoint2.h:34
Definition: cVecT.h:473
Definition: cMesh.h:22
cVecT2< float > cPoint2f
Definition: cPoint2.h:16
cVecT2< double > cPoint2d
Definition: cPoint2.h:17
cPoint2i CPoint
Compatible with MFC 2d CPoint,CRect.
Definition: cPoint2.h:65