Mail Archives: djgpp/1997/04/30/02:41:18
On Sat, 26 Apr 1997, D J Hampson wrote:
> The way I was going to do it was to have a screen mode class for whatever
> mode I'm in (just 320x200x256 to start with), with three private buffers
> (for triple-buffering), but a public reference to the current buffer to
> draw in. So it's just as quick as the best C equivalent for putpixel and
> getpixel, and I can write seperately whatever line drawing routine I
> want, but I can switch modes (VESA or whatever when I find out how it all
> works!) completely independantly of the rest.
>
> The screen mode class will do all the stuff like set up the screen
> interrupt code and find the most recently draw screen to chuck on
> 0xa0000.
>
> What I need to know (before I start on this daunting task), is whether
> all of this is in C++ 'tradition' or whether I'm going to run into
> trouble somewhere.
It sounds good to me. When I was first trying to teach myself C++, I did
something like this. If you just leave it at that, you shouldn't have a
problem. In my case, I wanted my other graphics classes to inherit the
capabilities of my screen class, but this was kind of dumb because each
time I created an object that inherited this base class, the screen would
be reset into graphics mode and a new set of screen buffer pointers would
be created. Still thinking that I wanted to keep the inheritance I did
all kinds of crazy things to make it work, such as add a static counter
that kept track of how many of its kind is in existance. The screen mode
would only be changed when the first is created or the last was deleted.
Needless to say, the whole thing got kind of yucky. My advice- keep it
simple, and if you want to add any inheritance make sure that you
understand the concept completely first and that you design the entire
object structure before sitting down at the computer.
-Richard Ellwood
--
- Raw text -