Differential D2037 Diff 8718 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp
Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | |||||
BEGIN_EVENT_TABLE(VariableColorBox, wxPanel) | BEGIN_EVENT_TABLE(VariableColorBox, wxPanel) | ||||
EVT_BUTTON(wxID_ANY, VariableColorBox::OnClick) | EVT_BUTTON(wxID_ANY, VariableColorBox::OnClick) | ||||
END_EVENT_TABLE() | END_EVENT_TABLE() | ||||
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// | ||||
enum { | enum { | ||||
ID_RecomputeWaterData | ID_RecomputeWaterData, | ||||
ID_PickWaterHeight | |||||
}; | }; | ||||
static void SendToGame(const AtlasMessage::sEnvironmentSettings& settings) | static void SendToGame(const AtlasMessage::sEnvironmentSettings& settings) | ||||
{ | { | ||||
POST_COMMAND(SetEnvironmentSettings, (settings)); | POST_COMMAND(SetEnvironmentSettings, (settings)); | ||||
} | } | ||||
EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) | EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) | ||||
: Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer) | : Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer) | ||||
{ | { | ||||
wxSizer* scrollSizer = new wxBoxSizer(wxVERTICAL); | wxSizer* scrollSizer = new wxBoxSizer(wxVERTICAL); | ||||
wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this); | wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this); | ||||
scrolledWindow->SetScrollRate(10, 10); | scrolledWindow->SetScrollRate(10, 10); | ||||
scrolledWindow->SetSizer(scrollSizer); | scrolledWindow->SetSizer(scrollSizer); | ||||
m_MainSizer->Add(scrolledWindow, wxSizerFlags().Proportion(1).Expand()); | m_MainSizer->Add(scrolledWindow, wxSizerFlags().Proportion(1).Expand()); | ||||
wxSizer* waterSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Water settings")); | wxSizer* waterSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Water settings")); | ||||
scrollSizer->Add(waterSizer, wxSizerFlags().Expand()); | scrollSizer->Add(waterSizer, wxSizerFlags().Expand()); | ||||
waterSizer->Add(new wxButton(scrolledWindow, ID_RecomputeWaterData, _("Reset Water Data")), wxSizerFlags().Expand()); | waterSizer->Add(new wxButton(scrolledWindow, ID_RecomputeWaterData, _("Reset Water Data")), wxSizerFlags().Expand()); | ||||
waterSizer->Add(m_WaterTypeList = new VariableListBox(scrolledWindow, _("Water Type"), g_EnvironmentSettings.watertype), wxSizerFlags().Expand()); | waterSizer->Add(m_WaterTypeList = new VariableListBox(scrolledWindow, _("Water Type"), g_EnvironmentSettings.watertype), wxSizerFlags().Expand()); | ||||
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water height"), g_EnvironmentSettings.waterheight, 0.f, 1.2f), wxSizerFlags().Expand()); | waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water height"), g_EnvironmentSettings.waterheight, 0.f, 1.2f), wxSizerFlags().Expand()); | ||||
waterSizer->Add(new wxButton(scrolledWindow, ID_PickWaterHeight, _("Pick Water Height")), wxSizerFlags().Expand()); | |||||
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water waviness"), g_EnvironmentSettings.waterwaviness, 0.f, 10.f), wxSizerFlags().Expand()); | waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water waviness"), g_EnvironmentSettings.waterwaviness, 0.f, 10.f), wxSizerFlags().Expand()); | ||||
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water murkiness"), g_EnvironmentSettings.watermurkiness, 0.f, 1.f), wxSizerFlags().Expand()); | waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water murkiness"), g_EnvironmentSettings.watermurkiness, 0.f, 1.f), wxSizerFlags().Expand()); | ||||
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Wind angle"), g_EnvironmentSettings.windangle, -M_PIf, M_PIf), wxSizerFlags().Expand()); | waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Wind angle"), g_EnvironmentSettings.windangle, -M_PIf, M_PIf), wxSizerFlags().Expand()); | ||||
waterSizer->Add(new VariableColorBox(scrolledWindow, _("Water color"), g_EnvironmentSettings.watercolor), wxSizerFlags().Expand()); | waterSizer->Add(new VariableColorBox(scrolledWindow, _("Water color"), g_EnvironmentSettings.watercolor), wxSizerFlags().Expand()); | ||||
waterSizer->Add(new VariableColorBox(scrolledWindow, _("Water tint"), g_EnvironmentSettings.watertint), wxSizerFlags().Expand()); | waterSizer->Add(new VariableColorBox(scrolledWindow, _("Water tint"), g_EnvironmentSettings.watertint), wxSizerFlags().Expand()); | ||||
std::vector<std::wstring> list; | std::vector<std::wstring> list; | ||||
list.push_back(L"ocean"); list.push_back(L"lake"); list.push_back(L"clap"); | list.push_back(L"ocean"); list.push_back(L"lake"); list.push_back(L"clap"); | ||||
Show All 34 Lines | void EnvironmentSidebar::OnFirstDisplay() | ||||
AtlasMessage::qGetSkySets qry_skysets; | AtlasMessage::qGetSkySets qry_skysets; | ||||
qry_skysets.Post(); | qry_skysets.Post(); | ||||
m_SkyList->SetChoices(*qry_skysets.skysets); | m_SkyList->SetChoices(*qry_skysets.skysets); | ||||
AtlasMessage::qGetPostEffects qry_effects; | AtlasMessage::qGetPostEffects qry_effects; | ||||
qry_effects.Post(); | qry_effects.Post(); | ||||
m_PostEffectList->SetChoices(*qry_effects.posteffects); | m_PostEffectList->SetChoices(*qry_effects.posteffects); | ||||
AtlasMessage::qGetEnvironmentSettings qry_env; | UpdateEnvironmentSettings(); | ||||
qry_env.Post(); | |||||
g_EnvironmentSettings = qry_env.settings; | |||||
g_EnvironmentSettings.NotifyObservers(); | |||||
} | } | ||||
void EnvironmentSidebar::OnMapReload() | void EnvironmentSidebar::OnMapReload() | ||||
{ | { | ||||
UpdateEnvironmentSettings(); | |||||
} | |||||
void EnvironmentSidebar::RecomputeWaterData(wxCommandEvent& WXUNUSED(evt)) | |||||
{ | |||||
POST_COMMAND(RecalculateWaterData, (0.0f)); | |||||
} | |||||
void EnvironmentSidebar::UpdateEnvironmentSettings() | |||||
{ | |||||
AtlasMessage::qGetEnvironmentSettings qry_env; | AtlasMessage::qGetEnvironmentSettings qry_env; | ||||
qry_env.Post(); | qry_env.Post(); | ||||
g_EnvironmentSettings = qry_env.settings; | g_EnvironmentSettings = qry_env.settings; | ||||
g_EnvironmentSettings.NotifyObservers(); | g_EnvironmentSettings.NotifyObservers(); | ||||
} | } | ||||
void EnvironmentSidebar::RecomputeWaterData(wxCommandEvent& WXUNUSED(evt)) | void EnvironmentSidebar::OnPickWaterHeight(wxCommandEvent& evt) | ||||
{ | { | ||||
POST_COMMAND(RecalculateWaterData, (0.0f)); | m_ScenarioEditor.GetToolManager().SetCurrentTool(_T("PickWaterHeight"), this); | ||||
} | } | ||||
BEGIN_EVENT_TABLE(EnvironmentSidebar, Sidebar) | BEGIN_EVENT_TABLE(EnvironmentSidebar, Sidebar) | ||||
EVT_BUTTON(ID_RecomputeWaterData, EnvironmentSidebar::RecomputeWaterData) | EVT_BUTTON(ID_RecomputeWaterData, EnvironmentSidebar::RecomputeWaterData) | ||||
EVT_BUTTON(ID_PickWaterHeight, EnvironmentSidebar::OnPickWaterHeight) | |||||
END_EVENT_TABLE(); | END_EVENT_TABLE(); | ||||
Wildfire Games · Phabricator