unrelate view and model

This commit is contained in:
Irlan 2018-04-12 22:59:41 -03:00
parent 9ae1a9a627
commit 960dfd6298
2 changed files with 12 additions and 13 deletions

View File

@ -114,7 +114,6 @@ static inline void ImGui_GLFW_GL_RenderDrawData(ImDrawData* draw_data)
View::View(GLFWwindow* window, Model* model) : m_presenter(model, this) View::View(GLFWwindow* window, Model* model) : m_presenter(model, this)
{ {
m_window = window; m_window = window;
m_model = model;
// Create UI // Create UI
ImGui::CreateContext(); ImGui::CreateContext();
@ -220,9 +219,10 @@ void View::Command_PreDraw()
void View::Command_Draw() void View::Command_Draw()
{ {
Camera& camera = m_model->m_camera; Model* model = m_presenter.m_model;
Settings& settings = m_model->m_settings; Settings& settings = model->m_settings;
TestSettings& testSettings = m_model->m_testSettings; TestSettings& testSettings = model->m_testSettings;
Camera& camera = model->m_camera;
bool openControls = false; bool openControls = false;
bool openAbout = false; bool openAbout = false;
@ -232,7 +232,7 @@ void View::Command_Draw()
{ {
if (ImGui::MenuItem("Save")) if (ImGui::MenuItem("Save"))
{ {
m_model->Action_SaveTest(); model->Action_SaveTest();
} }
ImGui::Separator(); ImGui::Separator();
@ -354,7 +354,7 @@ void View::Command_Draw()
if (ImGui::Combo("##Test", &settings.testID, GetTestName, NULL, g_testCount, g_testCount)) if (ImGui::Combo("##Test", &settings.testID, GetTestName, NULL, g_testCount, g_testCount))
{ {
m_model->Action_SelectTest(settings.testID); model->Action_SelectTest(settings.testID);
} }
ImGui::PopItemWidth(); ImGui::PopItemWidth();
@ -365,38 +365,38 @@ void View::Command_Draw()
if (ImGui::Button("Previous", menuButtonSize)) if (ImGui::Button("Previous", menuButtonSize))
{ {
m_model->Action_PreviousTest(); model->Action_PreviousTest();
} }
if (ImGui::Button("Next", menuButtonSize)) if (ImGui::Button("Next", menuButtonSize))
{ {
m_model->Action_NextTest(); model->Action_NextTest();
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::Button("Play/Pause", menuButtonSize)) if (ImGui::Button("Play/Pause", menuButtonSize))
{ {
m_model->Action_PlayPause(); model->Action_PlayPause();
} }
if (ImGui::Button("Single Step", menuButtonSize)) if (ImGui::Button("Single Step", menuButtonSize))
{ {
m_model->Action_SingleStep(); model->Action_SingleStep();
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::Button("Restart", menuButtonSize)) if (ImGui::Button("Restart", menuButtonSize))
{ {
m_model->Action_RestartTest(); model->Action_RestartTest();
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::Button("Reset Camera", menuButtonSize)) if (ImGui::Button("Reset Camera", menuButtonSize))
{ {
m_model->Action_DefaultCamera(); model->Action_DefaultCamera();
} }
ImGui::EndMenuBar(); ImGui::EndMenuBar();

View File

@ -48,7 +48,6 @@ private:
friend class Presenter; friend class Presenter;
Presenter m_presenter; Presenter m_presenter;
Model* m_model;
GLFWwindow* m_window; GLFWwindow* m_window;
bool m_leftDown; bool m_leftDown;