home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Panoráma
/
computer_panorama_1997-12-hibas.iso
/
SHARE
/
GRAPH
/
PTC051.ZIP
/
EXAMPLES
/
MODELIST.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-09-03
|
3KB
|
102 lines
//////////////////////////
// ptc modelist example //
//////////////////////////
#include "ptc.h"
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
int main()
{
// initialize ptc
PTC ptc;
// get list of ptc modes
List<MODE> list;
ptc.GetModeList(list);
// print information
cout << "PTC modelist:\n\n";
// output mode information
Iterator<MODE> iterator(list);
MODE *mode=iterator.first();
while (mode)
{
// print mode interface name
cout << setw(11) << mode->i;
// print resolution and bits per pixel
cout << " "
<< setw(4) << mode->x
<< " x "
<< setiosflags(ios::left)
<< setw(4) << mode->y
<< resetiosflags(ios::left);
// print bits per pixel
cout << " " << setw(2) << mode->format.bits << "bit";
// print format id
cout << " " << setw(10);
switch (mode->format.id)
{
case ARGB8888: cout << "ARGB8888"; break;
case ABGR8888: cout << "ABGR8888"; break;
case BGRA8888: cout << "BGRA8888"; break;
case RGBA8888: cout << "RGBA8888"; break;
case RGB888: cout << "RGB888"; break;
case BGR888: cout << "BGR888"; break;
case RGB565: cout << "RGB565"; break;
case BGR565: cout << "BGR565"; break;
case ARGB1555: cout << "ARGB1555"; break;
case ABGR1555: cout << "ABGR1555"; break;
case INDEX8: cout << "INDEX8"; break;
case FAKEMODE1A: cout << "FAKEMODE1A"; break;
case FAKEMODE1B: cout << "FAKEMODE1B"; break;
case FAKEMODE1C: cout << "FAKEMODE1C"; break;
case FAKEMODE2A: cout << "FAKEMODE2A"; break;
case FAKEMODE2B: cout << "FAKEMODE2B"; break;
case FAKEMODE2C: cout << "FAKEMODE2C"; break;
case FAKEMODE3A: cout << "FAKEMODE3A"; break;
case FAKEMODE3B: cout << "FAKEMODE3B"; break;
case FAKEMODE3C: cout << "FAKEMODE3C"; break;
case GREY8: cout << "GREY8"; break;
case RGB332: cout << "RGB332"; break;
default: cout << "(custom)";
}
// print format type
cout << " " << setw(9);
switch (mode->format.type)
{
case DIRECT: cout << "DIRECT"; break;
case INDEXED: cout << "INDEXED"; break;
case FAKEMODE: cout << "FAKEMODE"; break;
default: cout << "(unknown)";
}
// print mode layout
cout << " " << setw(8);
if (mode->layout==LINEAR) cout << "LINEAR";
else if (mode->layout==BANKED) cout << "BANKED";
else if (mode->layout==FAKEMODE) cout << "FAKEMODE";
else cout << "(unknown)";
// print mode output
cout << " " << setw(10);
if (mode->output==WINDOWED) cout << "WINDOWED";
else if (mode->output==FULLSCREEN) cout << "FULLSCREEN";
else cout << " ";
cout << "\n";
// go to next mode in the list
mode=iterator.next();
}
return 0;
}