equal
deleted
inserted
replaced
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 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
28 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
29 procedure OutError(Msg: shortstring; isFatalError: boolean); |
|
30 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; |
|
31 procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
32 procedure MakeScreenshot(filename: shortstring); |
29 procedure MakeScreenshot(filename: shortstring); |
33 |
30 |
34 procedure initModule; |
31 procedure initModule; |
35 procedure freeModule; |
32 procedure freeModule; |
36 |
33 |
37 implementation |
34 implementation |
38 uses uConsole, uIO, typinfo, sysutils, uVariables; |
35 uses typinfo, sysutils, uVariables; |
39 |
36 |
40 procedure movecursor(dx, dy: LongInt); |
37 procedure movecursor(dx, dy: LongInt); |
41 var x, y: LongInt; |
38 var x, y: LongInt; |
42 begin |
39 begin |
43 if (dx = 0) and (dy = 0) then exit; |
40 if (dx = 0) and (dy = 0) then exit; |
46 Inc(x, dx); |
43 Inc(x, dx); |
47 Inc(y, dy); |
44 Inc(y, dy); |
48 SDL_WarpMouse(x, y); |
45 SDL_WarpMouse(x, y); |
49 end; |
46 end; |
50 |
47 |
51 |
|
52 procedure OutError(Msg: shortstring; isFatalError: boolean); |
|
53 begin |
|
54 // obsolete? written in WriteLnToConsole() anyway |
|
55 // {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF} |
|
56 WriteLnToConsole(Msg); |
|
57 if isFatalError then |
|
58 begin |
|
59 SendIPC('E' + GetLastConsoleLine); |
|
60 SDL_Quit; |
|
61 halt(1) |
|
62 end |
|
63 end; |
|
64 |
|
65 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); |
|
66 begin |
|
67 if not Assert then OutError(Msg, isFatal) |
|
68 end; |
|
69 |
|
70 procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
71 begin |
|
72 if not Assert then OutError(SDL_GetError, isFatal) |
|
73 end; |
|
74 |
48 |
75 procedure MakeScreenshot(filename: shortstring); |
49 procedure MakeScreenshot(filename: shortstring); |
76 var p: Pointer; |
50 var p: Pointer; |
77 size: Longword; |
51 size: Longword; |
78 f: file; |
52 f: file; |