FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_objTilemap.hpp
1/*
2 * Copyright 2024 Guillaume Guillet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _FGE_C_OBJTILEMAP_HPP_INCLUDED
18#define _FGE_C_OBJTILEMAP_HPP_INCLUDED
19
20#include "FastEngine/fge_extern.hpp"
21#include "C_object.hpp"
22#include "FastEngine/C_tilelayer.hpp"
23#include "FastEngine/accessor/C_texture.hpp"
24
25#define FGE_OBJTILEMAP_CLASSNAME "FGE:OBJ:TILEMAP"
26
27namespace fge
28{
29
30using TileSetList = std::vector<std::shared_ptr<fge::TileSet>>;
31using TileLayerList = std::vector<std::shared_ptr<fge::TileLayer>>;
32
33class FGE_API ObjTileMap : public fge::Object
34{
35public:
36 ObjTileMap() = default;
37
38 FGE_OBJ_DEFAULT_COPYMETHOD(fge::ObjTileMap)
39
40 FGE_OBJ_DRAW_DECLARE
41
42 void clear();
43
44 TileSetList& getTileSets();
45 TileSetList const& getTileSets() const;
46
47 TileLayerList& getTileLayers();
48 TileLayerList const& getTileLayers() const;
49
50 void save(nlohmann::json& jsonObject, fge::Scene* scene) override;
51 void load(nlohmann::json& jsonObject, fge::Scene* scene) override;
52 void pack(fge::net::Packet& pck) override;
53 void unpack(fge::net::Packet const& pck) override;
54
55 char const* getClassName() const override;
56 char const* getReadableClassName() const override;
57
58 fge::RectFloat getGlobalBounds() const override;
59 fge::RectFloat getLocalBounds() const override;
60
61private:
62 TileLayerList g_layers;
63 TileSetList g_tileSets;
64};
65
66} // namespace fge
67
68#endif // _FGE_C_OBJTILEMAP_HPP_INCLUDED
Definition C_objTilemap.hpp:34
The Object class is the base class for all objects in the engine.
Definition C_object.hpp:102
A scene contain a collection of object and handle them.
Definition C_scene.hpp:450