News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Connect the dots

Started by terb, March 29, 2009, 08:45:56 PM

Previous topic - Next topic

terb

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 :)

baltoro

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
Baltoro

donkey

For random dots you can use a mersenne twister 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.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable