inigraph1.pp 910 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. Program inigraph1;
  2. { Program to demonstrate static graphics mode selection }
  3. uses graph;
  4. const
  5. TheLine = 'We are now in 640 x 480 x 256 colors!'+
  6. ' (press <Return> to continue)';
  7. var
  8. gd, gm, lo, hi, error,tw,th: integer;
  9. found: boolean;
  10. begin
  11. { We want an 8 bit mode }
  12. gd := D8bit;
  13. gm := m640x480;
  14. initgraph(gd,gm,'');
  15. { Make sure you always check graphresult! }
  16. error := graphResult;
  17. if (error <> grOk) Then
  18. begin
  19. writeln('640x480x256 is not supported!');
  20. halt(1)
  21. end;
  22. { We are now in 640x480x256 }
  23. setColor(cyan);
  24. rectangle(0,0,getmaxx,getmaxy);
  25. { Write a nice message in the center of the screen }
  26. setTextStyle(defaultFont,horizDir,1);
  27. tw:=TextWidth(TheLine);
  28. th:=TextHeight(TheLine);
  29. outTextXY((getMaxX - TW) div 2,
  30. (getMaxY - TH) div 2,TheLine);
  31. { Wait for return }
  32. readln;
  33. { Back to text mode }
  34. closegraph;
  35. end.