POINT conversion

This is a discussion on POINT conversion within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I've been trying to assign the x and y values of POINT structure to a vertex. Code: struct vertex ...

  1. #1
    eat my shorts!
    Join Date
    Apr 2002
    Posts
    294

    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.
    Games Reviews Previews Desktop Themes Downloads Paintball Forums Shareware Freeware and much more

    The best in Technology and Gaming News

    www.back2games.com

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    I feel like this may have to do with this 'numPoints' character. Where's that rascal defined.

  3. #3
    eat my shorts!
    Join Date
    Apr 2002
    Posts
    294
    there is nothing wrong with "numpoints".
    Code:
    int numPoints= 0;
    Games Reviews Previews Desktop Themes Downloads Paintball Forums Shareware Freeware and much more

    The best in Technology and Gaming News

    www.back2games.com

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    30
    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.

  5. #5
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    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).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dots versus pixels and pixel to postscript point conversion
    By stanlvw in forum Windows Programming
    Replies: 3
    Last Post: 08-01-2008, 05:17 PM
  2. rotating around object (looat)
    By jabka in forum Game Programming
    Replies: 13
    Last Post: 06-18-2008, 06:02 PM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  4. Floating point conversion
    By rkooij in forum C Programming
    Replies: 9
    Last Post: 08-29-2006, 02:41 AM
  5. Do I have a scanf problem?
    By AQWst in forum C Programming
    Replies: 2
    Last Post: 11-26-2004, 06:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21