00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef FXPOINT_H
00025
#define FXPOINT_H
00026
00027
00028
namespace FX {
00029
00030
00031 class FXAPI FXPoint {
00032
public:
00033 FXshort x;
00034 FXshort y;
00035
public:
00036
00037
00038 FXPoint(){ }
00039 FXPoint(
const FXSize& s):x(s.w),y(s.h){ }
00040 FXPoint(
const FXPoint& p):x(p.x),y(p.y){ }
00041 FXPoint(FXshort xx,FXshort yy):x(xx),y(yy){ }
00042
00043
00044 friend FXAPI FXbool operator==(
const FXPoint& p,
const FXPoint& q){
return p.
x==q.
x && p.
y==q.
y; }
00045
friend FXAPI FXbool operator!=(
const FXPoint& p,
const FXPoint& q){
return p.
x!=q.
x || p.
y!=q.
y; }
00046
00047
00048 FXPoint& operator=(
const FXPoint& p){ x=p.
x; y=p.
y;
return *
this; }
00049 FXPoint& operator=(
const FXSize& s){ x=s.
w; y=s.
h;
return *
this; }
00050
00051
00052 FXPoint& operator+=(
const FXPoint& p){ x+=p.
x; y+=p.
y;
return *
this; }
00053 FXPoint& operator+=(
const FXSize& s){ x+=s.
w; y+=s.
h;
return *
this; }
00054 FXPoint& operator-=(
const FXPoint& p){ x-=p.x; y-=p.y;
return *
this; }
00055 FXPoint& operator-=(
const FXSize& s){ x-=s.w; y-=s.h;
return *
this; }
00056 FXPoint& operator*=(FXshort c){ x*=c; y*=c;
return *
this; }
00057 FXPoint& operator/=(FXshort c){ x/=c; y/=c;
return *
this; }
00058
00059
00060 FXPoint operator-(){
return FXPoint(-x,-y); }
00061
00062
00063 friend FXAPI FXPoint operator+(
const FXPoint& p,
const FXPoint& q){
return FXPoint(p.
x+q.
x,p.
y+q.
y); }
00064
friend FXAPI FXPoint operator+(
const FXPoint& p,
const FXSize& s){
return FXPoint(p.
x+s.
w,p.
y+s.
h); }
00065
friend FXAPI FXPoint operator+(
const FXSize& s,
const FXPoint& p){
return FXPoint(s.w+p.x,s.h+p.y); }
00066
00067
friend FXAPI FXPoint operator-(
const FXPoint& p,
const FXPoint& q){
return FXPoint(p.x-q.x,p.y-q.y); }
00068
friend FXAPI FXPoint operator-(
const FXPoint& p,
const FXSize& s){
return FXPoint(p.x-s.w,p.y-s.h); }
00069
friend FXAPI FXPoint operator-(
const FXSize& s,
const FXPoint& p){
return FXPoint(s.w-p.x,s.h-p.y); }
00070
00071
friend FXAPI FXPoint operator*(
const FXPoint& p,FXshort c){
return FXPoint(p.x*c,p.y*c); }
00072
friend FXAPI FXPoint operator*(FXshort c,
const FXPoint& p){
return FXPoint(c*p.x,c*p.y); }
00073
friend FXAPI FXPoint operator/(
const FXPoint& p,FXshort c){
return FXPoint(p.x/c,p.y/c); }
00074
friend FXAPI FXPoint operator/(FXshort c,
const FXPoint& p){
return FXPoint(c/p.x,c/p.y); }
00075
00076
00077
friend FXAPI FXStream& operator<<(FXStream& store,
const FXPoint& p);
00078
00079
00080
friend FXAPI FXStream& operator>>(FXStream& store,FXPoint& p);
00081 };
00082
00083 }
00084
00085
#endif