video.inc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. procedure GetVideoMode(var Mode: TVideoMode);
  12. begin
  13. Mode.Col := ScreenWidth;
  14. Mode.Row := ScreenHeight;
  15. Mode.Color := ScreenColor;
  16. end;
  17. procedure SetVideoMode(Mode: TVideoMode);
  18. var
  19. P: PVideoModeList;
  20. begin
  21. P := Modes;
  22. while (P<>Nil) and ((P^.Row <> Mode.Row) or (P^.Col <> Mode.Col) or (P^.Color<>Mode.Color)) do
  23. P := P^.Next;
  24. if P <> nil then begin
  25. DoneVideo;
  26. ScreenWidth:=$ffff;
  27. ScreenHeight:=$ffff;
  28. P^.VideoModeSelector(PVideoMode(P)^, P^.Params);
  29. InitVideo;
  30. end
  31. else begin
  32. ErrorHandler(errVioNoSuchMode, @Mode);
  33. end;
  34. end;
  35. procedure RegisterVideoMode(Col, Row: Word; Color: Boolean; VideoModeSelector: TVideoModeSelector; Params: Longint);
  36. var
  37. P: PVideoModeList;
  38. begin
  39. New(P);
  40. P^.Col := Col;
  41. P^.Row := Row;
  42. P^.Color := Color;
  43. P^.VideoModeSelector := VideoModeSelector;
  44. P^.Params := Params;
  45. P^.Next := Modes;
  46. Modes := P;
  47. end;
  48. procedure UnRegisterVideoModes;
  49. var
  50. P: PVideoModeList;
  51. begin
  52. while assigned(modes) do
  53. begin
  54. p:=modes;
  55. modes:=modes^.next;
  56. dispose(p);
  57. end;
  58. end;
  59. function DefaultErrorHandler(AErrorCode: Longint; AErrorInfo: Pointer): TErrorHandlerReturnValue;
  60. begin
  61. ErrorCode := AErrorCode;
  62. ErrorInfo := AErrorInfo;
  63. DefaultErrorHandler := errAbort; { return error code }
  64. end;
  65. {
  66. $Log$
  67. Revision 1.1 2001-01-13 11:13:12 peter
  68. * API 2 RTL
  69. }