voxspatium/src/Application.h

57 lines
1.5 KiB
C
Raw Permalink Normal View History

2018-06-02 16:45:16 +00:00
// Voxspatium Engine - Voxel Planets Engine
2018-04-14 14:42:32 +00:00
// Copyright (C) 2018 Evert "Diamond" Prants <evert@lunasqu.ee>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-04-13 19:53:56 +00:00
#ifndef __APPLICATION_H__
#define __APPLICATION_H__
2018-04-14 06:53:15 +00:00
#include "util/Common.h"
#include "util/Singleton.h"
#include "Camera.h"
#include "Input.h"
2018-04-13 19:53:56 +00:00
2018-04-14 06:53:15 +00:00
class Application : public Singleton<Application>
2018-04-13 19:53:56 +00:00
{
public:
Application();
~Application();
2018-04-14 14:42:32 +00:00
void initialize();
void exit() { m_run = false; }
2018-04-14 06:53:15 +00:00
inline glm::vec2 getScreenDimensions() const { return glm::vec2(m_width, m_height); }
2018-04-14 06:53:15 +00:00
friend class Singleton<Application>;
2018-04-13 19:53:56 +00:00
private:
int m_width, m_height;
Camera* m_camera;
2018-04-13 19:53:56 +00:00
SDL_Window* m_window;
2018-04-14 06:53:15 +00:00
SDL_GLContext m_glContext;
2018-04-14 14:42:32 +00:00
GLuint m_now;
GLuint m_last;
double deltaTime;
2018-04-14 06:53:15 +00:00
2018-04-13 19:53:56 +00:00
bool m_run;
bool m_wireframe;
2021-11-06 13:11:55 +00:00
bool m_lock;
2018-04-13 19:53:56 +00:00
2018-04-14 14:42:32 +00:00
void handleEvents();
void run();
void render();
void update(GLfloat dtime);
2018-04-13 19:53:56 +00:00
};
#endif // __APPLICATION_H__