From 8a1f5354f55dce448aac10f79141329950275086 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 28 Dec 2022 02:45:05 +0100 Subject: Renamed Log scene to Summary --- kurator/CMakeLists.txt | 2 +- kurator/src/Battle.cpp | 6 ++--- kurator/src/Log.cpp | 69 ------------------------------------------------- kurator/src/Log.h | 26 ------------------- kurator/src/Summary.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ kurator/src/Summary.h | 26 +++++++++++++++++++ 6 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 kurator/src/Log.cpp delete mode 100644 kurator/src/Log.h create mode 100644 kurator/src/Summary.cpp create mode 100644 kurator/src/Summary.h diff --git a/kurator/CMakeLists.txt b/kurator/CMakeLists.txt index 44b6be9..7dc50ef 100644 --- a/kurator/CMakeLists.txt +++ b/kurator/CMakeLists.txt @@ -5,12 +5,12 @@ add_executable( src/Battle.cpp src/colors.cpp src/ForceBalance.cpp - src/Log.cpp src/main.cpp src/ScenarioEditor.cpp src/SceneBuilder.cpp src/Session.cpp src/Skybox.cpp + src/Summary.cpp src/Title.cpp src/Window.cpp ) diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp index 8cced8b..1f30f0a 100644 --- a/kurator/src/Battle.cpp +++ b/kurator/src/Battle.cpp @@ -21,7 +21,7 @@ #include "colors.h" #include "components.h" -#include "Log.h" +#include "Summary.h" #include "Session.h" @@ -96,7 +96,7 @@ Battle::update(const float dt) } ImGui::End(); if (IsKeyPressed(KEY_SPACE)) - session->set(std::make_shared(session, log)); + session->set(std::make_shared(session, log)); } @@ -148,7 +148,7 @@ Battle::draw() const void Battle::on_end(const sim::End&) { - session->set(std::make_shared(session, log)); + session->set(std::make_shared(session, log)); } diff --git a/kurator/src/Log.cpp b/kurator/src/Log.cpp deleted file mode 100644 index 0689176..0000000 --- a/kurator/src/Log.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "Log.h" - -#include -#include - -#include -#include - -#include - -#include "EventLog.h" -#include "Session.h" - - -namespace kurator -{ - - -struct Dumper -{ - Dumper(); - ~Dumper(); - void operator()(const stats::ShipLeft& event); -}; - - -Log::Log(std::shared_ptr _session, EventLog _events) : - session {std::move(_session)}, - events {std::move(_events)} -{ -} - - -void -Log::update(const float) -{ - if (IsKeyPressed(KEY_SPACE)) - session->pop(); -} - - -void -Log::draw() const -{ - ClearBackground(BLACK); - events.for_each(Dumper{}); -} - - -Dumper::Dumper() -{ - ImGui::Begin("Event Log"); -} - - -Dumper::~Dumper() -{ - ImGui::End(); -} - - -void -Dumper::operator()(const stats::ShipLeft& event) -{ - ImGui::Text("%3.1f (%d) destroyed", event.time, event.ship.id); -} - - -} // namespace kurator diff --git a/kurator/src/Log.h b/kurator/src/Log.h deleted file mode 100644 index 2fabccf..0000000 --- a/kurator/src/Log.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -#include "EventLog.h" -#include "Session.h" -#include "Scene.h" - - -namespace kurator -{ - - -class Log : public Scene -{ -public: - Log(std::shared_ptr _session, EventLog _events); - void update(float dt) override; - void draw() const override; -private: - std::shared_ptr session; - EventLog events; -}; - - -} // namespace kurator diff --git a/kurator/src/Summary.cpp b/kurator/src/Summary.cpp new file mode 100644 index 0000000..2ea7c34 --- /dev/null +++ b/kurator/src/Summary.cpp @@ -0,0 +1,69 @@ +#include "Summary.h" + +#include +#include + +#include +#include + +#include + +#include "EventLog.h" +#include "Session.h" + + +namespace kurator +{ + + +struct Dumper +{ + Dumper(); + ~Dumper(); + void operator()(const stats::ShipLeft& event); +}; + + +Summary::Summary(std::shared_ptr _session, EventLog _events) : + session {std::move(_session)}, + events {std::move(_events)} +{ +} + + +void +Summary::update(const float) +{ + if (IsKeyPressed(KEY_SPACE)) + session->pop(); +} + + +void +Summary::draw() const +{ + ClearBackground(BLACK); + events.for_each(Dumper{}); +} + + +Dumper::Dumper() +{ + ImGui::Begin("Event Log"); +} + + +Dumper::~Dumper() +{ + ImGui::End(); +} + + +void +Dumper::operator()(const stats::ShipLeft& event) +{ + ImGui::Text("%3.1f (%d) destroyed", event.time, event.ship.id); +} + + +} // namespace kurator diff --git a/kurator/src/Summary.h b/kurator/src/Summary.h new file mode 100644 index 0000000..e4e32f9 --- /dev/null +++ b/kurator/src/Summary.h @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include "EventLog.h" +#include "Session.h" +#include "Scene.h" + + +namespace kurator +{ + + +class Summary : public Scene +{ +public: + Summary(std::shared_ptr _session, EventLog _events); + void update(float dt) override; + void draw() const override; +private: + std::shared_ptr session; + EventLog events; +}; + + +} // namespace kurator -- cgit v1.1