TDME2
1.9.121
src
tdme
tools
editor
controllers
ProgressBarScreenController.cpp
Go to the documentation of this file.
1
#include <
tdme/tools/editor/controllers/ProgressBarScreenController.h
>
2
3
#include <string>
4
5
#include <
tdme/tdme.h
>
6
#include <
tdme/application/Application.h
>
7
#include <
tdme/engine/Engine.h
>
8
#include <
tdme/gui/nodes/GUIElementNode.h
>
9
#include <
tdme/gui/nodes/GUINode.h
>
10
#include <
tdme/gui/nodes/GUINodeController.h
>
11
#include <
tdme/gui/nodes/GUIScreenNode.h
>
12
#include <
tdme/gui/nodes/GUITextNode.h
>
13
#include <
tdme/gui/GUI.h
>
14
#include <
tdme/gui/GUIParser.h
>
15
#include <
tdme/utilities/Console.h
>
16
#include <
tdme/utilities/Exception.h
>
17
#include <
tdme/utilities/MutableString.h
>
18
19
using
std::string;
20
21
using
tdme::application::Application
;
22
using
tdme::engine::Engine
;
23
using
tdme::gui::nodes::GUIElementNode
;
24
using
tdme::gui::nodes::GUINode
;
25
using
tdme::gui::nodes::GUINodeController
;
26
using
tdme::gui::nodes::GUIScreenNode
;
27
using
tdme::gui::nodes::GUIStyledTextNode
;
28
using
tdme::gui::nodes::GUITextNode
;
29
using
tdme::gui::GUI
;
30
using
tdme::gui::GUIParser
;
31
using
tdme::tools::editor::controllers::ProgressBarScreenController
;
32
using
tdme::utilities::Console
;
33
using
tdme::utilities::Exception
;
34
using
tdme::utilities::MutableString
;
35
36
ProgressBarScreenController::ProgressBarScreenController()
37
{
38
}
39
40
ProgressBarScreenController::~ProgressBarScreenController
() {
41
}
42
43
GUIScreenNode
*
ProgressBarScreenController::getScreenNode
()
44
{
45
return
screenNode
;
46
}
47
48
void
ProgressBarScreenController::initialize
()
49
{
50
try
{
51
screenNode
= GUIParser::parse(
"resources/engine/gui"
,
"popup_progressbar.xml"
);
52
screenNode
->
setVisible
(
false
);
53
progressBarNode
=
dynamic_cast<
GUIElementNode
*
>
(
screenNode
->
getNodeById
(
"progressbar"
));
54
progressBarParent
=
dynamic_cast<
GUIElementNode
*
>
(
screenNode
->
getNodeById
(
"progressbar_parent"
));
55
progressMessageNode
=
dynamic_cast<
GUITextNode
*
>
(
screenNode
->
getNodeById
(
"progress_message"
));
56
}
catch
(
Exception
& exception) {
57
Console::print(
string
(
"ProgressBarScreenController::initialize(): An error occurred: "
));
58
Console::println(
string
(exception.what()));
59
}
60
}
61
62
void
ProgressBarScreenController::dispose
()
63
{
64
screenNode
=
nullptr
;
65
}
66
67
void
ProgressBarScreenController::show
(
const
string
& message,
bool
showProgressBar)
68
{
69
progressMessageNode
->
setText
(
MutableString
(message));
70
if
(showProgressBar ==
true
) {
71
progressBarParent
->
getActiveConditions
().
add
(
"show-progressbar"
);
72
}
else
{
73
progressBarParent
->
getActiveConditions
().
remove
(
"show-progressbar"
);
74
}
75
screenNode
->
setVisible
(
true
);
76
progress2
(0.0f);
77
}
78
79
void
ProgressBarScreenController::progress
(
float
value) {
80
progressBarNode
->
getController
()->
setValue
(
MutableString
(value, 4));
81
Engine::getInstance()->display();
82
Engine::getInstance()->getGUI()->render();
83
Engine::getInstance()->getGUI()->handleEvents();
84
Application::swapBuffers();
85
}
86
87
void
ProgressBarScreenController::progress2
(
float
value) {
88
progressBarNode
->
getController
()->
setValue
(
MutableString
(value, 4));
89
}
90
91
void
ProgressBarScreenController::close
()
92
{
93
screenNode
->
setVisible
(
false
);
94
}
Application.h
Console.h
Engine.h
Exception.h
GUIElementNode.h
GUINodeController.h
GUINode.h
GUIParser.h
GUIScreenNode.h
GUITextNode.h
GUI.h
MutableString.h
ProgressBarScreenController.h
tdme::application::Application
Application base class, please make sure to allocate application on heap to have correct application ...
Definition:
Application.h:37
tdme::engine::Engine
Engine main class.
Definition:
Engine.h:122
tdme::gui::GUIParser
GUI parser.
Definition:
GUIParser.h:39
tdme::gui::GUI
GUI module class.
Definition:
GUI.h:66
tdme::gui::nodes::GUIElementNode
GUI element node.
Definition:
GUIElementNode.h:38
tdme::gui::nodes::GUIElementNode::getActiveConditions
GUINodeConditions & getActiveConditions()
Definition:
GUIElementNode.cpp:351
tdme::gui::nodes::GUINodeConditions::add
bool add(const string &condition)
Add a condition.
Definition:
GUINodeConditions.h:89
tdme::gui::nodes::GUINodeConditions::remove
bool remove(const string &condition)
Remove a condition.
Definition:
GUINodeConditions.h:103
tdme::gui::nodes::GUINodeController
GUI node controller base class.
Definition:
GUINodeController.h:19
tdme::gui::nodes::GUINodeController::setValue
virtual void setValue(const MutableString &value)=0
Set value.
tdme::gui::nodes::GUINode
GUI node base class.
Definition:
GUINode.h:63
tdme::gui::nodes::GUINode::getController
GUINodeController * getController()
Definition:
GUINode.h:586
tdme::gui::nodes::GUIScreenNode
GUI screen node that represents a screen that can be rendered via GUI system.
Definition:
GUIScreenNode.h:57
tdme::gui::nodes::GUIScreenNode::setVisible
void setVisible(bool visible)
Set visible.
Definition:
GUIScreenNode.cpp:120
tdme::gui::nodes::GUIScreenNode::getNodeById
GUINode * getNodeById(const string &nodeId)
Get GUI node by id.
Definition:
GUIScreenNode.h:345
tdme::gui::nodes::GUIStyledTextNode
GUI styled text node.
Definition:
GUIStyledTextNode.h:44
tdme::gui::nodes::GUITextNode
GUI text node.
Definition:
GUITextNode.h:42
tdme::gui::nodes::GUITextNode::setText
void setText(const MutableString &text)
Set text.
Definition:
GUITextNode.cpp:81
tdme::tools::editor::controllers::ProgressBarScreenController
Progress bar screen controller.
Definition:
ProgressBarScreenController.h:28
tdme::tools::editor::controllers::ProgressBarScreenController::dispose
void dispose() override
Dispose.
Definition:
ProgressBarScreenController.cpp:62
tdme::tools::editor::controllers::ProgressBarScreenController::initialize
void initialize() override
Init.
Definition:
ProgressBarScreenController.cpp:48
tdme::tools::editor::controllers::ProgressBarScreenController::progress
void progress(float value)
Show progress.
Definition:
ProgressBarScreenController.cpp:79
tdme::tools::editor::controllers::ProgressBarScreenController::getScreenNode
GUIScreenNode * getScreenNode() override
Definition:
ProgressBarScreenController.cpp:43
tdme::tools::editor::controllers::ProgressBarScreenController::close
void close()
Closes the pop up.
Definition:
ProgressBarScreenController.cpp:91
tdme::tools::editor::controllers::ProgressBarScreenController::show
void show(const string &message, bool showProgressBar=true)
Shows the pop up.
Definition:
ProgressBarScreenController.cpp:67
tdme::tools::editor::controllers::ProgressBarScreenController::progressMessageNode
GUITextNode * progressMessageNode
Definition:
ProgressBarScreenController.h:34
tdme::tools::editor::controllers::ProgressBarScreenController::progressBarParent
GUIElementNode * progressBarParent
Definition:
ProgressBarScreenController.h:33
tdme::tools::editor::controllers::ProgressBarScreenController::screenNode
GUIScreenNode * screenNode
Definition:
ProgressBarScreenController.h:31
tdme::tools::editor::controllers::ProgressBarScreenController::progress2
void progress2(float value)
Show progress 2.
Definition:
ProgressBarScreenController.cpp:87
tdme::tools::editor::controllers::ProgressBarScreenController::progressBarNode
GUIElementNode * progressBarNode
Definition:
ProgressBarScreenController.h:32
tdme::tools::editor::controllers::ProgressBarScreenController::~ProgressBarScreenController
virtual ~ProgressBarScreenController()
Destructor.
Definition:
ProgressBarScreenController.cpp:40
tdme::utilities::Console
Console class.
Definition:
Console.h:26
tdme::utilities::MutableString
Mutable string class.
Definition:
MutableString.h:16
tdme::utilities::Exception
std::exception Exception
Exception base class.
Definition:
Exception.h:19
tdme.h
Generated by
1.9.3