Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Graphics2D
GUI
CGUIImage.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
29
namespace
Skylicht
30
{
42
class
SKYLICHT_API CGUIImage :
public
CGUIElement
43
{
44
friend
class
CCanvas;
45
46
protected
:
47
ITexture
* m_image;
48
49
std::string m_resource;
50
std::string m_id;
51
52
core::rectf
m_sourceRect;
53
core::position2df
m_pivot;
54
55
protected
:
56
CGUIImage(CCanvas* canvas, CGUIElement* parent);
57
CGUIImage(CCanvas* canvas, CGUIElement* parent,
const
core::rectf
& rect);
58
59
public
:
60
virtual
~CGUIImage();
61
62
virtual
void
render(
CCamera
* camera);
63
64
virtual
const
core::rectf
getNativeRect();
65
66
void
setImage(
ITexture
* texture);
67
68
void
setImageResource(
const
char
* path,
const
char
* editorRefId);
69
70
const
char
* getResourceId()
71
{
72
return
m_id.c_str();
73
}
74
75
inline
ITexture
* getImage()
76
{
77
return
m_image;
78
}
79
80
inline
void
setSourceRect(
float
x,
float
y,
float
w,
float
h)
81
{
82
m_sourceRect.UpperLeftCorner.X = x;
83
m_sourceRect.UpperLeftCorner.Y = y;
84
m_sourceRect.LowerRightCorner.X = x + w;
85
m_sourceRect.LowerRightCorner.Y = y + h;
86
}
87
88
void
setPivot(
float
x,
float
y)
89
{
90
m_pivot.set(x, y);
91
}
92
93
const
core::position2df
& getPivot()
94
{
95
return
m_pivot;
96
}
97
98
virtual
CObjectSerializable
* createSerializable();
99
100
virtual
void
loadSerializable(
CObjectSerializable
*
object
);
101
102
DECLARE_GETTYPENAME(CGUIImage)
103
};
104
}
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
irr::video::ITexture
Interface of a Video Driver dependent Texture.
Definition
ITexture.h:119
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
irr::core::position2df
vector2d< f32 > position2df
Definition
position2d.h:21
Generated by
1.17.0