|
supertux
|
This class is responsible for drawing the level tiles. More...
#include <tilemap.hpp>
Public Member Functions | |
| TileMap (const TileSet *tileset) | |
| TileMap (const TileSet *tileset, const ReaderMapping &reader) | |
| virtual void | finish_construction () override |
| Called after all objects have been added to the Sector and the Sector is fully constructed. More... | |
| virtual std::string | get_class () const override |
| virtual const std::string | get_icon_path () const override |
| virtual std::string | get_display_name () const override |
| virtual ObjectSettings | get_settings () override |
| virtual void | after_editor_set () override |
| virtual void | update (float dt_sec) override |
| This function is called once per frame and allows the object to update it's state. More... | |
| virtual void | draw (DrawingContext &context) override |
| The GameObject should draw itself onto the provided DrawingContext if this function is called. More... | |
| virtual void | editor_update () override |
| Called each frame in the editor, used to keep linked objects together (e.g. More... | |
| void | goto_node (int node_no) |
| Move tilemap until at given node, then stop. | |
| void | start_moving () |
| Start moving tilemap. | |
| void | stop_moving () |
| Stop tilemap at next node. | |
| void | set (int width, int height, const std::vector< unsigned int > &vec, int z_pos, bool solid) |
| void | resize (int newwidth, int newheight, int fill_id=0, int xoffset=0, int yoffset=0) |
| resizes the tilemap to a new width and height (tries to not destroy the existing map) | |
| void | resize (const Size &newsize, const Size &resize_offset) |
| int | get_width () const |
| int | get_height () const |
| Size | get_size () const |
| void | set_offset (const Vector &offset_) |
| Vector | get_offset () const |
| void | move_by (const Vector &pos) |
| Vector | get_movement (bool actual) const |
| Get the movement of this tilemap. More... | |
| Vector | get_tile_position (int x, int y) const |
| Returns the position of the upper-left corner of tile (x, y) in the sector. More... | |
| Rectf | get_bbox () const |
| Rectf | get_tile_bbox (int x, int y) const |
| Rect | get_tiles_overlapping (const Rectf &rect) const |
| Returns the half-open rectangle of (x, y) tile indices that overlap the given rectangle in the sector. More... | |
| int | get_layer () const |
| void | set_layer (int layer_) |
| bool | is_solid () const |
| void | set_solid (bool solid=true) |
| Changes Tilemap's solidity, i.e. More... | |
| const Tile & | get_tile (int x, int y) const |
| const Tile & | get_tile_at (const Vector &pos) const |
| uint32_t | get_tile_id (int x, int y) const |
| uint32_t | get_tile_id_at (const Vector &pos) const |
| void | change (int x, int y, uint32_t newtile) |
| void | change_at (const Vector &pos, uint32_t newtile) |
| void | change_all (uint32_t oldtile, uint32_t newtile) |
| changes all tiles with the given ID | |
| void | set_flip (Flip flip) |
| Flip | get_flip () const |
| void | fade (float alpha, float seconds=0) |
Start fading the tilemap to opacity given by alpha. More... | |
| void | tint_fade (const Color &new_tint, float seconds=0) |
| Start fading the tilemap to tint given by RGBA. More... | |
| void | set_alpha (float alpha) |
Instantly switch tilemap's opacity to alpha. More... | |
| float | get_alpha () const |
| Return tilemap's opacity. More... | |
| void | set_tileset (const TileSet *new_tileset) |
| const std::vector< uint32_t > & | get_tiles () const |
Public Member Functions inherited from GameObject | |
| GameObject (const std::string &name) | |
| GameObject (const ReaderMapping &reader) | |
| UID | get_uid () const |
| void | save (Writer &writer) |
| This function saves the object. More... | |
| virtual bool | is_singleton () const |
| If true only a single object of this type is allowed in a given GameObjectManager. | |
| virtual bool | has_variable_size () const |
| Does this object have variable size (secret area trigger, wind, etc.) | |
| virtual bool | is_saveable () const |
| Indicates if the object will be saved. More... | |
| virtual bool | has_settings () const |
| Indicates if get_settings() is implemented. More... | |
| bool | is_valid () const |
| returns true if the object is not scheduled to be removed yet | |
| void | remove_me () |
| schedules this object to be removed at the end of the frame | |
| void | add_remove_listener (ObjectRemoveListener *listener) |
| registers a remove listener which will be called if the object gets removed/destroyed | |
| void | del_remove_listener (ObjectRemoveListener *listener) |
| unregisters a remove listener, so it will no longer be called if the object gets removed/destroyed | |
| void | set_name (const std::string &name) |
| const std::string & | get_name () const |
| virtual void | stop_looping_sounds () |
| stops all looping sounds | |
| virtual void | play_looping_sounds () |
| continues all looping sounds | |
| template<typename T > | |
| T * | get_component () |
| void | add_component (std::unique_ptr< GameObjectComponent > component) |
| void | remove_component (GameObjectComponent *component) |
| virtual void | editor_delete () |
| The editor requested the deletion of the object. | |
| virtual void | editor_select () |
| The user clicked on the object in the editor and selected it. | |
| virtual void | editor_deselect () |
| The object got deselected. | |
Public Member Functions inherited from ExposedObject< TileMap, scripting::TileMap > | |
| ExposedObject (TileMap *parent) | |
| Constructor. More... | |
| virtual void | expose (HSQUIRRELVM vm, SQInteger table_idx) override |
| Exposes the parent GameObject to the script Interface. More... | |
| virtual void | unexpose (HSQUIRRELVM vm, SQInteger table_idx) override |
| Un-exposes the parent GameObject to the script Interface. More... | |
Public Member Functions inherited from PathObject | |
| void | init_path (const ReaderMapping &mapping, bool running_default) |
| For compatibilty reasons this needs to get the GameObjects main mapping, not the (path ...) mapping. | |
| void | init_path_pos (const Vector &pos, bool running=false) |
| Path * | get_path () const |
| PathWalker * | get_walker () const |
| std::string | get_path_ref () const |
Public Attributes | |
| bool | m_editor_active |
Additional Inherited Members | |
Protected Attributes inherited from GameObject | |
| std::string | m_name |
| a name for the gameobject, this is mostly a hint for scripts and for debugging, don't rely on names being set or being unique | |
This class is responsible for drawing the level tiles.
|
overridevirtual |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
|
overridevirtual |
Called each frame in the editor, used to keep linked objects together (e.g.
platform on a path)
Reimplemented from GameObject.
| void TileMap::fade | ( | float | alpha, |
| float | seconds = 0 |
||
| ) |
Start fading the tilemap to opacity given by alpha.
Destination opacity will be reached after seconds seconds. Also influences solidity.
|
overridevirtual |
Called after all objects have been added to the Sector and the Sector is fully constructed.
If objects refer to other objects by name, those connection can be resolved here.
Reimplemented from GameObject.
| float TileMap::get_alpha | ( | ) | const |
Return tilemap's opacity.
Note that while the tilemap is fading in or out, this will return the current alpha value, not the target alpha.
|
inline |
Get the movement of this tilemap.
The collision detection code may need a non-negative y-movement. Passing `false' as the `actual' argument will provide that. Used exclusively in src/supertux/sector.cpp.
|
inline |
Returns the position of the upper-left corner of tile (x, y) in the sector.
Returns the half-open rectangle of (x, y) tile indices that overlap the given rectangle in the sector.
| void TileMap::set_alpha | ( | float | alpha | ) |
Instantly switch tilemap's opacity to alpha.
Also influences solidity.
| void TileMap::set_solid | ( | bool | solid = true | ) |
Changes Tilemap's solidity, i.e.
whether to consider it when doing collision detection.
| void TileMap::tint_fade | ( | const Color & | new_tint, |
| float | seconds = 0 |
||
| ) |
Start fading the tilemap to tint given by RGBA.
Destination opacity will be reached after seconds seconds. Doesn't influence solidity.
|
overridevirtual |
This function is called once per frame and allows the object to update it's state.
The dt_sec is the time that has passed since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode). This function is not called in the Editor.
Implements GameObject.
1.8.12