-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathEngineMap.txt
More file actions
400 lines (314 loc) · 19.8 KB
/
EngineMap.txt
File metadata and controls
400 lines (314 loc) · 19.8 KB
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
# Apus Game Engine Class Map
# Created: January 28, 2026
# Engine version: unknown
## Engine Structure Overview
Apus Game Engine is a modular system built on interfaces and abstract classes.
Main components:
1. **Engine Core (TGame, TGameBase)** - main loop management, scenes, input
2. **Graphics Subsystem (IGraphicsSystem)** - abstraction over OpenGL/DirectX
3. **Resource System (IResourceManager)** - texture and buffer management
4. **Scene System (TGameScene, TUIScene)** - game logic organization
5. **User Interface (TUIElement and descendants)** - widget system
6. **Auxiliary Systems** - sound, network, physics, etc.
## Classes and Interfaces
### Module: Apus.Engine.API.pas
#### Graphics Subsystem Interfaces:
**ISystemPlatform** - interface to native OS or base library
- Purpose: Abstraction of platform-dependent functions (windows, cursors, input)
- Dependencies: Types, THandle
- Interface: CreateWindow, DestroyWindow, SetupWindow, GetWindowHandle, ProcessSystemMessages, GetSystemCursor, SetCursor, CreateOpenGLContext, etc.
**IRenderTarget** - render target management
- Purpose: Control of render target (clear, viewport, blending)
- Dependencies: TTexture, TDepthBufferTest, TBlendingMode
- Interface: Clear, Viewport, UseDepthBuffer, BlendMode, Mask, UnMask, Backbuffer, Texture, Push, Pop
**IClipping** - clipping management
- Purpose: Setting and restoring clipping regions
- Dependencies: TRect
- Interface: Rect, Nothing, Restore, Reject, Get, Prepare
**ITransformation** - transformation and projection management
- Purpose: Setting projection, view, and model matrices
- Dependencies: T3DMatrix, TPoint3, TVector3
- Interface: DefaultView, Perspective, Orthographic, SetProjection, SetView, SetCamera, SetObj, ResetObj, MVPMatrix, Transform, etc.
**IShader** - shader management
- Purpose: Compilation and use of shaders, texture mode configuration
- Dependencies: TShader, TTexBlendingMode, TTexFilter, TShadowMapMode
- Interface: Build, Load, UseCustom, UseCustomized, Reset, SetUniform, TexMode, DefaultTexMode, UseTexture, AmbientLight, DirectLight, PointLight, LightOff, Material, Shadow, Apply
**IGraphicsSystemConfig** - graphics system configuration
- Purpose: Pixel format selection, vertical sync configuration
- Dependencies: TImagePixelFormat
- Interface: ChoosePixelFormats, SetVSyncDivider, QueryMaxRTSize, ShouldUseTextureAsDefaultRT
**IResourceManager** - resource manager (textures, buffers)
- Purpose: Creation and management of textures, vertex and index buffers
- Dependencies: TTexture, TVertexBuffer, TIndexBuffer, TImagePixelFormat, TBufferUsage
- Interface: AllocImage, QueryParams, FreeImage, ResizeImage, Clone, Copy, AttachDepthBuffer, MakeOnline, AllocVertexBuffer, AllocIndexBuffer, FreeBuffer, UseVertexBuffer, UseIndexBuffer, GetStatus, Dump
**ITextDrawer** - text output
- Purpose: Font loading, text output and measurement
- Dependencies: TFontHandle, TTextAlignment, TBuffer
- Interface: LoadFont, SetScale, GetFont, ScaleFont, SetFontOption, Write, WriteW, Width, WidthW, Height, MeasuredCnt, MeasuredRect, ClearLink, Link, LinkRect, BeginBlock, EndBlock, SetTarget
**IDrawer** - primitive drawing
- Purpose: Drawing lines, rectangles, textures, particles, meshes
- Dependencies: TTexture, TParticle, TVertex, TVertexBuffer, TIndexBuffer, TColorGradient
- Interface: Line, Polyline, Polygon, Rect, FillRect, Image, TexturedRect, Scaled, RotScaled, WithGradient, NoGradient, Billboard, TrgList, IndexedMesh, DoubleTex, Particles, Band, EnableSoftParticles, DisableSoftParticles, SetZ
**IGraphicsSystem** - main graphics subsystem interface
- Purpose: Combines all graphics interfaces, rendering management
- Dependencies: All above interfaces
- Interface: Init, Done, GetVersion, GetName, config, resman, target, shader, clip, transform, draw, txt, BeginPaint, EndPaint, SetCullMode, CopyFromBackbuffer, GetPixelValue, PresentFrame, Restore, DrawDebugOverlay, Breakpoint
#### Abstract Classes:
**TGameBase** - base game class (abstract)
- Purpose: Defines common interface for game management
- Dependencies: ISystemPlatform, IGraphicsSystem, TGameSettings, TGameScene, TAnimatedValue
- Interface: SetSettings, GetSettings, Run, Stop, SwitchToAltSettings, OnFrame, RenderFrame, AddScene, RemoveScene, TopmostVisibleScene, GetScene, SwitchToScene, ShowWindowScene, HideWindowScene, RegisterCursor, GetCursorForID, ToggleCursor, HideAllCursors, ClientToGame, GameToClient, RunAsync, GetThreadResult, FLog, GetStatus, FireMessage, DebugFeature, EnterCritSect, LeaveCritSect, RequestScreenshot, RequestFrameCapture, StartVideoCap, FinishVideoCap, MouseInRect, MouseIsNear, WaitFor, SuppressKbdEvent, GetDepthBufferTex, Minimize, MoveWindowTo, SetWindowCaption, DPadCustomPoint
**TNinePatch** - nine-patch image (stretchable)
- Purpose: Creation of stretchable images for UI
- Dependencies: TNamedObject
- Interface: minWidth, minHeight, baseWidth, baseHeight, scaleFactor, Draw (abstract), ClassHash
### Module: Apus.Engine.Game.pas
**TGame** - concrete game engine implementation
- Purpose: Main class implementing game loop, scene management, input
- Inherits: TGameBase
- Dependencies: ISystemPlatform, IGraphicsSystem, TGameScene, TGameSettings, TGameCursor, TCustomThread
- Interface: All TGameBase methods + internal: ApplyNewSettings, SetVSync, InitGraph, InitDefaultResources, AfterInitGraph, SetupRenderArea, InitDefaultRenderTarget, InitMainLoop, FrameLoop, RenderAndPresentFrame, PresentFrame, DoneGraph, CaptureFrame, DrawCursor, DrawOverlays, NotifyScenesAboutMouseMove, NotifyScenesAboutMouseBtn, TopmostSceneForKbd, onEngineEvent, onCmdEvent, onKbdEvent, onMouseEvent, onJoystickEvent, onGamepadEvent, MouseMovedTo, CharEntered, KeyPressed, MouseButtonPressed, MouseWheelMoved, SizeChanged, Activate, CreateDebugLogs, DrawMagnifier, HandleInternalHotkeys, HandleGamepadNavigation
**TMainThread** - main game thread
- Purpose: Execution of main game loop in separate thread
- Inherits: TThread
- Dependencies: TGame
- Interface: Execute (overridden)
**TCustomThread** - custom thread for asynchronous tasks
- Purpose: Execution of user functions in separate thread
- Inherits: TThread
- Dependencies: TAsyncProc
- Interface: Execute (overridden), id, TimeToKill, running, func, FinishTime, param, name
**TGameCursor** - cursor representation
- Purpose: Storage of cursor information (ID, priority, handle, visibility)
- Dependencies: THandle
- Interface: ID, priority, handle, visible
### Module: Apus.Engine.Scene.pas
**TSceneEffect** - base scene effect
- Purpose: Abstract class for scene transition effects
- Dependencies: TGameScene
- Interface: timer, duration, done, target, name, Create, DrawScene (abstract), Destroy
**TSceneSwitcher** - scene switcher (abstract)
- Purpose: Interface for switching between scenes
- Dependencies: none
- Interface: SwitchToScene, ShowWindowScene, HideWindowScene (all abstract)
**TGameScene** - base game scene
- Purpose: Abstract class for all game scenes
- Inherits: TNamedObject
- Dependencies: TSceneStatus, TSceneEffect, TQueue
- Interface: status, fullscreen, frequency, effect, zOrder, activated, shadowColor, ignoreKeyboardEvents, initialized, loaded, accumTime, Create, Destroy, onCreate, SetStatus, IsActive, Load, Initialize, Process, Render, KeyPressed, ReadKey, WriteKey, ClearKeyBuf, ModeChanged, onResize, onMouseMove, onMouseBtn, onMouseWheel, onShow, onHide, onEvent, GetArea (abstract), LoadAllScenes, ClassHash
### Module: Apus.Engine.UIScene.pas
**TUIScene** - scene with user interface
- Purpose: Scene containing UI layer, base for most game scenes
- Inherits: TGameScene
- Dependencies: TUIElement
- Interface: UI, frameTime, Create, SetStatus, Process, Render, onResize, GetArea, WriteKey, onMouseMove, onMouseBtn, onMouseWheel, BackgroundRenderBegin, BackgroundRenderEnd
### Module: Apus.Engine.Resources.pas
**TTexture** - base texture class
- Purpose: Texture abstraction in graphics subsystem
- Inherits: TNamedObject
- Dependencies: TImagePixelFormat, TLockMode, TRawImage
- Interface: CloneFrom, Clone, ClonePart, Clear, ClearPart, Upload, UploadPart, Lock, LockLayer, GetLayer, GetRawImage, IsLocked, Unlock, AddDirtyRect, HasFlag, SetFilter, Size, Dump, FindByFile, src (property)
**TShader** - base shader class
- Purpose: Shader program abstraction
- Inherits: TNamedObject
- Dependencies: TVector2s, TVector3s, TVector4s, T3DMatrix, T3DMatrixS
- Interface: SetUniform (overloaded methods), VectorFromColor, VectorFromColor3
**TEngineBuffer** - base buffer class
- Purpose: Base class for vertex and index buffers
- Inherits: TObjectEx
- Dependencies: none
- Interface: sizeInBytes
**TVertexBuffer** - vertex buffer
- Purpose: Storage of vertices for rendering
- Inherits: TEngineBuffer
- Dependencies: TVertexLayout
- Interface: count, layout, Create, Upload, Resize
**TIndexBuffer** - index buffer
- Purpose: Storage of indices for rendering
- Inherits: TEngineBuffer
- Dependencies: none
- Interface: count, bytesPerIndex, Create, Upload, Resize
### Module: Apus.Engine.UITypes.pas
**TLayouter** - base layouter class
- Purpose: Abstract class for child element placement
- Dependencies: TUIElement
- Interface: Layout (abstract), GetItems
**IScroller** - scroller interface
- Purpose: Interface for external scrollbars
- Dependencies: TUIElement
- Interface: GetElement, SetRange, SetValue, SetStep, SetPageSize, MoveRel, GetValue, GetStep, GetPageSize
**TUIElement** - base user interface element
- Purpose: Main class for all UI elements, manages positioning, size, events
- Inherits: TNamedObject
- Dependencies: TElementShape, TAnchorMode, TSnapMode, TSendSignals, TClipMouse, TUIPlacementMode, TRegion, TLayouter, IScroller
- Interface: position, size, pivot, anchors, shape, scale, padding, scroll, enabled, visible, cursor, order, styleClass, canHaveFocus, hint, parent, children, layout, Create, Destroy, SafeDestroy, GetNext, GetPrev, GetRoot, IsVisible, IsEnabled, IsChild, HasParent, HasChild, DeleteChildren, ChildIndex, AttachTo, Detach, InsertAfter, InsertBefore, TransformTo, TransformToScreen, TransformFromScreen, GetRect, GetClientRect, GetPosOnScreen, GetClientPosOnScreen, onMouseMove, onMouseScroll, onMouseButtons, onKey, onChar, onUniChar, onHotKey, onTimer, onLostFocus, SetFocus, HasFocus, SetFocusToNext, SetFocusToPrev, SetPos, MoveBy, SetAnchors, SetPadding, SetScale, Resize, ResizeClient, Center, Snap, ScrollTo, SetupScrollers, CheckAndSetFocus, FindElementAt, FindAnyElementAt, FindChildByName, SetHotKey, RemoveHotKey, IsOpaque, IsOutOfOrder, Show, Hide, Toggle, Enable, Disable, ToggleEnabled, IsWindow, IsActiveWindow, SetDefault, SetStyle
### Module: Apus.Engine.UIWidgets.pas
**TUIFlexControl** - element with size constraints
- Purpose: Base class for elements with minimum/maximum sizes
- Inherits: TUIElement
- Dependencies: TUIElement
- Interface: minWidth, minHeight, maxWidth, maxHeight
**TUISplitter** - splitter
- Purpose: Visual separator between elements, can be horizontal or vertical
- Inherits: TUIElement
- Dependencies: TUIElement
- Interface: canResize, CreateH, CreateV (overloaded constructors)
**TUIImage** - static image
- Purpose: Display of images from files, events, or rendering procedures
- Inherits: TUIElement
- Dependencies: TUIElement
- Interface: src, Create, SetRenderProc
**TUIScrollArea** - scroll area for touchscreen
- Purpose: Independent area for content scrolling, captures drag events
- Inherits: TUIElement
- Dependencies: TUIElement, TUIScrollDirection
- Interface: fullWidth, fullHeight, direction, Create, onMouseMove, onMouseButtons, onTimer
**TUIHint** - tooltip
- Purpose: Popup window with text hint, automatically hides
- Inherits: TUIImage
- Dependencies: TUIImage
- Interface: simpleText, active, created, adjusted, hiding, Create, Destroy, Hide, onMouseButtons, onTimer
**TUILabel** - text label
- Purpose: Text display with alignment and auto-size support
- Inherits: TUIElement
- Dependencies: TUIElement, TTextAlignment
- Interface: align, autoSize, verticalOffset, Create (overloaded constructors), CreateCentered, CreateRight, CaptionWidthIs
**TUIButton** - button
- Purpose: Interactive button with support for various styles (normal, switch, checkbox)
- Inherits: TUIElement
- Dependencies: TUIElement, TButtonStyle, TProcedure
- Interface: default, pressed, pending, autoPendingTime, btnStyle, group, onClick, onClickEvent, Create (overloaded constructors), CreateSwitch, CreateGroupSwitch, Destroy, onMouseButtons, onMouseMove, onKey, onHotKey, onTimer, SetPressed, MakeSwitches, Click, GetSwitchIndex, Sender
**TUICheckBox** - checkbox
- Purpose: Element for option selection (checkbox)
- Inherits: TUIButton
- Dependencies: TUIButton
- Interface: checked, Create, SetPressed
**TUIRadioButton** - radio button
- Purpose: Element for single option selection from group
- Inherits: TUICheckbox
- Dependencies: TUICheckbox
- Interface: Create
**TUIFrame** - frame
- Purpose: Visual frame around elements
- Inherits: TUIElement
- Dependencies: TUIElement
- Interface: borderWidth, Create, SetBorderWidth
**TUIWindow** - base window
- Purpose: Window with title, move and resize support
- Inherits: TUIImage
- Dependencies: TUIImage
- Interface: header, autoBringToFront, moveable, resizeable, minW, minH, maxW, maxH, Create, GetAreaType, onMouseMove, onMouseButtons, onLostFocus, Resize, IsWindow
**TUISkinnedWindow** - skinned window
- Purpose: Window with custom skin and non-rectangular shape
- Inherits: TUIWindow
- Dependencies: TUIWindow, TRegion
- Interface: dragRegion, background, Create, Destroy, GetAreaType
**TUIEditBox** - text input field
- Purpose: Single-line text input field with selection, copy/paste support
- Inherits: TUIElement
- Dependencies: TUIElement
- Interface: realText, completion, defaultText, cursorPos, maxLength, password, noBorder, selStart, selCount, cursorTimer, needPos, msSelect, protection, offset, Create, onChar, onUniChar, onKey, onMouseButtons, onMouseMove, SetFocus, onLostFocus, SelectAll, text (property)
**TUIScrollBar** - scroll bar
- Purpose: Vertical or horizontal scroll bar with animation
- Inherits: TUIElement
- Dependencies: TUIElement, TAnimatedValue, IScroller
- Interface: horizontal, isInteger, min, max, pagesize, step, sliderUnder, sliderStart, sliderEnd, autoHide, Create, GetValue, SetValue, GetAnimating, SetPageSize, GetStep, GetScroller, SetRange, MoveTo, MoveRel, Link, UseButtons, CalcSliderPos, onTimer, onMouseMove, onMouseButtons, onMouseScroll, onLostFocus
**TUIListBox** - list box
- Purpose: Scrollable list of elements with selection support
- Inherits: TUIElement
- Dependencies: TUIElement, TUIScrollBar
- Interface: lines, tags, hints, lineHeight, selectedLine, hoverLine, autoSelectMode, bgColor, bgHoverColor, bgSelColor, textColor, hoverTextColor, selTextColor, Create, Destroy, AddLine, SetLine, ClearLines, SetLines, SelectLine, onMouseMove, onMouseButtons, UpdateScroller
**TUIComboBox** - combo box
- Purpose: Combined field with dropdown list for value selection
- Inherits: TUIButton
- Dependencies: TUIButton, TUIFrame, TUIListBox
- Interface: items, hints, tags, defaultText, fCurItem, fCurTag, frame, popup, maxlines, Create, AddItem, SetItem, ClearItems, onDropDown, onMouseButtons, onTimer, SetCurItem, SetCurItemByText, SetCurItemByTag, text (property)
### Module: Apus.Engine.OpenGL.pas
**TOpenGL** - OpenGL graphics system implementation
- Purpose: Concrete implementation of IGraphicsSystem and IGraphicsSystemConfig interfaces for OpenGL
- Inherits: TInterfacedObject
- Implements: IGraphicsSystem, IGraphicsSystemConfig
- Dependencies: ISystemPlatform, IResourceManager, IRenderTarget, IShader, IClipping, ITransformation, IDrawer, ITextDrawer
- Interface: Init, Done, GetVersion, GetName, ChoosePixelFormats, ShouldUseTextureAsDefaultRT, SetVSyncDivider, QueryMaxRTSize, config, resman, target, shader, clip, transform, draw, txt, PresentFrame, CopyFromBackbuffer, GetPixelValue, BeginPaint, EndPaint, SetCullMode, Restore, DrawDebugOverlay, PostDebugMsg, Breakpoint
**TRenderDevice** - OpenGL rendering device
- Purpose: Low-level abstraction for drawing primitives through OpenGL
- Inherits: TInterfacedObject
- Implements: IRenderDevice
- Dependencies: TVertexLayout, TPrimitiveType
- Interface: Create, Destroy, Reset, Draw, DrawIndexed (overloaded), DrawInstanced (overloaded), UseExtraVertexData, SetVertexDataDivisors, SetupAttributes
**TGLRenderTargetAPI** - OpenGL render target implementation
- Purpose: Management of render targets in OpenGL (backbuffer, textures)
- Inherits: TRendertargetAPI
- Dependencies: TTexture, TDepthBufferTest, TBlendingMode
- Interface: Create, Backbuffer, Texture, Clear, ClearDepth, Viewport, UseDepthBuffer, BlendMode, Clip, ApplyMask, Resized, ClearBuffers
### Module: Apus.Engine.ResManGL.pas (assumed)
**TGLResourceManager** - OpenGL resource manager
- Purpose: Concrete implementation of IResourceManager for OpenGL
- Dependencies: TTexture, TVertexBuffer, TIndexBuffer
- Interface: (implements IResourceManager)
**TGLTexture** - OpenGL texture
- Purpose: Concrete implementation of TTexture for OpenGL
- Inherits: TTexture
- Dependencies: TTexture
- Interface: SetAsRenderTarget and other OpenGL-specific methods
### Module: Apus.Engine.ShadersGL.pas (assumed)
**TGLShadersAPI** - OpenGL shaders API
- Purpose: Concrete implementation of IShader for OpenGL
- Dependencies: TShader
- Interface: (implements IShader)
### Module: Apus.Engine.Mesh.pas
**TMesh** - 3D mesh
- Purpose: Representation of 3D model with geometry
- Dependencies: (assumed TVertex, TIndices)
- Interface: (defined in API.pas as type)
## Other Important Modules (briefly):
### Module: Apus.Engine.Sound.pas
- **TSoundSystem** - abstract sound system
- **TSoundSample** - sound sample
- **TSoundStream** - sound stream
### Module: Apus.Engine.Networking2.pas / Networking3.pas
- **TNetworking** - networking subsystem
- **TConnection** - network connection
### Module: Apus.Engine.Model3D.pas
- **TModel3D** - 3D model with bone hierarchy and animations
### Module: Apus.Engine.Console.pas
- **TConsole** - in-game console
### Module: Apus.Engine.CmdProc.pas
- **TCommandProcessor** - command processor
## Dependencies Between Main Components
```
TGame (core)
├── IGraphicsSystem (graphics)
│ ├── IResourceManager (resources) → TGLResourceManager (OpenGL)
│ ├── IDrawer (drawing)
│ ├── ITextDrawer (text)
│ ├── IShader (shaders) → TGLShadersAPI (OpenGL)
│ ├── ITransformation (transformations)
│ ├── IClipping (clipping)
│ └── IRenderTarget (render target) → TGLRenderTargetAPI (OpenGL)
├── ISystemPlatform (platform)
├── TSoundSystem (sound)
├── TNetworking (network)
└── TGameScene and descendants (scenes)
└── TUIScene (UI scenes)
└── TUIElement and descendants (UI elements)
```
## Architectural Features
1. **Interface-Oriented Design**: All major subsystems are represented by interfaces (IGraphicsSystem, IResourceManager, etc.), allowing easy replacement of implementations.
2. **Modularity**: The engine is divided into clear modules:
- Core (Game, Scene)
- Graphics (OpenGL/DirectX implementations)
- Resources (textures, buffers)
- User Interface
- Sound, network, physics
3. **Scene Hierarchy**: Game logic is organized through scenes (TGameScene), which can be nested and have transition effects.
4. **UI System**: Full-featured widget system with support for layouts, events, input focus.
5. **Cross-Platform**: Platform abstraction through ISystemPlatform allows working on Windows, Linux, mobile platforms.
6. **Multithreading**: Support for asynchronous tasks through TCustomThread.
## Key Abstractions
1. **TGame** - central class managing the entire lifecycle
2. **TGameScene** - unit of game logic
3. **TUIElement** - base UI element
4. **TTexture** - graphics resource abstraction
5. **ISystemPlatform** - operating system abstraction
This class map represents the main architecture of Apus Game Engine and can be expanded with more detailed analysis of specific modules.