-
Notifications
You must be signed in to change notification settings - Fork 0
/
CityFace.ppr
71 lines (55 loc) · 1.26 KB
/
CityFace.ppr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
program CityFace;
uses
SysUtils,
SDL,
MainUnit;
{
procedure HandleException(E: Exception);
var
MBText, MBCaption: String;
begin
MBText := E.Message;
MBCaption := E.ClassName;
MessageBox(0, PChar(MBText), PChar(MBCaption), MB_ICONEXCLAMATION);
MBText := '';
MBCaption := '';
end;
}
procedure HandleException(E: Exception);
begin
WriteLn(E.ClassName + ': ' + E.Message);
end;
begin
try
FirstInit;
if SDL_Init(GetSDLFlags) < 0 then
WriteLn('SDL_Init failed.')
else try
SDL_ShowCursor(SDL_DISABLE);
//Set minimums for OpenGL.
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); //Try to force same video mode as my desktop.
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, SDL_ENABLE);
Screen := SDL_SetVideoMode(0, 0, 0, SDL_OPENGL or SDL_NOFRAME or SDL_FULLSCREEN);
if Screen = nil then begin
WriteLn('SDL_SetVideoMode failed.');
Exit;
end;
InitGame;
LastTime := SDL_GetTicks;
repeat
DoPhysics(DoTime);
DoGraphics;
until Done;
CleanupGame;
finally
SDL_ShowCursor(SDL_ENABLE);
SDL_FreeSurface(Screen);
SDL_Quit;
end;
except
on E: Exception do HandleException(E);
end;
end.