I want to do several things with points and lines, so i need a few structs:
then this goes into a headerfile:
typedef struct point{
double x;
double y;
}POINT;
typedef struct normalPoint {
double px;
double py;
double pc;
}NORMALPOINT;
typedef struct pointDouble {
struct point p;
double angle;
}POINTDOUBLE;
typedef struct line{
struct point p1;
struct point p2;
struct normalPoint np;
double angle;
}LINE;and in the source file i can declare like this:struct point q1;//or POINT q1 etc
struct point q2;
struct point newPoint ; //used to get the reflectionPoint
struct point reflectPoint ; //used to get the reflectionPoint
struct point speedPoint ; //for the speed
struct line lineArray[10];
struct line firstLine;
and use it:
q1.x = 20.0;
q1.y = 30.0;
q2.x = 120.0;
q2.y = 130.0;
firstLine.p1 = q1;
firstLine.p1 = q2;
lineArray[0] = firstLine;
then i tested the sin by printing it on the ds screen and ran into trouble!
Bad trouble indeed! See next blog.
But this has nothing to do with the structs...
Good to know: ARM9 can work with doubles, ARM7 not!
To see if the double works, on the nds screen you have to print it as an int, multiplied, (for instance) by 1000....
iprintf(" test double %d", (int)(100*sin(.787878)));
Difference between C and C++ structs (and classes): see
http://carcino.gen.nz/tech/cpp/struct_vs_class.php