Ok, i've changed the way i do my operators, now this is my operators
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
bool operator==(Point2df a, Point2df b){return(a.x==b.x && a.y==b.y);}
bool operator!=(Point2df a, Point2df b){return!(a.x==b.x && a.y==b.y);}
//--------------------------------------------------------------------------------
Point2df operator+=(Point2df a, Point2df b){return Point2df(a.x+b.x, a.y+b.y);}
Point2df operator-=(Point2df a, Point2df b){return Point2df(a.x-b.x, a.y-b.y);}
//--------------------------------------------------------------------------------
Point2df operator+(Point2df a, Point2df b){return Point2df(a.x+b.x, a.y+b.y);}
Point2df operator-(Point2df a, Point2df b){return Point2df(a.x-b.x, a.y-b.y);}
//--------------------------------------------------------------------------------
Point2df operator++(Point2df a){return Point2df(a.x++, a.y++);}
Point2df operator--(Point2df a){return Point2df(a.x--, a.y--);}
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
bool operator==(Point3df a, Point3df b){return(a.x==b.x && a.y==b.y && a.z==b.z);}
bool operator!=(Point3df a, Point3df b){return!(a.x==b.x && a.y==b.y && a.z==b.z);}
//--------------------------------------------------------------------------------
Point3df operator+=(Point3df a, Point3df b){return Point3df(a.x+b.x, a.y+b.y, a.z+b.z);}
Point3df operator-=(Point3df a, Point3df b){return Point3df(a.x-b.x, a.y-b.y, a.z+b.z);}
//--------------------------------------------------------------------------------
Point3df operator+(Point3df a, Point3df b){return Point3df(a.x+b.x, a.y+b.y, a.z+b.z);}
Point3df operator-(Point3df a, Point3df b){return Point3df(a.x-b.x, a.y-b.y, a.z+b.z);}
//--------------------------------------------------------------------------------
Point3df operator++(Point3df a){return Point3df(a.x++, a.y++, a.z++);}
Point3df operator--(Point3df a){return Point3df(a.x--, a.y--, a.z--);}
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
bool operator==(Point2di a, Point2di b){return(a.x==b.x && a.y==b.y);}
bool operator!=(Point2di a, Point2di b){return!(a.x==b.x && a.y==b.y);}
//--------------------------------------------------------------------------------
Point2di operator+=(Point2di a, Point2di b){return Point2di(a.x+b.x, a.y+b.y);}
Point2di operator-=(Point2di a, Point2di b){return Point2di(a.x-b.x, a.y-b.y);}
//--------------------------------------------------------------------------------
Point2di operator+(Point2di a, Point2di b){return Point2di(a.x+b.x, a.y+b.y);}
Point2di operator-(Point2di a, Point2di b){return Point2di(a.x-b.x, a.y-b.y);}
//--------------------------------------------------------------------------------
Point2di operator++(Point2di a){return Point2di(a.x++, a.y++);}
Point2di operator--(Point2di a){return Point2di(a.x--, a.y--);}
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
bool operator==(Point3di a, Point3di b){return(a.x==b.x && a.y==b.y && a.z==b.z);}
bool operator!=(Point3di a, Point3di b){return!(a.x==b.x && a.y==b.y && a.z==b.z);}
//--------------------------------------------------------------------------------
Point3di operator+=(Point3di a, Point3di b){return Point3di(a.x+b.x, a.y+b.y, a.z+b.z);}
Point3di operator-=(Point3di a, Point3di b){return Point3di(a.x-b.x, a.y-b.y, a.z+b.z);}
//--------------------------------------------------------------------------------
Point3di operator+(Point3di a, Point3di b){return Point3di(a.x+b.x, a.y+b.y, a.z+b.z);}
Point3di operator-(Point3di a, Point3di b){return Point3di(a.x-b.x, a.y-b.y, a.z+b.z);}
//--------------------------------------------------------------------------------
Point3di operator++(Point3di a){return Point3di(a.x++, a.y++, a.z++);}
Point3di operator--(Point3di a){return Point3di(a.x--, a.y--, a.z--);}
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
This is where I use them:
#include "DarkGDK.h"
#include "gclass.h"
#include "image.h"
void DarkGDK(void)
{
dbSyncOn();
dbSyncRate(60);
Image obj(Point2di(0,0), "media/test.png", 0,0, false);
char* text;
Point2df p(0,0);
Point2df p2(10,10);
text = dbStr(p.x);
dbText(0,0,text);
text = dbStr(p.y);
dbText(2,2,text);
p += p2;
text = dbStr(p.x);
dbText(12,12,text);
text = dbStr(p.y);
dbText(14,14,text);
p -= p2;
text = dbStr(p.x);
dbText(16,16,text);
text = dbStr(p.y);
dbText(18,18,text);
while(LoopGDK()){
dbSync();
}
delete text;
return;
}
And for some reason it gives me this error:
------ Build started: Project: Dark GDK - Test Game, Configuration: Debug Win32 ------
Compiling...
gclass.cpp
Main.cpp
c:\documents and settings\tom\my documents\visual studio 2008\projects\project1\project1\dark gdk - test game\dark gdk - test game\main.cpp(19) : error C2676: binary '+=' : 'Point2df' does not define this operator or a conversion to a type acceptable to the predefined operator
c:\documents and settings\tom\my documents\visual studio 2008\projects\project1\project1\dark gdk - test game\dark gdk - test game\main.cpp(25) : error C2676: binary '-=' : 'Point2df' does not define this operator or a conversion to a type acceptable to the predefined operator
Generating Code...
Build log was saved at "file://c:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\Project1\Project1\Dark GDK - Test Game\Dark GDK - Test Game\Debug\BuildLog.htm"
Dark GDK - Test Game - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
??
#ifdef __NEWBIE__
MakeAnAwesomeGame(lots of badies, lots of guns, lots of stuff to do, BIG level)
#endif