Hi,
Let me start at the beginning, the general idea is to create a dll wich holds classes that in turn are building blocks for all kinds of boardgames. That's the general plan anyway.
Here is my thinking path, feel free to correct me if you think I should take another route.
- The board
I was thinking of using the Windows form as a board, using the override onPaint method to draw all kinds of boards. So my question naturally is, is it a good idea to use the windows form as a class I can inherit from to creating all kind of boards?
- The pieces on the board
Is it a good idea to inherit from the base class Control to create all kinds of pieces on the gameboard (form)?
I have tried the above approach for the pieces but when inheriting from the control class, when I create an object, this object has loads of properties attached to it wich I don't really need. What would be a better way to go about doing this and create a gamepiece object with only the proprties attached to it that I have written. This also applies to the board (form), is there a way to only have my own written properties attached to the form?
The reason I ask these questions is that I would like a good starting point form my little project. A good start goes a long way, as they always say. If I posted this in the wrong section I apologize, I didn't really see any other section to post this in. Also you might have guessed I'm a novice at not using not predefined controls and objects. If you grasp my meaning...
I found the title not really on the subject, so I changed it
Edwin BlommaertsPosted Jun 8, 2007, 11:41 AM
Ah, nice, then I wasn't wrong. Your advice/help confirmed my believes, thank you very much... Also I keep getting baffeld by the speed at wich one gets answers on this forum !!! Keep up the good work.
Mike GoldPosted Jun 7, 2007, 6:46 PM
2. No. I wouldn't create a control as a board piece. It's unnecessary, Paint the pieces yourself. You should intercept all mousemove and mouse down events, and mouse up events to determine how the pieces should behave. Your board pieces can be classes, each with there own draw method. The board itself can also be a class with a draw method. But ultimately, you would call the Draw method inside OnPaint of the form. The design actually is a bit more complex. You'll want to create state engines for each event so you can determine what happens to each piece depending on it's state. For example if you mousedown on a piece, then you'll want to track it's movement to simulate drag-drop.
You may want to consider using XNA to do your board game. It has a lot of built in objects for controlling your drawing.
If you go the Windows.Forms route, however, you'll want to use GDI+.
Hope this helps.