EPOK RUNTIME
World2D Components
world2d_components.hpp · the world2d components 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 components module.
Include this module
C++ include
#include "world2d_components.hpp"Types
Camera2DComponent---- Camera2D -------------------------------------------------------------------------- Follows its owner's world position.ClassCharacterBody2DComponentThe move_and_slide contract on the bounded World2D solver: `velocity` is in pixels per second, `up_direction` defaults to screen up (0, -1), and the body moves through its actor's first solid Collider2D.ClassCollider2DComponent---- Collider2D ------------------------------------------------------------------------ One box or circle placed at the owner's world position plus `shape.offset` (the offset turns and scales with the owner; box extents scale but stay axis-aligned).ClassLinkIntrusive list link.Class templateListClass template declared by the world2d-components module for the world2d components module.Class templateSprite2DComponent---- Sprite2D -------------------------------------------------------------------------- One textured quad, optionally animated by cooked frame clips (a still sprite and a frame-animated sprite in one component).ClassFunctions and methods
~Camera2DComponentReleases the resources owned by `epok::Camera2DComponent`.destructor~CharacterBody2DComponentReleases the resources owned by `epok::CharacterBody2DComponent`.destructor~Collider2DComponentReleases the resources owned by `epok::Collider2DComponent`.destructor~Sprite2DComponentReleases the resources owned by `epok::Sprite2DComponent`.destructoraddAdds add as part of the world2d components module.MethodadvanceAdvances the playing clip by one simulation step.Methodanimation_countPerforms `animation count` as part of the world2d components module.Methodclass_idPerforms `class id` as part of the world2d components module.Methodclass_idPerforms `class id` as part of the world2d components module.Methodclass_idPerforms `class id` as part of the world2d components module.Methodclass_idPerforms `class id` as part of the world2d components module.Methodclear_limitsClears limits as part of the world2d components module.Methodcollision_layerPerforms `collision layer` as part of the world2d components module.Methodcollision_maskPerforms `collision mask` as part of the world2d components module.Methodcurrent_animationPerforms `current animation` as part of the world2d components module.Methodcurrent_framePerforms `current frame` as part of the world2d components module.MethodeachSafe against the visited item unlinking itself.Function templatefindThe first component of type T on `actor`, or null.Function templatefollowOne simulation step towards `target` (the owner's world position).Methodget_zoomReturns zoom as part of the world2d components module.Methodis_currentReports whether current as part of the world2d components module.Methodis_enabledReports whether enabled as part of the world2d components module.Methodis_flipped_hReports whether flipped h as part of the world2d components module.Methodis_on_ceilingReports whether on ceiling as part of the world2d components module.Methodis_on_floorReports whether on floor as part of the world2d components module.Methodis_on_wallReports whether on wall as part of the world2d components module.Methodis_playingReports whether playing as part of the world2d components module.Methodis_triggerReports whether trigger as part of the world2d components module.Methodis_visibleReports whether visible as part of the world2d components module.Methodlast_collision_actorPerforms `last collision actor` as part of the world2d components module.Methodlast_collision_is_tileWhether the last collision was a tile of a TileMapLayer (last_collision_actor is its actor).Methodlast_motion_xPerforms `last motion x` as part of the world2d components module.Methodlast_motion_yPerforms `last motion y` as part of the world2d components module.Methodlast_tile_xCell column / row of that tile.Methodlast_tile_yPerforms `last tile y` as part of the world2d components module.Methodlevel_attachedPerforms `level attached` as part of the world2d components module.Methodlevel_attachedPerforms `level attached` as part of the world2d components module.Methodlevel_attachedPerforms `level attached` as part of the world2d components module.Methodlevel_attachedPerforms `level attached` as part of the world2d components module.MethodLink<T>Constructs `epok::world2d::Link` for the world2d components module.constructormake_currentPerforms `make current` as part of the world2d components module.Methodmove_and_collideMoves by an explicit displacement (pixels) and stops at the first obstacle.Methodmove_and_slideMoves by velocity * step, slides along what it hits, zeroes the velocity components pushing into the obstacle and refreshes the floor/wall/ceiling state.Methodmove_and_slide_stepExplicit-step adapter over the same solver, snap and classification path.Methodoperator=Performs `operator =` as part of the world2d components module.MethodpausePauses pause as part of the world2d components module.MethodplayStarts play as part of the world2d components module.Methodplay_namedC++ convenience: play a clip by its authored name.MethodremoveRemoves remove as part of the world2d components module.Methodreset_smoothingJump to the target this step instead of smoothing towards it.Methodresolve_scene2dPerforms `resolve scene2d` as part of the world2d components module.Functionroot_ofThe root SceneComponent2D of a component's owner, or null.Functionscreen_center_xPerforms `screen center x` as part of the world2d components module.Methodscreen_center_yPerforms `screen center y` as part of the world2d components module.Methodset_box_sizeFull box size in pixels (width, height), centred on the shape offset.Methodset_circle_radiusSets circle radius as part of the world2d components module.Methodset_collision_layerSets collision layer as part of the world2d components module.Methodset_collision_maskSets collision mask as part of the world2d components module.Methodset_enabledSets enabled as part of the world2d components module.Methodset_flip_hSets flip h as part of the world2d components module.Methodset_flip_vSets flip v as part of the world2d components module.Methodset_frameSets frame as part of the world2d components module.Methodset_limitsSets limits as part of the world2d components module.Methodset_modulateSets modulate as part of the world2d components module.Methodset_offsetSets offset as part of the world2d components module.Methodset_speed_scaleSets speed scale as part of the world2d components module.Methodset_texture_regionSets texture region as part of the world2d components module.Methodset_velocitySets velocity as part of the world2d components module.Methodset_viewportShows the picture of the SubViewport2D on `actor` (an empty id: the texture again).Methodset_visibleSets visible as part of the world2d components module.Methodset_z_indexSets z index as part of the world2d components module.Methodset_zoomSets zoom as part of the world2d components module.MethodshakeShakes the view by up to `amplitude` pixels, fading out over `seconds`.Methodsolid_collider_ofPerforms `solid collider of` as part of the world2d components module.Functionsource_rectThe texel rectangle drawn this frame, given the texture size.Methodstep_secondsPerforms `step seconds` as part of the world2d components module.FunctionstopStops stop as part of the world2d components module.Methodtake_animation_finishedTrue once after a non-looping clip reached its last frame.Methodtake_frame_eventThe event id of the last frame entered (0 = none), reported once.Methodvelocity_xPerforms `velocity x` as part of the world2d components module.Methodvelocity_yPerforms `velocity y` as part of the world2d components module.MethodviewThe Camera2D the renderer projects through.Methodworld_ofWorld matrix of the owner's root, following SceneComponent2D attachments.FunctionFields, variables and values
animationExposes `animation` on `epok::Sprite2DComponent` for the world2d components module.FieldbackgroundClear colour used when no 3D camera paints the background.FieldblendExposes `blend` on `epok::Sprite2DComponent` for the world2d components module.Fieldblocked_velocityThe velocity the last move_and_slide lost against what it hit, and the actor of the wall it hit (characters push rigid bodies with them).FieldbodiesExposes `bodies` on the `epok::world2d` namespace for the world2d components module.VariablecamerasExposes `cameras` on the `epok::world2d` namespace for the world2d components module.VariablecenteredExposes `centered` on `epok::Sprite2DComponent` for the world2d components module.Fieldclip_countExposes `clip_count` on `epok::Sprite2DComponent` for the world2d components module.FieldclipsCooked frame clips (SpriteFrames).FieldcollidersExposes `colliders` on the `epok::world2d` namespace for the world2d components module.Variablecollision_maskExposes `collision_mask` on `epok::CharacterBody2DComponent` for the world2d components module.FieldcountExposes `count` on `epok::world2d::List` for the world2d components module.FieldcurrentExposes `current` on `epok::Camera2DComponent` for the world2d components module.Fielddrag_enabledExposes `drag_enabled` on `epok::Camera2DComponent` for the world2d components module.Fielddrag_marginsLeft, top, right, bottom fractions (0..1) of the half view the target may move freely.FieldelapsedExposes `elapsed` on `epok::Sprite2DComponent` for the world2d components module.FieldfinishedExposes `finished` on `epok::Sprite2DComponent` for the world2d components module.Fieldflip_hExposes `flip_h` on `epok::Sprite2DComponent` for the world2d components module.Fieldflip_vExposes `flip_v` on `epok::Sprite2DComponent` for the world2d components module.FieldfloatingFloating bodies (top-down games) treat every collision as a wall.Fieldfloor_max_angleExposes `floor_max_angle` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldfloor_snap_lengthExposes `floor_snap_length` on `epok::CharacterBody2DComponent` for the world2d components module.FieldframeExposes `frame` on `epok::Sprite2DComponent` for the world2d components module.FieldheadExposes `head` on `epok::world2d::List` for the world2d components module.FieldhframesExposes `hframes` on `epok::Sprite2DComponent` for the world2d components module.FieldinitializedExposes `initialized` on `epok::Camera2DComponent` for the world2d components module.Fieldlast_colliderExposes `last_collider` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlast_hit_tileExposes `last_hit_tile` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlast_motionExposes `last_motion` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlast_tileCell of the last tile hit, when the last collision was a TileMapLayer.FieldlimitsLeft, top, right, bottom world pixels the view must stay inside.Fieldlimits_enabledExposes `limits_enabled` on `epok::Camera2DComponent` for the world2d components module.Fieldlink2dExposes `link2d` on `epok::Camera2DComponent` for the world2d components module.Fieldlink2dExposes `link2d` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlink2dExposes `link2d` on `epok::Collider2DComponent` for the world2d components module.Fieldlink2dExposes `link2d` on `epok::Sprite2DComponent` for the world2d components module.FieldlinkedExposes `linked` on `epok::world2d::Link` for the world2d components module.FieldmodulateExposes `modulate` on `epok::Sprite2DComponent` for the world2d components module.FieldnextExposes `next` on `epok::world2d::Link` for the world2d components module.FieldoffsetExposes `offset` on `epok::Camera2DComponent` for the world2d components module.FieldoffsetExposes `offset` on `epok::Sprite2DComponent` for the world2d components module.Fieldon_ceilingExposes `on_ceiling` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldon_floorExposes `on_floor` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldon_wallExposes `on_wall` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldpending_eventExposes `pending_event` on `epok::Sprite2DComponent` for the world2d components module.FieldplayingExposes `playing` on `epok::Sprite2DComponent` for the world2d components module.FieldpositionResolved state, owned by the service.FieldprevExposes `prev` on `epok::world2d::Link` for the world2d components module.FieldregionExposes `region` on `epok::Sprite2DComponent` for the world2d components module.FieldrotatingExposes `rotating` on `epok::Camera2DComponent` for the world2d components module.FieldrotationExposes `rotation` on `epok::Camera2DComponent` for the world2d components module.Fieldshake_amplitudeExposes `shake_amplitude` on `epok::Camera2DComponent` for the world2d components module.Fieldshake_durationExposes `shake_duration` on `epok::Camera2DComponent` for the world2d components module.Fieldshake_seedExposes `shake_seed` on `epok::Camera2DComponent` for the world2d components module.Fieldshake_timeExposes `shake_time` on `epok::Camera2DComponent` for the world2d components module.FieldshapeExposes `shape` on `epok::Collider2DComponent` for the world2d components module.FieldslotIndex in the collision world for the current step, or -1.FieldsmoothingExposes `smoothing` on `epok::Camera2DComponent` for the world2d components module.Fieldsmoothing_speedExposes `smoothing_speed` on `epok::Camera2DComponent` for the world2d components module.Fieldspeed_scaleExposes `speed_scale` on `epok::Sprite2DComponent` for the world2d components module.FieldspritesExposes `sprites` on the `epok::world2d` namespace for the world2d components module.Variablestatic_class_idExposes `static_class_id` on `epok::Camera2DComponent` for the world2d components module.Variablestatic_class_idExposes `static_class_id` on `epok::CharacterBody2DComponent` for the world2d components module.Variablestatic_class_idExposes `static_class_id` on `epok::Collider2DComponent` for the world2d components module.Variablestatic_class_idExposes `static_class_id` on `epok::Sprite2DComponent` for the world2d components module.VariabletailExposes `tail` on `epok::world2d::List` for the world2d components module.FieldtextureAuthored state.Fieldtile_cell_atThe tile map cell behind a collision index, installed by the service when tile maps collide: false when `index` is an ordinary collider.Variableup_directionExposes `up_direction` on `epok::CharacterBody2DComponent` for the world2d components module.FieldvelocityExposes `velocity` on `epok::CharacterBody2DComponent` for the world2d components module.FieldvframesExposes `vframes` on `epok::Sprite2DComponent` for the world2d components module.FieldviewportAn actor with a SubViewport2D: its picture replaces the texture.FieldvisibleExposes `visible` on `epok::Sprite2DComponent` for the world2d components module.Fieldwall_colliderExposes `wall_collider` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldy_sortExposes `y_sort` on `epok::Sprite2DComponent` for the world2d components module.Fieldz_indexExposes `z_index` on `epok::Sprite2DComponent` for the world2d components module.FieldzoomExposes `zoom` on `epok::Camera2DComponent` for the world2d components module.Field