3
{ Program to demonstrate dynamic graphics mode selection }
8
TheLine = 'We are now in 640 x 480 x 256 colors!'+
9
' (press <Return> to continue)';
12
th,tw,gd, gm, lo, hi, error: integer;
16
{ We want an 8 bit mode }
18
{ Get all available resolutions for this bitdepth }
19
getmoderange(gd,lo,hi);
20
{ If the highest available mode number is -1,
21
no resolutions are supported for this bitdepth }
24
writeln('no 8 bit modes supported!');
28
{ Search all resolutions for 640x480 }
32
{ Make sure you always check graphresult! }
35
(getmaxx = 639) and (getmaxy = 479) then
44
writeln('640x480x256 is not supported!');
47
{ We are now in 640x480x256 }
49
rectangle(0,0,getmaxx,getmaxy);
50
{ Write a nice message in the center of the screen }
51
setTextStyle(defaultFont,horizDir,1);
52
TW:=TextWidth(TheLine);
53
TH:=TextHeight(TheLine);
54
outTextXY((getMaxX - TW) div 2,
55
(getMaxY - TH) div 2,TheLine);