66 lines
1.7 KiB
C++

/**
This file is a part of our_dick
Copyright (C) 2020-2021 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUR_DICK_ENGINE_GAME_HPP
#define OUR_DICK_ENGINE_GAME_HPP
#include "observable.hpp"
#include "game_state.hpp"
#include "graphics/window.hpp"
#include "resource_manager.hpp"
#include "input.hpp"
#include <queue>
namespace egn{
class game : public observer<game_state_event>
{
protected:
gfx::window m_window;
game_state_manager m_states_manager;
resource_manager m_res_manager;
std::queue<input_event> m_event_queue;
double m_last_time;
public:
game(int cver_maj, int cver_min, int width, int height, const char* title);
void update();
void render();
void mouse_button(int button, double xpos, double ypos, int action, int mods);
void keypress(int key, int action, int mods);
void resize(int width, int height);
void on_notify(const game_state_event& e)override;
resource_manager& resource_man(void);
const resource_manager& resource_man(void)const;
void push_state(std::unique_ptr<game_state_iface>&&);
void pop_state(void);
private:
void setup_window_();
};
}
#endif