requestmodeid.pas 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. Program RequestModeID;
  2. { ***********************************************************************
  3. * This is example shows how to use p96RequestModeIDTagList()
  4. *
  5. * tabt (Sat Dec 28 03:44:35 1996)
  6. *********************************************************************** }
  7. {
  8. Translated to fpc pascal.
  9. 3 Mars 2001.
  10. Updated for fpc 1.0.7
  11. 08 Jan 2003.
  12. [email protected]
  13. }
  14. uses exec, amigados, agraphics, intuition, picasso96api, utility;
  15. Const
  16. template : pchar = 'Width=W/N,Height=H/N,Depth=D/N';
  17. vecarray : Array[0..2] of longint = (0,0,0);
  18. Var
  19. width,
  20. height,
  21. depth,
  22. DisplayID : longint;
  23. dim : tDimensionInfo;
  24. rda : pRDArgs;
  25. Begin
  26. if not Assigned(P96Base) then
  27. begin
  28. writeln('Cannot open ', PICASSO96APINAME);
  29. Halt(5);
  30. end;
  31. width:=640;
  32. height:=480;
  33. depth:=15;
  34. rda:=ReadArgs (template,@vecarray,Nil);
  35. If rda<>Nil Then Begin
  36. If vecarray[0] <> 0 then width := long(@vecarray[0]);
  37. If vecarray[1] <> 0 then height := long(@vecarray[1]);
  38. If vecarray[2] <> 0 then depth := long(@vecarray[2]);
  39. FreeArgs(rda);
  40. End;
  41. DisplayID := p96RequestModeIDTags([P96MA_MinWidth, width,
  42. P96MA_MinHeight, height,
  43. P96MA_MinDepth, depth,
  44. P96MA_WindowTitle, AsTag('RequestModeID Test'),
  45. P96MA_FormatsAllowed, (RGBFF_CLUT or RGBFF_R5G6B5 or RGBFF_R8G8B8 or RGBFF_A8R8G8B8),
  46. TAG_DONE]);
  47. Writeln ('DisplayID:', hexstr(DisplayID,8));
  48. If DisplayID <> INVALID_ID Then Begin
  49. If GetDisplayInfoData(Nil, @dim ,SizeOf(tDimensionInfo),DTAG_DIMS,DisplayID) <> 0 Then
  50. Writeln('Dimensions: ',dim.Nominal.MaxX-dim.Nominal.MinX+1,'x',dim.Nominal.MaxY-dim.Nominal.MinY+1,'x',dim.MaxDepth)
  51. Else
  52. Writeln('No Dimensioninfo.');
  53. End Else Writeln('DisplayID invalid.');
  54. End.