TDME2  1.9.200
SoundTabView.cpp
Go to the documentation of this file.
2 
3 #include <string>
4 #include <memory>
5 
6 #include <tdme/tdme.h>
7 #include <tdme/audio/Audio.h>
9 #include <tdme/engine/Engine.h>
11 #include <tdme/gui/GUI.h>
16 #include <tdme/utilities/Console.h>
18 
19 using std::make_unique;
20 using std::string;
21 using std::unique_ptr;
22 
24 
25 using tdme::audio::Audio;
29 using tdme::gui::GUI;
35 
36 SoundTabView::SoundTabView(EditorView* editorView, const string& tabId, GUIScreenNode* screenNode, AudioEntity* audioEntity)
37 {
38  this->editorView = editorView;
39  this->tabId = tabId;
40  this->screenNode = screenNode;
41  this->popUps = editorView->getPopUps();
42  engine = unique_ptr<Engine>(Engine::createOffScreenInstance(512, 512, false, false, false));
43  engine->setSceneColor(Color4(39.0f / 255.0f, 39.0f / 255.0f, 39.0f / 255.0f, 1.0f));
44  engine->getGUI()->addScreen(screenNode->getId(), screenNode);
45  engine->getGUI()->addRenderScreen(screenNode->getId());
46  this->audio = Audio::getInstance();
47  this->audioEntity = audioEntity;
48  this->audioEntity->setFixed(true);
49 }
50 
52 }
53 
55 {
56  engine->getGUI()->handleEvents();
57 }
58 
60 {
61  engine->display();
62  engine->getGUI()->render();
63 }
64 
66 {
67  try {
68  soundTabController = make_unique<SoundTabController>(this);
72  } catch (Exception& exception) {
73  Console::println("SoundTabView::initialize(): An error occurred: " + string(exception.what()));
74  }
75  // TODO: load settings
76 }
77 
79 {
80  engine->dispose();
82 }
83 
85 }
86 
88  return engine.get();
89 }
90 
92  soundTabController->setOutlinerAddDropDownContent();
93  soundTabController->setOutlinerContent();
97 }
98 
101 }
102 
104  soundTabController->setOutlinerContent();
106 }
107 
109  audioEntity->rewind();
110  audioEntity->play();
111 }
112 
114  audioEntity->stop();
115 }
Audio entity base class.
Definition: AudioEntity.h:19
virtual void stop()=0
Stops this audio entity.
virtual void play()=0
Plays this audio entity.
virtual void rewind()=0
Rewinds this audio entity.
virtual void setFixed(bool fixed)
Set this entity fixed, means the sound will always played no matter where the position and listener i...
Definition: AudioEntity.h:96
virtual const string & getId() const
Definition: AudioEntity.h:66
Interface to audio module.
Definition: Audio.h:29
AudioEntity * getEntity(const string &id)
Returns an audio entity identified by given id.
Definition: Audio.h:145
void addEntity(AudioEntity *entity)
Adds a audio entity.
Definition: Audio.cpp:67
void removeEntity(const string &id)
Removes an audio entity.
Definition: Audio.cpp:86
Color 4 definition class.
Definition: Color4.h:18
Engine main class.
Definition: Engine.h:131
GUI module class.
Definition: GUI.h:64
const string & getId()
Definition: GUINode.h:339
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
void addTooltipRequestListener(GUITooltipRequestListener *listener)
Add tooltip request listener.
void addActionListener(GUIActionListener *listener)
Add action listener.
void restoreOutlinerState(const TabView::OutlinerState &outlinerState)
Restore outliner state.
void storeOutlinerState(TabView::OutlinerState &outlinerState)
Store outliner state.
void setDetailsContent(const string &xml)
Set details content.
void dispose() override
Disposes the view.
void display() override
Renders the view.
void reloadOutliner() override
Reload outliner.
void initialize() override
Initiates the view.
void handleInputEvents() override
Handle input events that have not yet been processed.
void updateRendering() override
Update rendering.
unique_ptr< SoundTabController > soundTabController
Definition: SoundTabView.h:48
EditorScreenController * getScreenController()
Definition: EditorView.h:69
Console class.
Definition: Console.h:29
std::exception Exception
Exception base class.
Definition: Exception.h:18