-
POINT conversion
Hi,
I've been trying to assign the x and y values of POINT structure to a vertex.
Code:
struct vertex
{
double x, y, z;
vertex()
{
x=0;y=0;z=0;
}
};
Code:
POINT MousePt;
static vertex pointArray[1000];
static POINT ptArray[1000];
Code:
case WM_LBUTTONDOWN:
{
MousePt.x = LOWORD (lParam) ;
MousePt.y = HIWORD (lParam) ;
ptArray[numPoints++]=MousePt;
pointArray[numPoints].x=ptArray[numPoints].x;//??????
pointArray[numPoints].y=ptArray[numPoints].y;//?????
The last 2 lines do not seem to be assigning values.
-
I feel like this may have to do with this 'numPoints' character. Where's that rascal defined.
-
there is nothing wrong with "numpoints".
-
Try making x,y,z to be integers instead of double. I'm totaly guessing, because I'm really tired =(. However, it might work, because you're having implicit casting.
-
If numPoints is defined inside your windowprocedure then it will be reset to 0 every time it is called (recieves a message), so you will have to define it in some other way like making it static (using the modifier or making it global).