23 |
23 |
24 uses SDLh, uConsts, GLunit, uTypes; |
24 uses SDLh, uConsts, GLunit, uTypes; |
25 |
25 |
26 |
26 |
27 procedure movecursor(dx, dy: LongInt); |
27 procedure movecursor(dx, dy: LongInt); |
28 (* |
|
29 procedure AdjustColor(var Color: Longword); |
|
30 procedure SetKB(n: Longword); |
|
31 *) |
|
32 procedure SendKB; |
|
33 procedure SendStat(sit: TStatInfoType; s: shortstring); |
|
34 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
28 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
35 procedure OutError(Msg: shortstring; isFatalError: boolean); |
29 procedure OutError(Msg: shortstring; isFatalError: boolean); |
36 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; |
30 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; |
37 procedure SDLTry(Assert: boolean; isFatal: boolean); |
31 procedure SDLTry(Assert: boolean; isFatal: boolean); |
38 procedure MakeScreenshot(filename: shortstring); |
32 procedure MakeScreenshot(filename: shortstring); |
39 |
33 |
40 procedure initModule; |
34 procedure initModule; |
41 procedure freeModule; |
35 procedure freeModule; |
42 |
36 |
43 implementation |
37 implementation |
44 uses uConsole, uIO, typinfo, sysutils, uVariables, uUtils; |
38 uses uConsole, uIO, typinfo, sysutils, uVariables; |
45 |
|
46 var KBnum: Longword; |
|
47 |
|
48 |
39 |
49 procedure movecursor(dx, dy: LongInt); |
40 procedure movecursor(dx, dy: LongInt); |
50 var x, y: LongInt; |
41 var x, y: LongInt; |
51 begin |
42 begin |
52 if (dx = 0) and (dy = 0) then exit; |
43 if (dx = 0) and (dy = 0) then exit; |
78 |
69 |
79 procedure SDLTry(Assert: boolean; isFatal: boolean); |
70 procedure SDLTry(Assert: boolean; isFatal: boolean); |
80 begin |
71 begin |
81 if not Assert then OutError(SDL_GetError, isFatal) |
72 if not Assert then OutError(SDL_GetError, isFatal) |
82 end; |
73 end; |
83 |
|
84 (* |
|
85 procedure AdjustColor(var Color: Longword); |
|
86 begin |
|
87 Color:= SDL_MapRGB(PixelFormat, (Color shr 16) and $FF, (Color shr 8) and $FF, Color and $FF) |
|
88 end; |
|
89 |
|
90 procedure SetKB(n: Longword); |
|
91 begin |
|
92 KBnum:= n |
|
93 end; |
|
94 *) |
|
95 |
|
96 |
|
97 procedure SendKB; |
|
98 var s: shortstring; |
|
99 begin |
|
100 if KBnum <> 0 then |
|
101 begin |
|
102 s:= 'K' + inttostr(KBnum); |
|
103 SendIPCRaw(@s, Length(s) + 1) |
|
104 end |
|
105 end; |
|
106 |
|
107 procedure SendStat(sit: TStatInfoType; s: shortstring); |
|
108 const stc: array [TStatInfoType] of char = 'rDkKHTPsSB'; |
|
109 var buf: shortstring; |
|
110 begin |
|
111 buf:= 'i' + stc[sit] + s; |
|
112 SendIPCRaw(@buf[0], length(buf) + 1) |
|
113 end; |
|
114 |
|
115 |
74 |
116 procedure MakeScreenshot(filename: shortstring); |
75 procedure MakeScreenshot(filename: shortstring); |
117 var p: Pointer; |
76 var p: Pointer; |
118 size: Longword; |
77 size: Longword; |
119 f: file; |
78 f: file; |