<commit_before>/* GG is a GUI for SDL and OpenGL.
   Copyright (C) 2003 <NAME>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public License
   as published by the Free Software Foundation; either version 2.1
   of the License, or (at your option) any later version.
   
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.
    
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA

   If you do not wish to comply with the terms of the LGPL please
   contact the author as other terms are available for a fee.
    
   <NAME>
   <EMAIL> */

#include <GG/EventPump.h>

using namespace GG;

EventPumpState::EventPumpState() :
    last_FPS_time(0),
    last_frame_time(0),
    most_recent_time(0),
    time(0),
    frames(0)
{}

#include <iostream>
void EventPumpBase::LoopBody(GUI* gui, EventPumpState& state, bool do_non_rendering, bool do_rendering)
{
    if (do_non_rendering) {
        state.time = gui->Ticks();

        // send an idle message, so that the gui has timely updates for triggering browse info windows, etc.
        gui->HandleGGEvent(GUI::IDLE, GGK_UNKNOWN, gui->KeyMods(), gui->MousePosition(), Pt());

        // govern FPS speed if needed
        if (double max_FPS = gui->MaxFPS()) {
            std::cout << "max_FPS=" << max_FPS << std::endl;
            double min_ms_per_frame = 1000.0 * 1.0 / max_FPS;
            double ms_to_wait = min_ms_per_frame - (state.time - state.last_frame_time);
            if (0.0 < ms_to_wait)
                gui->Wait(static_cast<int>(ms_to_wait));
        }
        state.last_frame_time = state.time;

        // track FPS if needed<commit_msg>Removed instrumentation accidentally committed in the last commit.<commit_after>/* GG is a GUI for SDL and OpenGL.
   Copyright (C) 2003 <NAME>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public License
   as published by the Free Software Foundation; either version 2.1
   of the License, or (at your option) any later version.
   
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.
    
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA

   If you do not wish to comply with the terms of the LGPL please
   contact the author as other terms are available for a fee.
    
   <NAME>
   <EMAIL> */

#include <GG/EventPump.h>

using namespace GG;

EventPumpState::EventPumpState() :
    last_FPS_time(0),
    last_frame_time(0),
    most_recent_time(0),
    time(0),
    frames(0)
{}


void EventPumpBase::LoopBody(GUI* gui, EventPumpState& state, bool do_non_rendering, bool do_rendering)
{
    if (do_non_rendering) {
        state.time = gui->Ticks();

        // send an idle message, so that the gui has timely updates for triggering browse info windows, etc.
        gui->HandleGGEvent(GUI::IDLE, GGK_UNKNOWN, gui->KeyMods(), gui->MousePosition(), Pt());

        // govern FPS speed if needed
        if (double max_FPS = gui->MaxFPS()) {
            double min_ms_per_frame = 1000.0 * 1.0 / max_FPS;
            double ms_to_wait = min_ms_per_frame - (state.time - state.last_frame_time);
            if (0.0 < ms_to_wait)
                gui->Wait(static_cast<int>(ms_to_wait));
        }
        state.last_frame_time = state.time;

        // track FPS if needed
{'fraction_non_alphanumeric': 0.08076828367397193, 'fraction_numerical': 0.016744644176311253, 'mean_word_length': 2.92463768115942, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3901935', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1203, 'n_words': 474}