Reference Codebot.Render.Scenes.pas
Part of the Codebot Render package
The Codebot.Render.Scenes unit gives you TScene, the base class of everything a host shows. You descend from TScene and override Initialize to load what your scene needs, Logic to update it once a frame, Render to draw it, and Finalize to free what you created. Calling inherited Render clears the scene for you. While your scene runs you have its Canvas, its default Font, Time, Width, Height, and Context.
Input arrives through DoKeyDown, DoKeyUp, DoTextInput, DoMouseDown, DoMouseMove, DoMouseUp, and DoMouseWheel, each with an argument record you can mark as Handled. Key codes are the VK_ virtual key codes of Codebot.Platform.
If your scene needs something to happen at a steady rate apart from drawing, such as physics, override StepInterval to return the seconds between steps and override Step. The host then calls Step on a step thread of its own. Step runs at the same time as Logic and Render, so protect any data they share.
TSceneHost runs scenes and provides what they share: the canvas, a default font, the window, the clipboard, the timer, the frame rate, and vertical sync. The two hosts are TSceneController in the codebot_render_controls package and TApplication in the codebot_render_sdl package. A host also holds the AssetKey of your program, which Codebot.Render.Assets describes.
Items 90 items
| Name | Kind | Line |
|---|---|---|
| SceneHost | function | 137 |
| SceneLogicStep | constant | 221 |
| SetSceneHost | procedure | 139 |
| TMouseAction | enum | 21 |
| maPress | enum value | 21 |
| maMove | enum value | 21 |
| maRelease | enum value | 21 |
| TScene | class | 145 |
| Create | constructor | 164 |
| Destroy | destructor | 165 |
| DoKeyDown | procedure | 174 |
| DoKeyUp | procedure | 175 |
| DoMouseDown | procedure | 176 |
| DoMouseMove | procedure | 177 |
| DoMouseUp | procedure | 178 |
| DoMouseWheel | procedure | 179 |
| DoTextInput | procedure | 180 |
| Finalize | procedure | 187 |
| Initialize | procedure | 185 |
| KeyEvent | procedure | 169 |
| Logic | procedure | 189 |
| MouseEvent | procedure | 171 |
| Name | function | 167 |
| Render | procedure | 191 |
| Resize | procedure | 161 |
| Step | procedure | 199 |
| StepInterval | function | 195 |
| Update | procedure | 183 |
| Animated | property | 201 |
| Canvas | property | 207 |
| Context | property | 203 |
| Font | property | 208 |
| Height | property | 214 |
| Host | property | 205 |
| Time | property | 210 |
| Width | property | 212 |
| TSceneClass | classref | 218 |
| TSceneHost | class | 83 |
| FCanvas | field | 85 |
| FFont | field | 86 |
| FFrameRate | field | 89 |
| FMouseX | field | 90 |
| FMouseY | field | 91 |
| FTime | field | 88 |
| FTimer | field | 87 |
| FVSync | field | 93 |
| FWindow | field | 92 |
| BuildDat | function | 106 |
| GetAssetKey | function | 100 |
| GetClipboard | function | 95 |
| GetVSync | function | 98 |
| SetAssetKey | procedure | 101 |
| SetClipboard | procedure | 96 |
| SetVSync | procedure | 99 |
| AssetKey | property | 132 |
| Canvas | property | 109 |
| Clipboard | property | 122 |
| Font | property | 111 |
| FrameRate | property | 117 |
| MouseX | property | 119 |
| MouseY | property | 120 |
| Time | property | 115 |
| Timer | property | 113 |
| VSync | property | 127 |
| Window | property | 124 |
| TSceneKeyArgs | record | 26 |
| Handled | field | 33 |
| Key | field | 28 |
| Repeated | field | 32 |
| Shift | field | 30 |
| TSceneKeyEvent | procedural | 66 |
| TSceneMouseArgs | record | 37 |
| Button | field | 39 |
| Handled | field | 44 |
| Shift | field | 43 |
| X | field | 41 |
| XRel | field | 41 |
| Y | field | 41 |
| YRel | field | 41 |
| TSceneMouseEvent | procedural | 68 |
| TSceneTextArgs | record | 59 |
| Handled | field | 62 |
| Text | field | 61 |
| TSceneWheelArgs | record | 48 |
| Delta | field | 50 |
| Handled | field | 55 |
| Shift | field | 54 |
| X | field | 52 |
| Y | field | 52 |
| TShiftKeys | set | 19 |