MyGUI
3.0.1
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
src
MyGUI_ResourceManualPointer.cpp
Go to the documentation of this file.
1
7
/*
8
This file is part of MyGUI.
9
10
MyGUI is free software: you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
14
15
MyGUI is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU Lesser General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
#include "
MyGUI_Precompiled.h
"
24
#include "
MyGUI_ResourceManualPointer.h
"
25
#include "
MyGUI_StaticImage.h
"
26
#include "
MyGUI_CoordConverter.h
"
27
#include "
MyGUI_TextureUtility.h
"
28
29
namespace
MyGUI
30
{
31
32
void
ResourceManualPointer::deserialization
(
xml::ElementPtr
_node,
Version
_version)
33
{
34
Base::deserialization
(_node, _version);
35
36
IntCoord
coord;
37
38
// берем детей и крутимся, основной цикл
39
xml::ElementEnumerator
info = _node->
getElementEnumerator
();
40
while
(info.
next
(
"Property"
))
41
{
42
const
std::string& key = info->
findAttribute
(
"key"
);
43
const
std::string& value = info->
findAttribute
(
"value"
);
44
45
if
(key ==
"Point"
) mPoint =
IntPoint::parse
(value);
46
else
if
(key ==
"Size"
) mSize =
IntSize::parse
(value);
47
else
if
(key ==
"Texture"
) mTexture = value;
48
else
if
(key ==
"Coord"
) coord =
IntCoord::parse
(value);
49
}
50
51
mOffset =
CoordConverter::convertTextureCoord
(
52
coord,
53
texture_utility::getTextureSize
(mTexture));
54
}
55
56
void
ResourceManualPointer::setImage
(
StaticImage
* _image)
57
{
58
_image->
deleteAllItems
();
59
_image->
_setTextureName
(mTexture);
60
_image->
_setUVSet
(mOffset);
61
}
62
63
void
ResourceManualPointer::setPosition
(
StaticImage
* _image,
const
IntPoint
& _point)
64
{
65
_image->
setCoord
(_point.
left
- mPoint.
left
, _point.
top
- mPoint.
top
, mSize.
width
, mSize.
height
);
66
}
67
68
}
// namespace MyGUI
Generated by
1.8.1.2