~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/Point.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 19:25:37 UTC
  • Revision ID: neil.patel@canonical.com-20100901192537-mfz7rm6q262pewg6
Import and build NuxCore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "NKernel.h"
 
2
#include "Point.h"
 
3
 
 
4
NAMESPACE_BEGIN
 
5
 
 
6
Point::Point()
 
7
: x(0), y(0)
 
8
{
 
9
}
 
10
 
 
11
Point::Point(t_int32 x_, t_int32 y_)
 
12
: x(x_), y(y_)
 
13
{
 
14
}
 
15
 
 
16
//----------------------------------------------------------------------------
 
17
Point::~Point()
 
18
{
 
19
}
 
20
 
 
21
//----------------------------------------------------------------------------
 
22
Point::Point(const Point& p)
 
23
: x(p.x), y(p.y)
 
24
{
 
25
 
26
  
 
27
//----------------------------------------------------------------------------
 
28
Point& Point::operator = (const Point& p)
 
29
{
 
30
    if(&p == this)
 
31
        return *this;
 
32
    x = p.x;
 
33
    y = p.y;
 
34
    return *this;
 
35
}
 
36
 
 
37
//----------------------------------------------------------------------------
 
38
t_bool Point::operator == (const Point& p) const
 
39
{
 
40
    if((x == p.x) && (y == p.y))
 
41
    {
 
42
        return true;
 
43
    }
 
44
    return false;
 
45
}
 
46
 
 
47
//----------------------------------------------------------------------------
 
48
t_bool Point::operator != (const Point& p) const
 
49
{
 
50
    if((x == p.x) && (y == p.y))
 
51
    {
 
52
        return false;
 
53
    }
 
54
    return true;
 
55
}
 
56
 
 
57
//----------------------------------------------------------------------------
 
58
Point Point::operator + (const Point& p) const
 
59
{
 
60
    Point point;
 
61
 
 
62
    point.x = x + p.x;
 
63
    point.y = y + p.y;
 
64
    return point;
 
65
}
 
66
 
 
67
//----------------------------------------------------------------------------
 
68
Point Point::operator - (const Point& p) const
 
69
{
 
70
    Point point;
 
71
 
 
72
    point.x = x - p.x;
 
73
    point.y = y - p.y;
 
74
    return point;
 
75
}
 
76
 
 
77
//----------------------------------------------------------------------------
 
78
Point& Point::operator += (const Point& p)
 
79
{
 
80
    x += p.x;
 
81
    y += p.y;
 
82
    return *this;
 
83
}
 
84
 
 
85
//----------------------------------------------------------------------------
 
86
Point& Point::operator -= (const Point& p)
 
87
{
 
88
    x -= p.x;
 
89
    y -= p.y;
 
90
    return *this;
 
91
}
 
92
 
 
93
//----------------------------------------------------------------------------
 
94
//----------------------------------------------------------------------------
 
95
//----------------------------------------------------------------------------
 
96
 
 
97
 
 
98
NAMESPACE_END