2
0

modrange.pp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Program GetModeRange_Example;
  2. { This program demonstrates how to find all available graph modes }
  3. uses graph;
  4. const
  5. { Currently, only 4, 8, 15 and 16 bit modes are supported
  6. but this may change in the future }
  7. gdnames: array[D4bit..D16bit] of string[6] =
  8. ('4 bit','6 bit','8 bit','12 bit','15 bit','16 bit');
  9. var
  10. t: text;
  11. line : string;
  12. gd, c, low, high, res: integer;
  13. begin
  14. assign(t,'modes.txt');
  15. rewrite(t);
  16. close(t);
  17. for gd := D4bit to D16bit do
  18. begin
  19. { Get the available mode numbers for this driver }
  20. getModeRange(gd,low,high);
  21. append(t);
  22. write(t,gdnames[gd]);
  23. Writeln(t,': low modenr = ',low,', high modenr = ',high);
  24. close(t);
  25. { If high is -1,
  26. no resolutions are supported for this bitdepth }
  27. if high = -1 then
  28. begin
  29. append(t);
  30. writeln(t,' No modes supported!');
  31. writeln(t);
  32. close(t);
  33. end
  34. else
  35. { Enter all supported resolutions for this bitdepth
  36. and write their characteristics to the file }
  37. for c := low to high do
  38. begin
  39. append(t);
  40. writeln(t,' testing mode nr ',c);
  41. close(t);
  42. initgraph(gd,c,'');
  43. res := graphresult;
  44. append(t);
  45. { An error occurred when entering the mode? }
  46. if res <> grok then
  47. writeln(t,grapherrormsg(res))
  48. else
  49. begin
  50. write(t,'maxx: ',getmaxx,', maxy: ',getmaxy);
  51. Writeln(t,', maxcolor: ',getmaxcolor);
  52. closegraph;
  53. end;
  54. writeln(t);
  55. close(t);
  56. end;
  57. append(t);
  58. writeln(t);
  59. close(t);
  60. end;
  61. Writeln('All supported modes are listed in modes.txt files');
  62. end.