|
Author Topic:   New data types?
DarkFrog
Member
posted December 08, 1999 12:53 AM            
I was just wondering if there is some way to "create" a new data type (mainly because I don't know of any types that are 3 bytes), and if there is no way, then how do I make linear buffers for 24-bit color???

IP:

MarkBatten
Member
posted December 08, 1999 08:48 AM            
Try this:

struct RGB{
char r;
char g;
char b;
}
typedef struct RGB myColor;

Now you can use "myColor" as a type in the way you describe.

IP:

DarkFrog
Member
posted December 08, 1999 07:40 PM            
THanks, it at least compiles (although you missed a ;, but no biggie) I'm going to try it out...

IP:

DarkFrog
Member
posted December 09, 1999 01:37 AM            
Well, upon trying over and over, I can't get 24-bit color working with BackBuffer (the program crashes presto-chango. And I'm not even writing to the buffer...

IP:

Torval
New Member
posted December 10, 1999 07:18 AM            
If you want this to be a true 3 byte data structure you also have to remember to set the structure padding to 1. I don't the exact syntax, but look up #pragma pack

IP: