contrib/OWB: add correct SDL dependency, fix compilers used
[AROS-Contrib.git] / freetype1 / pascal / test / gdriver.pas
blob89432c9c12a4f8c9795d90f43e93d96b46886f66
1 (*******************************************************************
3 * gdriver : Graphics utility driver generic interface 1.1
5 * Generic interface for all drivers of the graphics utility used
6 * by the FreeType test programs.
8 * Copyright 1996 David Turner, Robert Wilhelm and Werner Lemberg.
10 * This file is part of the FreeType project, and may only be used
11 * modified and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
16 ******************************************************************)
18 Unit GDriver;
20 interface
22 uses GEvents, GMain;
24 (* Note that we now support an event based model, even with */
25 /* full-screen modes. It is the responsability of the driver */
26 /* to map its events to the TEvent structure when called */
27 /* through Get_Event *)
29 type
30 Event = record
31 what : GEvent; (* event class *)
32 info : Int; (* event parameter *)
33 end;
35 (* the event classes are defined in the file 'gevents.h' included *)
36 (* by the test programs, not by the graphics utility *)
38 procedure Get_Event( var ev : Event );
39 (* get last event. In full-screen modes, a key-stroke must be */
40 /* translated to an event class with a parameter. *)
42 function Driver_Set_Graphics( mode : Int ) : boolean;
43 (* A call to this function must set the graphics mode, the Vio *)
44 (* variable, as well as the values vio_ScanLineWidth, vio_Width *)
45 (* and vio_Height *)
47 function Driver_Restore_Mode : boolean;
48 (* Restore previous mode or release display buffer/window *)
50 procedure Driver_Display_Bitmap( var buff; line, col : Int );
51 (* Display bitmap on screen *)
53 implementation
55 {$IFDEF OS2}
57 uses Os2Base, CRT;
58 {$I GDRV_OS2.INC}
60 {$ELSE}
62 uses CRT;
63 {$I GDRV_DOS.INC}
65 {$ENDIF}
67 type
68 Translator = record
69 key : char;
70 ev_class : GEvent;
71 ev_info : Int;
72 end;
74 const
75 Num_Translators = 15;
77 Translators : array[1..Num_Translators] of Translator
78 = (
79 (key:#27; ev_class:event_Quit ; ev_info:0),
81 (key:'x'; ev_class: event_Rotate_Glyph; ev_info: -1),
82 (key:'c'; ev_class: event_Rotate_Glyph; ev_info: 1),
83 (key:'v'; ev_class: event_Rotate_Glyph; ev_info: -16),
84 (key:'b'; ev_class: event_Rotate_Glyph; ev_info: 16),
86 (key:'9'; ev_class: event_Change_Glyph; ev_info:-100),
87 (key:'0'; ev_class: event_Change_Glyph; ev_info: 100),
88 (key:'i'; ev_class: event_Change_Glyph; ev_info: -10),
89 (key:'o'; ev_class: event_Change_Glyph; ev_info: 10),
90 (key:'k'; ev_class: event_Change_Glyph; ev_info: -1),
91 (key:'l'; ev_class: event_Change_Glyph; ev_info: 1),
93 (key:'+'; ev_class: event_Scale_Glyph; ev_info: 10),
94 (key:'-'; ev_class: event_Scale_Glyph; ev_info: -10),
95 (key:'u'; ev_class: event_Scale_Glyph; ev_info: 1),
96 (key:'j'; ev_class: event_Scale_Glyph; ev_info: -1)
99 procedure Get_Event( var ev : Event );
101 i : Int;
102 c : char;
103 begin
104 c := ReadKey;
106 for i := 1 to Num_Translators do
107 begin
108 if c = translators[i].key then
109 begin
110 ev.what := translators[i].ev_class;
111 ev.info := translators[i].ev_info;
112 exit;
113 end;
114 end;
116 (* unrecognized keystroke *)
118 ev.what := event_Keyboard;
119 ev.info := Int(c);
120 end;
122 end.