TDME2  1.9.200
EmptyEditorTabView.cpp
Go to the documentation of this file.
2 
3 #include <memory>
4 #include <string>
5 
6 #include <tdme/tdme.h>
9 #include <tdme/engine/Engine.h>
10 #include <tdme/engine/Timing.h>
11 #include <tdme/math/Vector3.h>
19 #include <tdme/utilities/Console.h>
21 
22 using std::make_unique;
23 using std::string;
24 using std::unique_ptr;
25 
27 
40 
41 EmptyEditorTabView::EmptyEditorTabView(EditorView* editorView, const string& tabId, Prototype* prototype)
42 {
43  this->editorView = editorView;
44  this->tabId = tabId;
45  this->popUps = editorView->getPopUps();
46  this->prototype = unique_ptr<Prototype>(prototype);
47  engine = unique_ptr<Engine>(Engine::createOffScreenInstance(512, 512, true, true, false));
48  engine->setShadowMapLightEyeDistanceScale(0.1f);
49  engine->setSceneColor(Color4(39.0f / 255.0f, 39.0f / 255.0f, 39.0f / 255.0f, 1.0f));
50  Vector3 objectScale;
51  cameraRotationInputHandler = make_unique<CameraRotationInputHandler>(engine.get());
52  Tools::setupPrototype(prototype, engine.get(), cameraRotationInputHandler->getLookFromRotations(), 1, objectScale, cameraRotationInputHandler.get());
54 }
55 
57 }
58 
60 {
61 }
62 
64 {
65  emptyEditorTabController->updateInfoText(MutableString(engine->getTiming()->getAvarageFPS()).append(" FPS"));
66  engine->display();
67 }
68 
70 {
71  try {
72  emptyEditorTabController = make_unique<EmptyEditorTabController>(this);
74  } catch (Exception& exception) {
75  Console::println("EmptyEditorTabView::initialize(): An error occurred: " + string(exception.what()));
76  }
77  // TODO: load settings
78 }
79 
81 {
82  engine->reset();
83 }
84 
86 }
87 
89  return engine.get();
90 }
91 
93  emptyEditorTabController->setOutlinerAddDropDownContent();
94  emptyEditorTabController->setOutlinerContent();
97 }
98 
101 }
102 
104  emptyEditorTabController->setOutlinerContent();
106 }
107 
108 void EmptyEditorTabView::saveFile(const string& pathName, const string& fileName) {
109  PrototypeWriter::write(pathName, fileName, prototype.get());
110 }
Color 4 definition class.
Definition: Color4.h:18
Engine main class.
Definition: Engine.h:131
Timing class.
Definition: Timing.h:16
Prototype definition.
Definition: Prototype.h:55
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
void restoreOutlinerState(const TabView::OutlinerState &outlinerState)
Restore outliner state.
void storeOutlinerState(TabView::OutlinerState &outlinerState)
Store outliner state.
Pop ups controller accessor class.
Definition: PopUps.h:29
void saveFile(const string &pathName, const string &fileName)
Saving prototype as tempty prototype.
void handleInputEvents() override
Handle input events that have not yet been processed.
unique_ptr< CameraRotationInputHandler > cameraRotationInputHandler
unique_ptr< EmptyEditorTabController > emptyEditorTabController
EditorScreenController * getScreenController()
Definition: EditorView.h:69
Console class.
Definition: Console.h:29
Mutable utf8 aware string class.
Definition: MutableString.h:23
MutableString & append(char c)
Append character.
std::exception Exception
Exception base class.
Definition: Exception.h:18