Sleeping Wombat GUI  0.100
swGUI
CommonTypes.h
Go to the documentation of this file.
1 #pragma once
2 
10 #include <string>
11 #include <DirectXMath.h>
12 
13 #include "Thickness.h"
14 
15 
16 
17 
18 namespace sw {
19 namespace gui
20 {
21 
22 
23 
24 static const std::string EMPTY_STRING;
25 
26 
27 typedef DirectX::XMFLOAT2 Position;
28 typedef DirectX::XMFLOAT2 Size2D;
29 
30 
32 struct Rect
33 {
34  float Left;
35  float Right;
36  float Top;
37  float Bottom;
38 
39  float GetWidth () { return Right - Left; }
40  float GetHeight () { return Top - Bottom; }
41 
42  bool Intersects ( const Position& pos )
43  {
44  if( pos.x < Left )
45  return false;
46  if( pos.x > Right )
47  return false;
48  if( pos.y < Bottom )
49  return false;
50  if( pos.y > Top )
51  return false;
52  return true;
53  }
54 };
55 
56 } // gui
57 } // sw
float Right
Definition: CommonTypes.h:35
bool Intersects(const Position &pos)
Definition: CommonTypes.h:42
Definition: DirectInputModule.cpp:11
float GetHeight()
Definition: CommonTypes.h:40
float Top
Definition: CommonTypes.h:36
Rectangle structure.
Definition: CommonTypes.h:32
DirectX::XMFLOAT2 Size2D
Definition: CommonTypes.h:28
float Bottom
Definition: CommonTypes.h:37
DirectX::XMFLOAT2 Position
Definition: CommonTypes.h:27
float Left
Definition: CommonTypes.h:34
float GetWidth()
Definition: CommonTypes.h:39