Hi all,
I'm after some advice on how to do some things.
I've made plenty of classes in my time, but never a visual one. I'm making an RPG type game, and I want to make a visual object that contains many other visual components, sorta like a a TPanel - this will be for a Character Display for stats, items, etc. When I say Character, I'm referring to a game Hero, if you like, rather than 1 byte of a string.
In addition to this, the visual component will be linked to the non-visual object that actually contains all of the fields, records and lists for that Character. I thought this was best rather than storing everything in the visual object, because then I can have 6 or 10 characters but only one or two displayed on the screen, and changing which character is displayed is as easy as changing the reference to the non-visual object in the visual object. Make sense?
The problem I've got with this approach is synchronising the visual Character object with it's non-visual object. I'm thinking of keeping an Integer field in each object, and I'll increment it in the non-visual object when anything get's changed, and the visual object will see this and update everything.
Can anyone offer me some advice or thoughts on how they would go about doing something like this?
I'm after some advice on how to do some things.
I've made plenty of classes in my time, but never a visual one. I'm making an RPG type game, and I want to make a visual object that contains many other visual components, sorta like a a TPanel - this will be for a Character Display for stats, items, etc. When I say Character, I'm referring to a game Hero, if you like, rather than 1 byte of a string.
In addition to this, the visual component will be linked to the non-visual object that actually contains all of the fields, records and lists for that Character. I thought this was best rather than storing everything in the visual object, because then I can have 6 or 10 characters but only one or two displayed on the screen, and changing which character is displayed is as easy as changing the reference to the non-visual object in the visual object. Make sense?
The problem I've got with this approach is synchronising the visual Character object with it's non-visual object. I'm thinking of keeping an Integer field in each object, and I'll increment it in the non-visual object when anything get's changed, and the visual object will see this and update everything.
Can anyone offer me some advice or thoughts on how they would go about doing something like this?