Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Graphics2D
GUI
CGUIFitSprite.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2019 Skylicht Technology CO., LTD
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
#pragma once
26
27
#include "CGUIElement.h"
28
#include "Graphics2D/SpriteFrame/CSpriteFrame.h"
29
30
namespace
Skylicht
31
{
48
class
SKYLICHT_API CGUIFitSprite :
public
CGUIElement
49
{
50
friend
class
CCanvas;
51
public
:
52
enum
AnchorType
53
{
54
AnchorAll,
55
AnchorLeftRight,
56
AnchorTopBottom
57
};
58
59
protected
:
60
SFrame
* m_frame;
61
62
std::string m_guid;
63
std::string m_frameName;
64
std::string m_sprite;
65
std::string m_spriteId;
66
67
AnchorType m_anchorType;
68
69
float
m_anchorLeft;
70
float
m_anchorRight;
71
float
m_anchorTop;
72
float
m_anchorBottom;
73
74
protected
:
75
CGUIFitSprite(CCanvas* canvas, CGUIElement* parent,
SFrame
* frame);
76
CGUIFitSprite(CCanvas* canvas, CGUIElement* parent,
const
core::rectf
& rect,
SFrame
* frame);
77
78
public
:
79
virtual
~CGUIFitSprite();
80
81
virtual
void
update(
CCamera
* camera);
82
83
virtual
void
render(
CCamera
* camera);
84
85
void
reloadSpriteFrame();
86
87
void
setFrameSource(
const
char
* spritePath,
const
char
* frameName,
const
char
* editorFileRef = NULL);
88
89
inline
void
setFrame(
SFrame
* frame)
90
{
91
m_frame = frame;
92
}
93
94
inline
SFrame
* getFrame()
95
{
96
return
m_frame;
97
}
98
99
inline
const
char
* getFrameName()
100
{
101
return
m_frameName.c_str();
102
}
103
104
inline
const
char
* getSpriteName()
105
{
106
return
m_sprite.c_str();
107
}
108
109
inline
const
char
* getSpriteId()
110
{
111
return
m_spriteId.c_str();
112
}
113
114
inline
const
char
* getFrameId()
115
{
116
return
m_guid.c_str();
117
}
118
119
void
setAnchor(AnchorType type,
float
left,
float
right,
float
top,
float
bottom);
120
121
virtual
CObjectSerializable
* createSerializable();
122
123
virtual
void
loadSerializable(
CObjectSerializable
*
object
);
124
125
DECLARE_GETTYPENAME(CGUIFitSprite)
126
};
127
}
Skylicht::CCamera
This is an object class used to set up the camera, including its position, viewing angle,...
Definition
CCamera.h:70
Skylicht::CObjectSerializable
Definition
CObjectSerializable.h:36
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
irr::core::rectf
rect< f32 > rectf
Rectangle with float values.
Definition
rect.h:271
Skylicht::SFrame
Definition
CSpriteFrame.h:93
Generated by
1.17.0