From: rellwood Newsgroups: comp.os.msdos.djgpp Subject: Re: Style AND speed in C++? How? Please, I need some radical ideas on this one! Date: 29 Apr 1997 11:56:35 -0700 Organization: University of Southern California, Los Angeles, CA Lines: 37 Sender: rellwood AT aludra DOT usc DOT edu Message-ID: References: <5ji1vt$51i AT info DOT service DOT rug DOT nl> NNTP-Posting-Host: aludra.usc.edu Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 --