www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/30/02:41:18

From: rellwood <rellwood AT aludra DOT usc DOT edu>
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: <Pine.SV4.3.94.970429114303.6728E-100000@aludra.usc.edu>
References: <c=GB%a=_%p=Indigo_Active_Vi%l=CRIANLARICH-970421130655Z-367 AT crianlarich DOT Indigo> <5ji1vt$51i AT info DOT service DOT rug DOT nl> <E99Cn8 DOT J2u DOT C DOT amo AT bath DOT ac DOT uk>
NNTP-Posting-Host: aludra.usc.edu
Mime-Version: 1.0
In-Reply-To: <E99Cn8.J2u.C.amo@bath.ac.uk>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019