Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Grid with clickable squares

Author
Message
Makani47
14
Years of Service
User Offline
Joined: 25th Nov 2009
Location:
Posted: 25th Nov 2009 18:07
I have to incorporate DarkGDK into Conway's game of life using C++. I've never used DarkGDK before, but my professor wants it done this way. My friend showed me the basics however. I have a working version of Life, but it's with just the standard C++. You have to type in the coordinates of the cells you want. I need a grid on the screen where when you click on a cell, it will either turn black or white. As the game runs, those cells will need to change from white and black. How can I go about making such a grid with DarkGDK?
Paynterboi TicTacToe
16
Years of Service
User Offline
Joined: 23rd Dec 2007
Location: That one place
Posted: 25th Nov 2009 20:11 Edited at: 25th Nov 2009 20:14
1) Use a sprite for your cursor instead of the regular cursor
2) use 3 images ( blank cell, black cell, white cell )
3) test for collision



This is psuedo code, you will have to make SEVERAL alterations I just wanted to outline a method for creating images on the screen that you can click and alter. If you have any questions just ask and i will explain more. I will not do your homework for you though

EYE R T3H +ick +ack +oe mester
Makani47
14
Years of Service
User Offline
Joined: 25th Nov 2009
Location:
Posted: 25th Nov 2009 21:36
Thanks, that does help. I already had a working version that uses a matrix. So, my plan is to have it, so when you click on a cell in the grid, it will mark that same spot in my matrix as alive or dead. Then when the program runs, it will go through the matrix and change the grid on the screen to either white or black depending on what is in the location of the matrix.

In other words, if the user clicks in the top left cell of the rid, matrix[1][1] gets set to alive.

Login to post a reply

Server time is: 2024-11-24 17:38:40
Your offset time is: 2024-11-24 17:38:40