File: CastleWindow.TCastleApplication.html

package info (click to toggle)
castle-game-engine 5.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 185,428 kB
  • sloc: pascal: 260,781; cpp: 1,363; objc: 713; makefile: 537; xml: 496; sh: 480; php: 4
file content (526 lines) | stat: -rw-r--r-- 37,776 bytes parent folder | download
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: CastleWindow: Class TCastleApplication</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<a name="TCastleApplication"></a><h1 class="cio">Class TCastleApplication</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></td><td><a class="section" href="#PasDoc-Fields">Fields</a></td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td><a class="section" href="#PasDoc-Properties">Properties</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a  href="CastleWindow.html">CastleWindow</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TCastleApplication = class(TComponent)</code></p>
<h2 class="description">Description</h2>
<p>
Application, managing all open <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> (OpenGL windows). This tracks all open instances of <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> and implements message loop. It also handles some global tasks like managing the screen (changing current screen resolution and/or bit depth etc.)

<p>The only instance of this class should be in <a class="normal" href="CastleWindow.html#Application">Application</a> variable. Don't create any other instances of class <code>TCastleApplication</code>, there's no point in doing that.</p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TComponent</li>
<li class="thisitem">TCastleApplication</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Fields"></a><h3 class="summary">Fields</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code><b><a  href="CastleWindow.TCastleApplication.html#VideoResize">VideoResize</a></b>: boolean;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code><b><a  href="CastleWindow.TCastleApplication.html#VideoResizeWidth">VideoResizeWidth</a></b>: integer;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code><b><a  href="CastleWindow.TCastleApplication.html#VideoResizeheight">VideoResizeheight</a></b>: integer;</code></td>
</tr>
</table>
<a name="PasDoc-Methods"></a><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleWindow.TCastleApplication.html#Notification">Notification</a></b>(AComponent: TComponent; Operation: TOperation); override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#VideoSettingsDescribe">VideoSettingsDescribe</a></b>: string;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#TryVideoChange">TryVideoChange</a></b>: boolean;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleWindow.TCastleApplication.html#VideoChange">VideoChange</a></b>(OnErrorWarnUserAndContinue: boolean);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleWindow.TCastleApplication.html#VideoReset">VideoReset</a></b>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#ScreenHeight">ScreenHeight</a></b>: integer;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#ScreenWidth">ScreenWidth</a></b>: integer;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#OpenWindowsCount">OpenWindowsCount</a></b>: integer;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#ProcessMessage">ProcessMessage</a></b>(WaitForMessage, WaitToLimitFPS: boolean): boolean;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#ProcessAllMessages">ProcessAllMessages</a></b>: boolean;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleWindow.TCastleApplication.html#Quit">Quit</a></b>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleWindow.TCastleApplication.html#Run">Run</a></b>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleWindow.TCastleApplication.html#BackendName">BackendName</a></b>: string;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a  href="CastleWindow.TCastleApplication.html#Create">Create</a></b>(AOwner: TComponent); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>destructor <b><a  href="CastleWindow.TCastleApplication.html#Destroy">Destroy</a></b>; override;</code></td>
</tr>
</table>
<a name="PasDoc-Properties"></a><h3 class="summary">Properties</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#XDisplayName">XDisplayName</a></b>: string read FXDisplayName write FXDisplayName;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#VideoColorBits">VideoColorBits</a></b>: integer read FVideoColorBits write FVideoColorBits default 0;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#VideoFrequency">VideoFrequency</a></b>: Cardinal read FVideoFrequency write FVideoFrequency default 0;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#OpenWindows">OpenWindows</a></b>[Index:integer]: <a  href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> read GetOpenWindows;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#OnInitialize">OnInitialize</a></b>: TProcedure read FOnInitialize write FOnInitialize;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#OnUpdate">OnUpdate</a></b>: <a  href="CastleWindow.html#TUpdateFunc">TUpdateFunc</a> read FOnUpdate write FOnUpdate;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#OnIdle">OnIdle</a></b>: <a  href="CastleWindow.html#TUpdateFunc">TUpdateFunc</a> read FOnUpdate write FOnUpdate; deprecated;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#OnTimer">OnTimer</a></b>: TProcedure read FOnTimer write FOnTimer;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#TimerMilisec">TimerMilisec</a></b>: Cardinal read FTimerMilisec write FTimerMilisec default 1000;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#MainWindow">MainWindow</a></b>: <a  href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> read FMainWindow write SetMainWindow;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleWindow.TCastleApplication.html#LimitFPS">LimitFPS</a></b>: Single read FLimitFPS write FLimitFPS default <a  href="CastleWindow.html#DefaultLimitFPS">DefaultLimitFPS</a>;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Fields</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoResize"></a><code><b>VideoResize</b>: boolean;</code></td>
</tr>
<tr><td colspan="2">
<p>
If <code>VideoResize</code>, then next <a class="normal" href="CastleWindow.TCastleApplication.html#VideoChange">VideoChange</a> call will try to resize the screen to given <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResizeWidth">VideoResizeWidth</a> / <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResizeheight">VideoResizeHeight</a>. Otherwise, next <a class="normal" href="CastleWindow.TCastleApplication.html#TryVideoChange">TryVideoChange</a> and <a class="normal" href="CastleWindow.TCastleApplication.html#VideoChange">VideoChange</a> will use default screen size. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoResizeWidth"></a><code><b>VideoResizeWidth</b>: integer;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoResizeheight"></a><code><b>VideoResizeheight</b>: integer;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Notification"></a><code>procedure <b>Notification</b>(AComponent: TComponent; Operation: TOperation); override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoSettingsDescribe"></a><code>function <b>VideoSettingsDescribe</b>: string;</code></td>
</tr>
<tr><td colspan="2">
<p>
Describe the changes recorded in variables VideoXxx, used by <a class="normal" href="CastleWindow.TCastleApplication.html#VideoChange">VideoChange</a> and <a class="normal" href="CastleWindow.TCastleApplication.html#TryVideoChange">TryVideoChange</a>. This is a multiline string, each line is indented by 2 spaces, always ends with <a class="normal" href="CastleUtils.html#NL">CastleUtils.NL</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="TryVideoChange"></a><code>function <b>TryVideoChange</b>: boolean;</code></td>
</tr>
<tr><td colspan="2">
<p>
Change the screen size, color bits and such, following the directions you set in <a class="normal" href="CastleWindow.TCastleApplication.html#VideoColorBits">VideoColorBits</a>, <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResize">VideoResize</a>, <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResizeWidth">VideoResizeWidth</a> / <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResizeheight">VideoResizeHeight</a>, and <a class="normal" href="CastleWindow.TCastleApplication.html#VideoFrequency">VideoFrequency</a> variables. Returns <code>True</code> if success.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoChange"></a><code>procedure <b>VideoChange</b>(OnErrorWarnUserAndContinue: boolean);</code></td>
</tr>
<tr><td colspan="2">
<p>
Change the screen size, color bits and such, following the directions you set in <a class="normal" href="CastleWindow.TCastleApplication.html#VideoColorBits">VideoColorBits</a>, <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResize">VideoResize</a>, <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResizeWidth">VideoResizeWidth</a> / <a class="normal" href="CastleWindow.TCastleApplication.html#VideoResizeheight">VideoResizeHeight</a>, and <a class="normal" href="CastleWindow.TCastleApplication.html#VideoFrequency">VideoFrequency</a> variables. This actually just calls <a class="normal" href="CastleWindow.TCastleApplication.html#TryVideoChange">TryVideoChange</a> and checks the result.

<p>If not success: if OnErrorWarnUserAndContinue then we'll display a warning and continue. If not OnErrorWarnUserAndContinue then we'll raise an Exception.

<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><code>Exception</code></dt>
<dd>If video mode change failed, and OnErrorWarnUserAndContinue = false.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoReset"></a><code>procedure <b>VideoReset</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Return default screen video mode. If you never called <a class="normal" href="CastleWindow.TCastleApplication.html#TryVideoChange">TryVideoChange</a> (with success), then this does nothing. This is automatically called in Application.Destroy, so at finalization of this unit. This way your game nicely restores screen resolution for user.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ScreenHeight"></a><code>function <b>ScreenHeight</b>: integer;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ScreenWidth"></a><code>function <b>ScreenWidth</b>: integer;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="OpenWindowsCount"></a><code>function <b>OpenWindowsCount</b>: integer;</code></td>
</tr>
<tr><td colspan="2">
<p>
List of all open windows. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ProcessMessage"></a><code>function <b>ProcessMessage</b>(WaitForMessage, WaitToLimitFPS: boolean): boolean;</code></td>
</tr>
<tr><td colspan="2">
<p>
Process messages from the window system. You have to call this repeatedly to process key presses, mouse events, redraws and everything else. Messages are processed and appropriate window callbacks are called, like <a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnRender">TCastleWindowCustom.OnRender</a>, <a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnUpdate">TCastleWindowCustom.OnUpdate</a>, TCastleWindowCustom.OnKeyPress and many others.

<p>For simple programs calling the <a class="normal" href="CastleWindow.TCastleApplication.html#Run">Run</a> method is usually the best solution, <a class="normal" href="CastleWindow.TCastleApplication.html#Run">Run</a> just calls <code>ProcessMessage</code> in a loop. Manually using the <code>ProcessMessage</code> method allows you to implement modal dialog boxes (generally any kind of &quot;display something until something happens&quot; behavior). Make your own event loop like this:

<p></p>

<pre class="longcode">
  <span class="pascal_keyword">while</span> <span class="pascal_keyword">not</span> SomethingHappened <span class="pascal_keyword">do</span>
    Application.ProcessMessages(<span class="pascal_numeric"></span>...);
</pre>

<p>

<p>Often this is used together with <a class="normal" href="CastleWindowModes.TGLMode.html">TGLMode</a>, <a class="normal" href="CastleWindowModes.TGLModeFrozenScreen.html">TGLModeFrozenScreen</a> and similar utilities from <a class="normal" href="CastleWindowModes.html">CastleWindowModes</a> unit. They allow you to temporarily replace window callbacks with new ones, and later restore the original ones. This is useful for behavior similar to modal dialog boxes.

<p>Returns <code>True</code> if we should continue, that is if <a class="normal" href="CastleWindow.TCastleApplication.html#Quit">Quit</a> method was not called (directly or by closing the last window). If you want to check it (if you allow the user at all to close the application during modal box or such) you can do:

<p></p>

<pre class="longcode">
  <span class="pascal_keyword">while</span> <span class="pascal_keyword">not</span> SomethingHappened <span class="pascal_keyword">do</span>
    <span class="pascal_keyword">if</span> <span class="pascal_keyword">not</span> Application.ProcessMessage(<span class="pascal_numeric"></span>...) <span class="pascal_keyword">then</span>
      Break;
</pre>

<p>

<p>Do not assume too much about message processing internals. For example, not all <code>ProcessMessage</code> calls cause redraw, even if redraw is requested by Invalidate. When we have messages to process, we generally don't call redraw or even <a class="normal" href="CastleWindow.TCastleApplication.html#OnUpdate">OnUpdate</a>.

<p>

<p></p>
<h6 class="description_section">Parameters</h6>
<dl class="parameters">
<dt>WaitForMessage</dt>
<dd>If <code>True</code> (and some other conditions are met, for example we do not have to call <a class="normal" href="CastleWindow.TCastleApplication.html#OnUpdate">OnUpdate</a> continuosly) then we can block, waiting for an event to process.

<p>Set this to <code>True</code> whenever you can, that is whenever your program only responds to user inputs (as opposed to making some operations, like animation or loading or ray-tracing something). Generally, when <code>SomethingHappened</code> from the example pseudo-code above can only be changed by user events (e.g. user has to click something; nothing happens if user doesn't click for 5 minutes or 5 hours). This allows to let OS and CPU have some rest, and spend time on other applications, or just sleep and conserve laptop battery power.</dd>
<dt>WaitToLimitFPS</dt>
<dd>If <code>True</code>, then we have backup mechanism for limiting CPU usage. When WaitForMessage mechanism cannot be used (becasue WaitForMessage is <code>False</code> or some other conditions disallow it), and user doesn't throw events at us (we don't want to sleep when user produces many events e.g. by mouse move), then we can do a small sleep to stabilize number of <code>ProcessMessage</code> calls at <a class="normal" href="CastleWindow.TCastleApplication.html#LimitFPS">LimitFPS</a> per second.

<p>Set this to <code>True</code> whenever you can, that is whenever you don't need <code>ProcessMessage</code> to return as fast as it can. For example, when you're displaying some animation, then displaying <a class="normal" href="CastleWindow.TCastleApplication.html#LimitFPS">LimitFPS</a> frames should be enough. OTOH, if you really do something that should be done as fast as possible (like loading some file or ray-tracing) you probably have to set this to <code>False</code>.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ProcessAllMessages"></a><code>function <b>ProcessAllMessages</b>: boolean;</code></td>
</tr>
<tr><td colspan="2">
<p>
Processes <i>all</i> pending messages. Do not wait for anything.

<p>Contrast this with <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">ProcessMessage</a> method, that processes only a single event. Or no event at all (when no events were pending and AllowSuspend = <code>False</code>). This means that after calling <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">ProcessMessage</a> once, you may have many messages left in the queue (especially mouse move together with key presses typically makes a lot of events). So it's not good to use if you want to react timely to some user requests, e.g. when you do something time-consuming and allow user to break the task with Escape key.

<p><code>ProcessAllMessages</code> is like calling in a loop <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">ProcessMessage</a>(false, false), ends when <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">ProcessMessage</a>(false, false) didn't process any message or when quit was called (or last window closed).

<p>So <code>ProcessAllMessages</code> makes sure we have processed all pending events, thus we are up-to-date with window system requests.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Quit"></a><code>procedure <b>Quit</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Close all open windows, make <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">ProcessMessage</a> return <code>False</code>, finish the <a class="normal" href="CastleWindow.TCastleApplication.html#Run">Run</a> method (if working), and thus finish the application work.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Run"></a><code>procedure <b>Run</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Run the program using <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a>, by doing the event loop. Think of it as just a shortcut for &quot;while <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">ProcessMessage</a> do ;&quot;.

<p>Note that this does nothing if <a class="normal" href="CastleWindow.TCastleApplication.html#OpenWindowsCount">OpenWindowsCount</a> = 0, that is there are no open windows. Besides the obvious reason (you didn't call <a class="normal" href="CastleWindow.TCastleWindowCustom.html#Open">TCastleWindowCustom.Open</a> on any window...) this may also happen if you called Close (or Application.Quit) from your window OnOpen / OnResize callback. In such case no event would probably reach our program, and user would have no chance to quit, so Run just refuses to work and exits immediately without any error.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="BackendName"></a><code>function <b>BackendName</b>: string;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>(AOwner: TComponent); override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Destroy"></a><code>destructor <b>Destroy</b>; override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<h3 class="detail">Properties</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="XDisplayName"></a><code>property <b>XDisplayName</b>: string read FXDisplayName write FXDisplayName;</code></td>
</tr>
<tr><td colspan="2">
<p>
Set XDisplay name, this will be used for all <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> that will be subsequently initialized by <a class="normal" href="CastleWindow.TCastleWindowCustom.html#Open">TCastleWindowCustom.Open</a>.

<p>Note that this is exposed by GTK even for non-XWindows platforms, but I don't know what it does there.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoColorBits"></a><code>property <b>VideoColorBits</b>: integer read FVideoColorBits write FVideoColorBits default 0;</code></td>
</tr>
<tr><td colspan="2">
<p>
Color bits per pixel that will be set by next <a class="normal" href="CastleWindow.TCastleApplication.html#VideoChange">VideoChange</a> call, and that are tried to be used at <a class="normal" href="CastleWindow.TCastleWindowCustom.html#Open">TCastleWindowCustom.Open</a>. Zero means that system default is used.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VideoFrequency"></a><code>property <b>VideoFrequency</b>: Cardinal read FVideoFrequency write FVideoFrequency default 0;</code></td>
</tr>
<tr><td colspan="2">
<p>
Video frequency to set in next <a class="normal" href="CastleWindow.TCastleApplication.html#VideoChange">VideoChange</a> call. Leave as 0 to use system default.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="OpenWindows"></a><code>property <b>OpenWindows</b>[Index:integer]: <a  href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> read GetOpenWindows;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="OnInitialize"></a><code>property <b>OnInitialize</b>: TProcedure read FOnInitialize write FOnInitialize;</code></td>
</tr>
<tr><td colspan="2">
<p>
The backend is initialized. Called only once, at the very beginning of the game, when we're ready to load everything and the first OpenGL context is initialized (right before calling <a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnOpen">TCastleWindowCustom.OnOpen</a>).

<p>For targets like Android or iOS or browser plugin, you should not do anything (even reading files) before this callback occurs. Only when this occurs, we know that external process told us &quot;Ok, you're ready&quot;. So you should put all the game initialization in an Application.OnInitialize callback. It will be automatically called by <a class="normal" href="CastleWindow.html">CastleWindow</a> backend when we're really ready (actually, a little later &mdash; when OpenGL context is active, to allow you to display progress bars etc. when loading).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="OnUpdate"></a><code>property <b>OnUpdate</b>: <a  href="CastleWindow.html#TUpdateFunc">TUpdateFunc</a> read FOnUpdate write FOnUpdate;</code></td>
</tr>
<tr><td colspan="2">
<p>
Continously occuring event. </p>
<h6 class="description_section">See also</h6>
<dl class="see_also">
  <dt><a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnUpdate">TCastleWindowCustom.OnUpdate.</a></dt>
  <dd>Continously occuring event, called for all open windows.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="OnIdle"></a><code>property <b>OnIdle</b>: <a  href="CastleWindow.html#TUpdateFunc">TUpdateFunc</a> read FOnUpdate write FOnUpdate; deprecated;</code></td>
</tr>
<tr><td colspan="2">
<p class="hint_directive">Warning: this symbol is deprecated.</p><p>
 Deprecated name for <a class="normal" href="CastleWindow.TCastleApplication.html#OnUpdate">OnUpdate</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="OnTimer"></a><code>property <b>OnTimer</b>: TProcedure read FOnTimer write FOnTimer;</code></td>
</tr>
<tr><td colspan="2">
<p>
Event called approximately after each <a class="normal" href="CastleWindow.TCastleApplication.html#TimerMilisec">TimerMilisec</a> miliseconds. The actual delay may be larger than <a class="normal" href="CastleWindow.TCastleApplication.html#TimerMilisec">TimerMilisec</a> miliseconds, depending on how the program (and OS) is busy.

<p>You can of course change <a class="normal" href="CastleWindow.TCastleApplication.html#TimerMilisec">TimerMilisec</a> (and <code>OnTimer</code>) even when some windows are already open. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="TimerMilisec"></a><code>property <b>TimerMilisec</b>: Cardinal read FTimerMilisec write FTimerMilisec default 1000;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MainWindow"></a><code>property <b>MainWindow</b>: <a  href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> read FMainWindow write SetMainWindow;</code></td>
</tr>
<tr><td colspan="2">
<p>
Main window used for various purposes. On targets when only one <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> instance makes sense (like Android), set this to the reference of that window. It is also used by <a class="normal" href="CastleWindowProgress.TWindowProgressInterface.html">TWindowProgressInterface</a> to display progress bar.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="LimitFPS"></a><code>property <b>LimitFPS</b>: Single read FLimitFPS write FLimitFPS default <a  href="CastleWindow.html#DefaultLimitFPS">DefaultLimitFPS</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Limit the number of (real) frames per second, to not hog the CPU. Set to zero to not limit.

<p>To be more precise, this limits the number of <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">TCastleApplication.ProcessMessage</a> calls per second, in situations when we do not have to process any user input. So we limit not only rendering (<a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnRender">TCastleWindowCustom.OnRender</a>) but also other animation processing (<a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnUpdate">TCastleWindowCustom.OnUpdate</a>) calls per second. See <a class="normal" href="CastleWindow.TCastleApplication.html#ProcessMessage">TCastleApplication.ProcessMessage</a>.

<p>In case of <a class="normal" href="CastleWindow.html">CastleWindow</a> backends when we have to fight with event clogging (right now only LCL backend, used by default only on Mac OS X) this is also the &quot;desired number of FPS&quot;: we make sure that even when application is clogged with events (like when dragging with mouse), we call update (<a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnUpdate">TCastleWindowCustom.OnUpdate</a>) and (if necessary) draw (<a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnRender">TCastleWindowCustom.OnRender</a> and related) at least as often. When <code>LimitFPS</code> is used for this purpose (&quot;desired number of FPS&quot;), it is also capped (by MaxDesiredFPS = 100.0).</p>
</td></tr>
</table>
<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(["trackPageView"]);
  _paq.push(["enableLinkTracking"]);

  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
    _paq.push(["setTrackerUrl", u+"piwik.php"]);
    _paq.push(["setSiteId", "1"]);
    var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
    g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Piwik Code -->

<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&amp;rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a  href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:13</em>
</span>
</td></tr></table></body></html>