summaryrefslogtreecommitdiff
path: root/kurator/src/Summary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kurator/src/Summary.cpp')
-rw-r--r--kurator/src/Summary.cpp69
1 files changed, 69 insertions, 0 deletions
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 <memory>
+#include <utility>
+
+#include <raylib.h>
+#include <imgui.h>
+
+#include <kurator/stats/events.h>
+
+#include "EventLog.h"
+#include "Session.h"
+
+
+namespace kurator
+{
+
+
+struct Dumper
+{
+ Dumper();
+ ~Dumper();
+ void operator()(const stats::ShipLeft& event);
+};
+
+
+Summary::Summary(std::shared_ptr<Session> _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