FastEngine
0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
includes
FastEngine
object
C_objSwitch.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_OBJSWITCH_HPP_INCLUDED
18
#define _FGE_C_OBJSWITCH_HPP_INCLUDED
19
20
#include "FastEngine/fge_extern.hpp"
21
#include "C_objSprite.hpp"
22
#include "C_object.hpp"
23
#include "FastEngine/C_flag.hpp"
24
25
#define FGE_OBJSWITCH_CLASSNAME "FGE:OBJ:SWITCH"
26
27
namespace
fge
28
{
29
30
class
FGE_API
ObjSwitch
:
public
fge::Object
31
{
32
public
:
33
ObjSwitch
();
34
ObjSwitch
(
fge::Texture
const
& t_on,
fge::Texture
const
& t_off, fge::Vector2f
const
& pos = fge::Vector2f());
35
36
FGE_OBJ_DEFAULT_COPYMETHOD(
fge::ObjSwitch
)
37
38
fge::Texture
const
& getTextureOn()
const
;
39
fge::Texture
const
& getTextureOff()
const
;
40
void
setTextureOn(
fge::Texture
const
& t_on);
41
void
setTextureOff(
fge::Texture
const
& t_off);
42
43
void
setColor(
fge::Color
const
& color);
44
45
void
setActiveStat(
bool
active);
46
bool
getActiveStat()
const
;
47
48
FGE_OBJ_UPDATE_DECLARE
49
FGE_OBJ_DRAW_DECLARE
50
51
void
save
(nlohmann::json& jsonObject,
fge::Scene
* scene)
override
;
52
void
load
(nlohmann::json& jsonObject,
fge::Scene
* scene)
override
;
53
void
pack
(
fge::net::Packet
& pck)
override
;
54
void
unpack
(
fge::net::Packet
const
& pck)
override
;
55
56
char
const
*
getClassName
()
const override
;
57
char
const
*
getReadableClassName
()
const override
;
58
59
fge::RectFloat
getGlobalBounds
()
const override
;
60
fge::RectFloat
getLocalBounds
()
const override
;
61
62
private
:
63
mutable
fge::ObjSprite
g_sprite;
64
65
fge::Texture
g_textureOn;
66
fge::Texture
g_textureOff;
67
68
fge::Color
g_color;
69
70
bool
g_statMouseOn =
false
;
71
bool
g_statActive =
false
;
72
73
fge::Flag
g_flag =
false
;
74
};
75
76
}
// namespace fge
77
78
#endif
// _FGE_C_OBJSWITCH_HPP_INCLUDED
fge::Color
Definition
C_color.hpp:35
fge::Flag
A class to handle flags.
Definition
C_flag.hpp:31
fge::ObjSprite
Definition
C_objSprite.hpp:30
fge::ObjSwitch
Definition
C_objSwitch.hpp:31
fge::ObjSwitch::unpack
void unpack(fge::net::Packet const &pck) override
Unpack the object from a packet.
fge::ObjSwitch::load
void load(nlohmann::json &jsonObject, fge::Scene *scene) override
Load the object from a json object.
fge::ObjSwitch::getReadableClassName
char const * getReadableClassName() const override
Get a readable version of the class name.
fge::ObjSwitch::save
void save(nlohmann::json &jsonObject, fge::Scene *scene) override
Save the object to a json object.
fge::ObjSwitch::getGlobalBounds
fge::RectFloat getGlobalBounds() const override
Get the global bounds of the object.
fge::ObjSwitch::getClassName
char const * getClassName() const override
Get the unique class name of the object.
fge::ObjSwitch::getLocalBounds
fge::RectFloat getLocalBounds() const override
Get the local bounds of the object (without any transformations)
fge::ObjSwitch::pack
void pack(fge::net::Packet &pck) override
Pack the object into a packet.
fge::Object
The Object class is the base class for all objects in the engine.
Definition
C_object.hpp:102
fge::Rect< float >
fge::Scene
A scene contain a collection of object and handle them.
Definition
C_scene.hpp:450
fge::Texture
This class is a wrapper for the texture manager to allow easy manipulation.
Definition
C_texture.hpp:36
fge::net::Packet
Definition
C_packet.hpp:70
Generated by
1.12.0