CRM64Pro GDK v0.20.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches
Scene Layer

Description

Shared base classes and context for Scene layers [v26.08.00].

Overview

This module defines the common SceneLayer contract and SceneLayerContext used by every Scene layer. Scene owns the frame order; each concrete layer supplies its own update and rendering behavior.

Class Hierarchy

  • SceneLayer (Base): Abstract base class providing common properties and virtual hooks for custom logic:
    • Position, Velocity, and Parallax factors.
    • Visibility and Alpha modulation.
    • Feature flags (Render, Update, Loop, SmoothScroll).
    • Event callbacks.
    • Unified SceneLayerContext for synchronized update and render logic.
  • SceneLayerTile: Manages a 2D array of tile indices.
    • Handles tileset mapping and cell rendering.
    • Optimized for large static grids.
  • SceneLayerObject: Implements the HEGA system.
    • SpatialGrid: A sparse hash-map for O(1) average spatial lookups.
    • SceneObject: Represents game entities with position, bounds (AABB), and optional visual representation (Tile/Shape).
    • Supports efficient region queries and dynamic object management.
  • SceneLayerImage: Manages a single large image.
    • Efficiently handles repeating textures for infinite backgrounds.
    • Supports internal optimization for display hardware.

Topics

 Scene Layer Tile
 SceneLayerTile class for grid-based tile map layers.
 Scene Layer Object
 Object layer containing game objects with spatial partitioning.
 Scene Layer Image
 Image layer containing a single image for background/foreground display.

Classes

struct  CRM64Pro::SceneLayerContext
 Layer Context structure. More...
struct  CRM64Pro::SceneLayerContext::[struct].data.Tile
 Data for SLT_TILE. More...
struct  CRM64Pro::SceneLayerContext::[struct].data.Object
 Data for SLT_OBJECT. More...
struct  CRM64Pro::SceneLayerContext::[struct].data.Image
 Data for SLT_IMAGE. More...
class  CRM64Pro::SceneLayer
 Base class for all Scene layer types. More...

Typedefs

using CRM64Pro::SceneLayerCallback = function<void(const SceneLayerContext& rContext)>
 Scene layer callback type.
using CRM64Pro::SceneCameraOffsetCallback = function<bool(Scene& rScene, Sint32 iLayer, SDL_FPoint& ptOffset)>
 Scene camera offset callback type.

Typedef Documentation

◆ SceneLayerCallback

using CRM64Pro::SceneLayerCallback = function<void(const SceneLayerContext& rContext)>

Scene layer callback type.

Parameters
rContextRead-only context for the current layer update or render callback.

◆ SceneCameraOffsetCallback

using CRM64Pro::SceneCameraOffsetCallback = function<bool(Scene& rScene, Sint32 iLayer, SDL_FPoint& ptOffset)>

Scene camera offset callback type.

Used by ::SCM_OFFSET mode. Callback should return true and write a pixel offset in ptOffset. Returning false disables additional offset for that tick (equivalent to {0,0}).

Parameters
rSceneScene requesting the camera offset.
iLayerLayer index for which the offset is requested.
ptOffsetReceives the camera offset in pixels.
Returns
true when ptOffset was supplied, or false to use no additional offset.