| 1 |
{ |
| 2 |
Copyright 2018-2022 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Game initialization and logic. } |
| 17 |
unit GameInitialize; |
| 18 |
|
| 19 |
interface |
| 20 |
|
| 21 |
implementation |
| 22 |
|
| 23 |
uses SysUtils, |
| 24 |
CastleWindow, CastleScene, CastleControls, CastleLog, |
| 25 |
CastleFilesUtils, CastleSceneCore, CastleKeysMouse, CastleColors, |
| 26 |
CastleUIControls, CastleApplicationProperties |
| 27 |
{$region 'Castle Initialization Uses'} |
| 28 |
// The content here may be automatically updated by CGE editor. |
| 29 |
, GameViewMainMenu |
| 30 |
, GameViewPlay |
| 31 |
, GameViewInstructions |
| 32 |
, GameViewInstructions2 |
| 33 |
, GameViewWin |
| 34 |
{$endregion 'Castle Initialization Uses'}; |
| 35 |
|
| 36 |
var |
| 37 |
Window: TCastleWindow; |
| 38 |
|
| 39 |
{ routines ------------------------------------------------------------------- } |
| 40 |
|
| 41 |
{ One-time initialization of resources. } |
| 42 |
procedure ApplicationInitialize; |
| 43 |
begin |
| 44 |
{ Adjust container settings, |
| 45 |
for a scalable UI (adjusts to any window size in a smart way). } |
| 46 |
Window.Container.LoadSettings('castle-data:/CastleSettings.xml'); |
| 47 |
|
| 48 |
{$region 'Castle View Creation'} |
| 49 |
// The content here may be automatically updated by CGE editor. |
| 50 |
ViewMainMenu := TViewMainMenu.Create(Application); |
| 51 |
ViewPlay := TViewPlay.Create(Application); |
| 52 |
ViewInstructions := TViewInstructions.Create(Application); |
| 53 |
ViewInstructions2 := TViewInstructions2.Create(Application); |
| 54 |
ViewWin := TViewWin.Create(Application); |
| 55 |
{$endregion 'Castle View Creation'} |
| 56 |
|
| 57 |
Window.Container.View := ViewMainMenu; |
| 58 |
end; |
| 59 |
|
| 60 |
initialization |
| 61 |
{ Initialize Application.OnInitialize. } |
| 62 |
Application.OnInitialize := @ApplicationInitialize; |
| 63 |
|
| 64 |
{ Create and assign Application.MainWindow. } |
| 65 |
Window := TCastleWindow.Create(Application); |
| 66 |
Application.MainWindow := Window; |
| 67 |
end. |