| CRM64Pro GDK v0.16.0 A free cross-platform game development kit built on top of SDL 3.0

Loading...
Searching...
No Matches
Scene Layer base
Scene module

## Description

Data classes for Scene Layer management [v26.02.0].

### Overview

This module defines the internal data structures used to manage the different types of layers within the Scene. While Scene acts as the controller, these classes handle the specific data and logic for each layer type.

### 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 LayerTile
| TileLayer class for tile-based map layers.
| Scene LayerObject
| Object layer containing game objects with spatial partitioning.
| Scene LayerImage
| Image layer containing a single image for background/foreground display.

## Classes
struct | CRM64Pro::SceneLayerContext
| Layer Context structure. More...
class | CRM64Pro::SceneLayer
| Base class for all Scene layer types. More...

## Typedefs
typedef void(* | CRM64Pro::SCENE_OnLayerCallback) (const SceneLayerContext &context)
| Unified Callback Signature.
typedef bool(* | CRM64Pro::SCENE_CameraOffsetCallback) (Scene *pScene, Sint32 iLayerID, SDL_FPoint *pOutOffset, void *pUserData)
| Camera offset callback signature.

## Typedef Documentation

## ◆ SCENE_CameraOffsetCallback

typedef bool(* CRM64Pro::SCENE_CameraOffsetCallback) (Scene *pScene, Sint32 iLayerID, SDL_FPoint *pOutOffset, void *pUserData)

Camera offset callback signature.

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