Hey guys
If the is the wrong section, please move topic :)
I've haven't been coding in MASM for quite a while due to real life issue, but lately I have started my old hobby again. Anyway, I have decided to code a connect the dot type application. Yes, I know its a silly thing, but its basicly just to get some graphic aspects in the right place in my head.
My idea was to either let the pc generate random dots or let the user place a certain amount on the screen. Then the user simply has to connect the dots, for example within a certain time.
My questions are these:
- What would be the simplest way to generate the dots ? Using a bmp and then generate them as a buttons ? Or this there another way to do this ?
- What would be the smartest way to identify the dots ? An array of structs or ?
- I would like to be able to connect the dots, but how to be certain the all dots are connected ? And also how do I detect the line and the dot collision ?
Hope there's someone out the that call guide me in the right direction. Thanks in advance :)
If you don't want to save the "silly" image, and you want to display everything in a window, the simplest way would be to let the user select the dot position with a mouse click. There is a Windows API that does exactly that, and you call it with the invoke syntax.
This might prove helpful: http://msdn.microsoft.com/en-us/library/ms645602(VS.85).aspx
For random dots you can use a mersenne twister (http://www.masm32.com/board/index.php?topic=10088.0) to set the x and y coordinates of the dot, just set the maximum value to the width and height of the window client area. You can use SetPixel to draw the dot and WM_LBUTTONDOWN to find out if the user has clicked on a dot (just check the color of the pixel at the mouse coordinates with GetPixel). To draw the line between the dots use LineTo.