Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - arthropod_example

Pages: [1]
1
General / Re: Help with general design
« on: September 23, 2014, 05:01:31 pm »
Thank you all for all the ideas, they are enough to keep me busy thinking and researching for a while!

That book also sounds like exactly what I need   :D


2
General / Help with general design
« on: September 23, 2014, 03:21:43 am »
Hello!

I have been trying to learn C++ (reading recommended books and making simple programs) for some time and decided it would be nice to try and use a graphics library to have a bit more fun than just making console programs. Users from another forum recommended SFML. I saw some tutorials and then started looking at the documentation. So far I've been having a lot of fun!

I've made a simple game (using Conway's Game of Life rules) that basically consists of a grid of cells (each having state 0 or 1) and some random buttons for random effects. It worked!
(click to show/hide)

But considering my inexperience with design this has been very challenging. So I would like to ask some design advice.

At first I created a Grid class that handled the cell grid behavior.
Then I created a clickable Button class to handle whatever random effects the user decides to apply to the screen or the grid.
It all worked. But in order for it to work, I had to pass my game Window and my Grid as a parameter to each Button instance.

Then I created a Game class that contained the Buttons, the Grid and the Window (and some default initialization options to unclutter my main() ). I was trying to encapsulate things or something.

In some way or another I felt the Buttons had to get access to a lot of stuff. Maybe more than they should? How would you guys generally handle this kind of situation from a design perspective?

Thanks in advance!

Also if you could recommend any book where this kind of topic is addressed it would be really appreciated!

If this post does not conform to the standards please let me know since it is my first post in this forum.

Pages: [1]