Epok Engine

EPOK RUNTIME

World2D Tiles

world2d_tiles.hpp · the world2d tiles module

Declarations are extracted from the pinned headers. Examples and general guidance are generated sketches, not verified complete programs; consult the linked source and guides for the actual contract.

Module

the world2d tiles module.

Header
world2d_tiles.hpp
Include
#include "world2d_tiles.hpp"
Stability
Epok runtime API

Include this module

C++ include
#include "world2d_tiles.hpp"

Types

CanvasThe canvas a drawable belongs to, resolved through its owner's attachment chain.StructCanvasLayer2DComponent---- CanvasLayer2D ---------------------------------------------------------------------- Puts its actor and everything attached to it on canvas `layer`: layers draw in ascending order and the default world canvas is layer 0.ClassCanvasModulate2DComponent---- CanvasModulate2D ------------------------------------------------------------------- Multiplies the colour of everything drawn on its canvas (255 leaves it unchanged): night scenes, flashes, fades of a whole layer.ClassDepth2DComponent---- Depth2D ---------------------------------------------------------------------------- Draws the sprites and tile layers of its actor, and of everything attached to it, inside the 3D world instead of over it: they join the 3D ordering table at one camera depth, so 3D geometry behind that depth is hidden by their opaque texels and geometry in front covers them.ClassParallax2DComponent---- Parallax2D ------------------------------------------------------------------------- Moves its actor so the layer scrolls at `scroll_scale` times the camera's speed: 1 moves with the world, 0 stays on screen, 0.5 is a distant layer.ClassTileCollisionEnum declared by the world2d-tiles module for the world2d tiles module.EnumTileHooksInstalled by the service: runtime cell edits live there, so a build without 2D content carries no edit table.StructTileInfoOne tile of a cooked TileSet.StructTileMapLayerComponent---- TileMapLayer -----------------------------------------------------------------------ClassTileSetDataStruct declared by the world2d-tiles module for the world2d tiles module.Struct

Functions and methods

~CanvasLayer2DComponentReleases the resources owned by `epok::CanvasLayer2DComponent`.destructor~CanvasModulate2DComponentReleases the resources owned by `epok::CanvasModulate2DComponent`.destructor~Depth2DComponentReleases the resources owned by `epok::Depth2DComponent`.destructor~Parallax2DComponentReleases the resources owned by `epok::Parallax2DComponent`.destructor~TileMapLayerComponentReleases the resources owned by `epok::TileMapLayerComponent`.destructorcanvas_ofWalks from `component`'s owner up its attachments.FunctioncellThe value of a cell, runtime edits included.Methodclass_idPerforms `class id` as part of the world2d tiles module.Methodclass_idPerforms `class id` as part of the world2d tiles module.Methodclass_idPerforms `class id` as part of the world2d tiles module.Methodclass_idPerforms `class id` as part of the world2d tiles module.Methodclass_idPerforms `class id` as part of the world2d tiles module.Methodcooked_cellThe cooked value of a cell, ignoring runtime edits.Methoddepth_bucketThe bucket of camera-space depth `z` (Q12), moved by `bias` buckets and clamped to the table: the bucket a 3D triangle averaging that depth falls in.Functiondepth_ofThe nearest enabled, active Depth2D on `component`'s owner or up its attachments.Functionerase_cellPerforms `erase cell` as part of the world2d tiles module.Methodfloor_cellsFloor division of a Q12 distance by a whole number of pixels.FunctionfollowOne simulation step: `camera` is the active camera's centre (or 0, 0 without one).Methodget_anchorReturns anchor as part of the world2d tiles module.Methodget_biasReturns bias as part of the world2d tiles module.Methodget_cell_atlas_xAtlas column of the cell's tile, or -1 when the cell is empty.Methodget_cell_atlas_yAtlas row of the cell's tile, or -1 when the cell is empty.Methodget_cell_custom_dataCustom data layer `layer` of the cell's tile; 0 for an empty cell or unknown layer.Methodget_distanceReturns distance as part of the world2d tiles module.Methodget_layerReturns layer as part of the world2d tiles module.Methodis_cell_emptyReports whether cell empty as part of the world2d tiles module.Methodis_cell_solidWhether the cell's tile blocks bodies (full, rectangle or one-way collision).Methodis_enabledReports whether enabled as part of the world2d tiles module.Methodis_under_3dReports whether under 3d as part of the world2d tiles module.Methodis_visibleReports whether visible as part of the world2d tiles module.Methodis_visibleReports whether visible as part of the world2d tiles module.Methodlevel_attachedPerforms `level attached` as part of the world2d tiles module.Methodlevel_attachedPerforms `level attached` as part of the world2d tiles module.Methodlevel_attachedPerforms `level attached` as part of the world2d tiles module.Methodlevel_attachedPerforms `level attached` as part of the world2d tiles module.Methodlevel_attachedPerforms `level attached` as part of the world2d tiles module.Methodmap_to_world_xWorld X / Y of a cell's centre.Methodmap_to_world_yPerforms `map to world y` as part of the world2d tiles module.MethodoriginWorld pixels of the grid origin (cell 0, 0's top-left corner).Methodset_anchorA 3D actor whose position gives the depth; an empty id returns to `distance`.Methodset_autoscrollSets autoscroll as part of the world2d tiles module.Methodset_biasSets bias as part of the world2d tiles module.Methodset_cellPlaces the atlas tile (atlas_x, atlas_y) in a cell.Methodset_cell_flippedSame as set_cell, keeping the flip flags: flip_h, flip_v and transpose.Methodset_collision_enabledSets collision enabled as part of the world2d tiles module.Methodset_colorSets color as part of the world2d tiles module.Methodset_distanceWorld units in front of the 3D camera, 0 to 128 (the far end of the ordering table).Methodset_enabledSets enabled as part of the world2d tiles module.Methodset_follow_viewportSets follow viewport as part of the world2d tiles module.Methodset_layerSets layer as part of the world2d tiles module.Methodset_modulateSets modulate as part of the world2d tiles module.Methodset_offsetSets offset as part of the world2d tiles module.Methodset_repeat_sizeSets repeat size as part of the world2d tiles module.Methodset_scroll_scaleSets scroll scale as part of the world2d tiles module.Methodset_under_3dSets under 3d as part of the world2d tiles module.Methodset_visibleSets visible as part of the world2d tiles module.Methodset_visibleSets visible as part of the world2d tiles module.Methodset_z_indexSets z index as part of the world2d tiles module.Methodtile_heightPerforms `tile height` as part of the world2d tiles module.Methodtile_ofPerforms `tile of` as part of the world2d tiles module.Methodtile_widthPerforms `tile width` as part of the world2d tiles module.Methodworld_to_map_xThe cell column containing world X / the cell row containing world Y.Methodworld_to_map_yPerforms `world to map y` as part of the world2d tiles module.Method

Fields, variables and values

anchorExposes `anchor` on `epok::Depth2DComponent` for the world2d tiles module.Fieldatlascolumn, row in the atlas gridFieldautoscrollExposes `autoscroll` on `epok::Parallax2DComponent` for the world2d tiles module.FieldbaseResolved state, owned by the service.FieldbiasExposes `bias` on `epok::Depth2DComponent` for the world2d tiles module.FieldblendExposes `blend` on `epok::TileMapLayerComponent` for the world2d tiles module.Fieldcanvas_layersExposes `canvas_layers` on the `epok::world2d` namespace for the world2d tiles module.Variablecanvas_modulatesExposes `canvas_modulates` on the `epok::world2d` namespace for the world2d tiles module.Variablecellstile_chunk_cells values per cooked chunkFieldcollisionExposes `collision` on `epok::TileInfo` for the world2d tiles module.Fieldcollision_enabledExposes `collision_enabled` on `epok::TileMapLayerComponent` for the world2d tiles module.Fieldcollision_layerExposes `collision_layer` on `epok::TileMapLayerComponent` for the world2d tiles module.FieldcolorExposes `color` on `epok::CanvasModulate2DComponent` for the world2d tiles module.Fieldcolumnsframes per atlas row before wrapping; 0 = never wrapsFieldcustomExposes `custom` on `epok::TileSetData` for the world2d tiles module.Fieldcustom_count`custom_count` integers per tile (custom data layers), tile-major.Fielddepth_bucketsThe 3D world's ordering table: buckets of a quarter world unit of camera depth, from the camera to 128 units (runtime/main.cpp asserts that its table matches).VariabledepthsExposes `depths` on the `epok::world2d` namespace for the world2d tiles module.VariabledistanceExposes `distance` on `epok::Depth2DComponent` for the world2d tiles module.FielddriftExposes `drift` on `epok::Parallax2DComponent` for the world2d tiles module.Fieldedit_countRuntime identity in the edit table and the number of edits it holds there.FieldenabledExposes `enabled` on `epok::Depth2DComponent` for the world2d tiles module.Fieldflagstile_one_wayFieldfollow_viewportExposes `follow_viewport` on `epok::CanvasLayer2DComponent` for the world2d tiles module.FieldforgetExposes `forget` on `epok::world2d::TileHooks` for the world2d tiles module.Fieldframe_secondsExposes `frame_seconds` on `epok::TileInfo` for the world2d tiles module.Fieldframesanimation frames, laid out to the right of the tileFieldFullNamed value `Full` in `epok::TileCollision`.Enum valuegridchunk index per grid slot, -1 when emptyFieldgrid_originchunk coordinates of grid slot 0Fieldgrid_sizeExposes `grid_size` on `epok::TileMapLayerComponent` for the world2d tiles module.FieldinitializedExposes `initialized` on `epok::Parallax2DComponent` for the world2d tiles module.FieldlayerExposes `layer` on `epok::CanvasLayer2DComponent` for the world2d tiles module.FieldlayerExposes `layer` on `epok::world2d::Canvas` for the world2d tiles module.Fieldlink2dExposes `link2d` on `epok::CanvasLayer2DComponent` for the world2d tiles module.Fieldlink2dExposes `link2d` on `epok::CanvasModulate2DComponent` for the world2d tiles module.Fieldlink2dExposes `link2d` on `epok::Depth2DComponent` for the world2d tiles module.Fieldlink2dExposes `link2d` on `epok::Parallax2DComponent` for the world2d tiles module.Fieldlink2dExposes `link2d` on `epok::TileMapLayerComponent` for the world2d tiles module.FieldlookupOverrides `value` with the edit of (x, y), when one exists.FieldmodulateExposes `modulate` on `epok::TileMapLayerComponent` for the world2d tiles module.FieldNoneNamed value `None` in `epok::TileCollision`.Enum valueoffsetExposes `offset` on `epok::CanvasLayer2DComponent` for the world2d tiles module.Fieldoffsetscreen-space shift of a screen canvasFieldparallaxExposes `parallax` on `epok::world2d::Canvas` for the world2d tiles module.FieldparallaxesExposes `parallaxes` on the `epok::world2d` namespace for the world2d tiles module.Variablerectcollision rectangle inside the tile (x, y, w, h)FieldRectNamed value `Rect` in `epok::TileCollision`.Enum valuereferenceExposes `reference` on `epok::Parallax2DComponent` for the world2d tiles module.Fieldrepeat_sizeExposes `repeat_size` on `epok::Parallax2DComponent` for the world2d tiles module.Fieldscreendrawn in screen pixels, ignoring the cameraFieldscroll_scaleExposes `scroll_scale` on `epok::Parallax2DComponent` for the world2d tiles module.FieldslotRuntime identity in the edit table and the number of edits it holds there.Fieldstatic_class_idExposes `static_class_id` on `epok::CanvasLayer2DComponent` for the world2d tiles module.Variablestatic_class_idExposes `static_class_id` on `epok::CanvasModulate2DComponent` for the world2d tiles module.Variablestatic_class_idExposes `static_class_id` on `epok::Depth2DComponent` for the world2d tiles module.Variablestatic_class_idExposes `static_class_id` on `epok::Parallax2DComponent` for the world2d tiles module.Variablestatic_class_idExposes `static_class_id` on `epok::TileMapLayerComponent` for the world2d tiles module.VariablestoreRecords an edit; false when the edit table is full.Fieldstridetexels between two frames (tile size plus separation)FieldtextureExposes `texture` on `epok::TileMapLayerComponent` for the world2d tiles module.Fieldtile_chunk_cellsExposes `tile_chunk_cells` on the `epok` namespace for the world2d tiles module.Variabletile_chunk_shiftExposes `tile_chunk_shift` on the `epok` namespace for the world2d tiles module.Variabletile_clockSeconds of animation time shared by every animated tile, advanced by the service.Variabletile_countExposes `tile_count` on `epok::TileSetData` for the world2d tiles module.Fieldtile_flip_hExposes `tile_flip_h` on the `epok` namespace for the world2d tiles module.Variabletile_flip_vExposes `tile_flip_v` on the `epok` namespace for the world2d tiles module.Variabletile_heightExposes `tile_height` on `epok::TileSetData` for the world2d tiles module.Fieldtile_hooksExposes `tile_hooks` on the `epok::world2d` namespace for the world2d tiles module.Variabletile_index_maskExposes `tile_index_mask` on the `epok` namespace for the world2d tiles module.Variabletile_layer_serialExposes `tile_layer_serial` on the `epok::world2d` namespace for the world2d tiles module.Variabletile_layersExposes `tile_layers` on the `epok::world2d` namespace for the world2d tiles module.Variabletile_one_wayExposes `tile_one_way` on the `epok` namespace for the world2d tiles module.Variabletile_transposeExposes `tile_transpose` on the `epok` namespace for the world2d tiles module.Variabletile_widthExposes `tile_width` on `epok::TileSetData` for the world2d tiles module.FieldtilesExposes `tiles` on `epok::TileSetData` for the world2d tiles module.FieldtilesetAuthored state, cooked by the editor.Fieldutop-left texel of the first animation frameFieldunder_3dExposes `under_3d` on `epok::CanvasLayer2DComponent` for the world2d tiles module.Fieldunder_3ddrawn before the other canvases and the 3D worldFieldvtop-left texel of the first animation frameFieldvisibleExposes `visible` on `epok::CanvasLayer2DComponent` for the world2d tiles module.FieldvisibleExposes `visible` on `epok::TileMapLayerComponent` for the world2d tiles module.FieldvisibleExposes `visible` on `epok::world2d::Canvas` for the world2d tiles module.Fieldz_indexExposes `z_index` on `epok::TileMapLayerComponent` for the world2d tiles module.Field