FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_objRenderMap.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_OBJRENDERMAP_HPP_INCLUDED
18#define _FGE_C_OBJRENDERMAP_HPP_INCLUDED
19
20#include "FastEngine/fge_extern.hpp"
21#include "C_object.hpp"
22#include "FastEngine/C_tunnel.hpp"
23#include "FastEngine/graphic/C_renderTexture.hpp"
24
25#define FGE_OBJRENDERMAP_CLASSNAME "FGE:OBJ:RENDERMAP"
26
27namespace fge
28{
29
30class FGE_API ObjRenderMap : public fge::Object, public fge::Subscriber
31{
32public:
36
37 fge::Object* copy() override { return new fge::ObjRenderMap(); }
38
39 void onDraw(fge::Scene const& scene, fge::RenderTarget& target);
40
41 void setClearColor(fge::Color const& color);
42 fge::Color const& getClearColor() const;
43
44 void first(fge::Scene& scene) override;
45 FGE_OBJ_UPDATE_DECLARE
46 FGE_OBJ_DRAW_DECLARE
47 void removed(fge::Scene& scene) override;
48
49 void save(nlohmann::json& jsonObject, fge::Scene* scene) override;
50 void load(nlohmann::json& jsonObject, fge::Scene* scene) override;
51 void pack(fge::net::Packet& pck) override;
52 void unpack(fge::net::Packet const& pck) override;
53
54 char const* getClassName() const override;
55 char const* getReadableClassName() const override;
56
59
60 mutable fge::RenderTexture _renderTexture;
61
62private:
63 void updatePositions();
64 void updateTexCoords();
65
66 fge::Color g_colorClear;
67
68 fge::vulkan::VertexBuffer g_vertexBuffer;
69 fge::View g_windowView;
70 fge::Vector2u g_windowSize;
71};
72
73} // namespace fge
74
75#endif // _FGE_C_OBJRENDERMAP_HPP_INCLUDED
Definition C_color.hpp:35
Definition C_objRenderMap.hpp:31
fge::RectFloat getGlobalBounds() const override
Get the global bounds of the object.
void unpack(fge::net::Packet const &pck) override
Unpack the object from a packet.
char const * getClassName() const override
Get the unique class name of the object.
void removed(fge::Scene &scene) override
Method called when the object is removed from a scene.
void first(fge::Scene &scene) override
Method called when the object is added to a scene for initialization purposes.
void pack(fge::net::Packet &pck) override
Pack the object into a packet.
void load(nlohmann::json &jsonObject, fge::Scene *scene) override
Load the object from a json object.
fge::Object * copy() override
Duplicate the object.
Definition C_objRenderMap.hpp:37
void save(nlohmann::json &jsonObject, fge::Scene *scene) override
Save the object to a json object.
fge::RectFloat getLocalBounds() const override
Get the local bounds of the object (without any transformations)
char const * getReadableClassName() const override
Get a readable version of the class name.
The Object class is the base class for all objects in the engine.
Definition C_object.hpp:102
Definition C_renderTarget.hpp:56
Definition C_renderTexture.hpp:41
A scene contain a collection of object and handle them.
Definition C_scene.hpp:450
This class is a useful utility to "link" multiple objects around.
Definition C_subscription.hpp:150
Define a camera in a 2D scene.
Definition C_view.hpp:43
Definition C_packet.hpp:70
Definition C_vertexBuffer.hpp:45