#include "core/input/global_inputs.hpp"

#include "core/input/input.h"
#include "core/rendering/screen.h"

namespace GlobalInputs {

    auto handle() -> bool {
        if (Screen::get() == nullptr || Input::get() == nullptr) { return false; }

        if (Input::get()->checkInput(input_window_fullscreen, REPEAT_FALSE)) {
            Screen::get()->toggleVideoMode();
            return true;
        }
        if (Input::get()->checkInput(input_window_dec_size, REPEAT_FALSE)) {
            Screen::get()->decWindowZoom();
            return true;
        }
        if (Input::get()->checkInput(input_window_inc_size, REPEAT_FALSE)) {
            Screen::get()->incWindowZoom();
            return true;
        }
        if (Input::get()->checkInput(input_prev_preset, REPEAT_FALSE)) {
            Screen::get()->prevPreset();
            return true;
        }
        if (Input::get()->checkInput(input_next_preset, REPEAT_FALSE)) {
            Screen::get()->nextPreset();
            return true;
        }
        if (Input::get()->checkInput(input_toggle_shader, REPEAT_FALSE)) {
            Screen::get()->toggleShaderEnabled();
            return true;
        }
        if (Input::get()->checkInput(input_toggle_shader_type, REPEAT_FALSE)) {
            Screen::get()->toggleActiveShader();
            return true;
        }
        return false;
    }

}  // namespace GlobalInputs
