<commit_before>/*
This file is part of Groho, a simulator for inter-planetary travel and warfare.
Copyright (c) 2017-2018 by <NAME>. Some rights reserved, see LICENSE

Magnum App to handle windowing and display
*/

#include "app.hpp"
#include "vector2vector.hpp"

namespace sim {

GrohoApp::GrohoApp(const Arguments& arguments, const sim::Simulator& simulator)
    : Platform::Application{ arguments,
                             Configuration{}
                                 .setTitle("Groho orbit display")
                                 .setWindowFlags(
                                     Platform::Sdl2Application::Configuration::
                                         WindowFlag::Resizable),
                             GLConfiguration{}.setSampleCount(3) }
    , simulator(simulator)
{
    using namespace Math::Literals;

    Font::enable_blending();

    camera.set_viewport(
        GL::defaultFramebuffer.viewport().sizeX(),
        GL::defaultFramebuffer.viewport().sizeY());
}

void GrohoApp::drawEvent()
{
    overlay.status = simulator.status;
    overlay.t_s    = simulator.t_s;

    // JUST TESTING - TAKE THIS OUT
    if (camera.center_id && buffer) {
        if (camera.center_id->id == 0) {
            camera.center = { 0, 0, 0 };
        } else {
            auto idx = buffer->get_index(camera.center_id->id);
            if (idx) {<commit_msg>Use setMinimalLoopPeriod to prevent 100% CPU<commit_after>/*
This file is part of Groho, a simulator for inter-planetary travel and warfare.
Copyright (c) 2017-2018 by <NAME>. Some rights reserved, see LICENSE

Magnum App to handle windowing and display
*/

#include "app.hpp"
#include "vector2vector.hpp"

namespace sim {

GrohoApp::GrohoApp(const Arguments& arguments, const sim::Simulator& simulator)
    : Platform::Application{ arguments,
                             Configuration{}
                                 .setTitle("Groho orbit display")
                                 .setWindowFlags(
                                     Platform::Sdl2Application::Configuration::
                                         WindowFlag::Resizable),
                             GLConfiguration{}.setSampleCount(3) }
    , simulator(simulator)
{
    using namespace Math::Literals;

    Font::enable_blending();

    camera.set_viewport(
        GL::defaultFramebuffer.viewport().sizeX(),
        GL::defaultFramebuffer.viewport().sizeY());

    setMinimalLoopPeriod(10);
}

void GrohoApp::drawEvent()
{
    overlay.status = simulator.status;
    overlay.jd     = s2jd(simulator.t_s);

    // JUST TESTING - TAKE THIS OUT
    if (camera.center_id && buffer) {
        if (camera.center_id->id == 0) {
            camera.center = { 0, 0, 0 };
        } else {
            auto idx = buffer->get_index(camera.center_id->id);
            if (idx) {
{'fraction_non_alphanumeric': 0.10843373493975904, 'fraction_numerical': 0.012756909992912827, 'mean_word_length': 2.045307443365696, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '731413', 'n_tokens_mistral': 810, 'n_tokens_neox': 747, 'n_words': 182}