[README] Rewrited in Markdown. [SDLManager] Rewrited into SDLLoader. [ApplicationState] Improved.
This commit is contained in:
parent
f2e9f10735
commit
58c23a7e66
27
README.md
Executable file
27
README.md
Executable file
@ -0,0 +1,27 @@
|
||||
# KubKraft
|
||||
|
||||
### By gnidmoo
|
||||
|
||||
- KubKraft is a Minecraft-like game.
|
||||
|
||||

|
||||
|
||||
## Keys
|
||||
|
||||
- View: mouse controlled
|
||||
- Movement: <kbd>W</kbd>, <kbd>A</kbd>, <kbd>S</kbd> and <kbd>D</kbd>
|
||||
- Land: <kbd>Shift</kbd>
|
||||
- Fly: <kbd>Space</kbd>
|
||||
- Exit: <kbd>Escape</kbd>
|
||||
|
||||
## How to compile
|
||||
|
||||
- Dependencies:
|
||||
- [CMake](http://www.cmake.org/download/)
|
||||
- [SDL2](https://www.libsdl.org/download-2.0.php), [SDL2_image](https://www.libsdl.org/projects/SDL_image/), [SDL2_mixer](https://www.libsdl.org/projects/SDL_mixer/)
|
||||
- OpenGL >= 2.1, [glm](http://sourceforge.net/projects/ogl-math/files/latest/download?source=files)
|
||||
- [glew](http://sourceforge.net/projects/glew/files/latest/download) *(only required for Windows)*
|
||||
- _Linux users: Check your distribution repositories for packages._
|
||||
- Run `cmake .` at the root of the game folder
|
||||
- Run `make`, wait, run the game and enjoy!
|
||||
|
@ -1,27 +0,0 @@
|
||||
h1. KubKraft
|
||||
|
||||
h3. By gnidmoo
|
||||
|
||||
* KubKraft is a Minecraft-like game.
|
||||
|
||||
!http://sdz-upload.s3.amazonaws.com/prod/upload/screenshot-20150103233518.png!
|
||||
|
||||
h2. Keys
|
||||
|
||||
* View: mouse controlled
|
||||
* Movement: @W@, @A@, @S@ and @D@
|
||||
* Land: @Shift@
|
||||
* Fly: @Space@
|
||||
* Exit: @Escape@
|
||||
|
||||
h2. How to compile
|
||||
|
||||
* Dependencies:
|
||||
- "CMake":http://www.cmake.org/download/
|
||||
- "SDL2":https://www.libsdl.org/download-2.0.php, "SDL2_image":https://www.libsdl.org/projects/SDL_image/, "SDL2_mixer":https://www.libsdl.org/projects/SDL_mixer/
|
||||
- OpenGL >= 3.0, "glm":http://sourceforge.net/projects/ogl-math/files/latest/download?source=files
|
||||
- "glew":http://sourceforge.net/projects/glew/files/latest/download _(only required for Windows)_
|
||||
|
||||
* Run @cmake .@ at the root of the game folder
|
||||
* Run @make@, wait, run the game and enjoy!
|
||||
|
@ -21,12 +21,10 @@
|
||||
#include "ApplicationStateStack.hpp"
|
||||
#include "GameClock.hpp"
|
||||
#include "Window.hpp"
|
||||
//#include "ResourceHandler.hpp"
|
||||
|
||||
class Application {
|
||||
public:
|
||||
Application();
|
||||
~Application();
|
||||
|
||||
void initGL();
|
||||
|
||||
@ -36,17 +34,15 @@ class Application {
|
||||
|
||||
Window &window() { return m_window; }
|
||||
|
||||
static Application &getInstance() {
|
||||
static Application instance;
|
||||
return instance;
|
||||
}
|
||||
static const u16 screenWidth = 640;
|
||||
static const u16 screenHeight = 480;
|
||||
|
||||
private:
|
||||
Window m_window;
|
||||
ApplicationStateStack &m_stateStack;
|
||||
|
||||
GameClock m_clock;
|
||||
|
||||
ApplicationStateStack *m_applicationStateStack;
|
||||
Window m_window;
|
||||
};
|
||||
|
||||
#endif // APPLICATION_HPP_
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: Config.hpp
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 14/12/2014 13:45:14
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Quentin BAZIN, <quent42340@gmail.com>
|
||||
* Company:
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#ifndef CONFIG_HPP_
|
||||
#define CONFIG_HPP_
|
||||
|
||||
#define SCREEN_WIDTH 640
|
||||
#define SCREEN_HEIGHT 480
|
||||
|
||||
#define APP_NAME "KubKraft"
|
||||
|
||||
#endif // CONFIG_HPP_
|
35
include/core/SDLLoader.hpp
Normal file
35
include/core/SDLLoader.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: SDLLoader.hpp
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Created: 15/09/2014 00:06:50
|
||||
*
|
||||
* Author: Quentin Bazin, <gnidmoo@gmail.com>
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#ifndef SDLLOADER_HPP_
|
||||
#define SDLLOADER_HPP_
|
||||
|
||||
class SDLLoader {
|
||||
public:
|
||||
SDLLoader() = default;
|
||||
SDLLoader(const SDLLoader &) = delete;
|
||||
SDLLoader(SDLLoader &&) = delete;
|
||||
~SDLLoader();
|
||||
|
||||
SDLLoader& operator=(const SDLLoader &) = delete;
|
||||
SDLLoader& operator=(SDLLoader &&) = delete;
|
||||
|
||||
void load();
|
||||
|
||||
private:
|
||||
bool m_sdlInitialized = false;
|
||||
bool m_imgInitialized = false;
|
||||
bool m_mixInitialized = false;
|
||||
};
|
||||
|
||||
#endif // SDLLOADER_HPP_
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: SDLManager.hpp
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 20/12/2014 01:24:24
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Quentin BAZIN, <quent42340@gmail.com>
|
||||
* Company:
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#ifndef SDLMANAGER_HPP_
|
||||
#define SDLMANAGER_HPP_
|
||||
|
||||
class SDLManager {
|
||||
public:
|
||||
static void init();
|
||||
static void free();
|
||||
|
||||
private:
|
||||
static bool sdlInitialized;
|
||||
static bool imgInitialized;
|
||||
static bool mixInitialized;
|
||||
};
|
||||
|
||||
#endif // SDLMANAGER_HPP_
|
@ -18,6 +18,8 @@
|
||||
#ifndef WINDOW_HPP_
|
||||
#define WINDOW_HPP_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "SDLHeaders.hpp"
|
||||
#include "Types.hpp"
|
||||
|
||||
|
@ -28,24 +28,24 @@
|
||||
class Shader {
|
||||
public:
|
||||
Shader();
|
||||
Shader(const char *vertexFilename, const char *fragementFilename);
|
||||
Shader(const std::string &vertexFilename, const std::string &fragementFilename);
|
||||
~Shader();
|
||||
|
||||
void loadFromFile(const char *vertexFilename, const char *fragementFilename);
|
||||
void loadFromFile(const std::string &vertexFilename, const std::string &fragementFilename);
|
||||
|
||||
void createProgram();
|
||||
void linkProgram();
|
||||
|
||||
void addShader(GLenum type, const char *filename);
|
||||
void addShader(GLenum type, const std::string &filename);
|
||||
|
||||
GLint attrib(std::string name);
|
||||
GLint uniform(std::string name);
|
||||
GLint attrib(const std::string &name);
|
||||
GLint uniform(const std::string &name);
|
||||
|
||||
void enableVertexAttribArray(std::string name);
|
||||
void disableVertexAttribArray(std::string name);
|
||||
void enableVertexAttribArray(const std::string &name);
|
||||
void disableVertexAttribArray(const std::string &name);
|
||||
|
||||
void setUniform(std::string name, int n);
|
||||
void setUniform(std::string name, const glm::mat4 &matrix);
|
||||
void setUniform(const std::string &name, int n);
|
||||
void setUniform(const std::string &name, const glm::mat4 &matrix);
|
||||
|
||||
static void bind(const Shader *shader);
|
||||
|
||||
@ -54,6 +54,7 @@ class Shader {
|
||||
private:
|
||||
std::vector<GLuint> m_vertexShaders;
|
||||
std::vector<GLuint> m_fragmentShaders;
|
||||
|
||||
GLuint m_program;
|
||||
};
|
||||
|
||||
|
@ -20,14 +20,17 @@
|
||||
|
||||
class ApplicationState {
|
||||
public:
|
||||
ApplicationState();
|
||||
virtual ~ApplicationState();
|
||||
|
||||
virtual void handleEvents();
|
||||
ApplicationState(ApplicationState *parent = nullptr) : m_parent(parent) {}
|
||||
ApplicationState(const ApplicationState &) = delete;
|
||||
ApplicationState(ApplicationState &&) = default;
|
||||
virtual ~ApplicationState() = default;
|
||||
|
||||
virtual void update() = 0;
|
||||
|
||||
virtual void draw() = 0;
|
||||
|
||||
protected:
|
||||
ApplicationState *m_parent = nullptr;
|
||||
};
|
||||
|
||||
#endif // APPLICATIONSTATE_HPP_
|
||||
|
@ -21,25 +21,19 @@
|
||||
#include <SFML/Window/Event.hpp>
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "Config.hpp"
|
||||
#include "Exception.hpp"
|
||||
#include "Mouse.hpp"
|
||||
#include "OpenGL.hpp"
|
||||
|
||||
Application::Application() {
|
||||
Application::Application() : m_stateStack(ApplicationStateStack::getInstance()) {
|
||||
srand(time(NULL));
|
||||
|
||||
m_window.open(APP_NAME, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
m_window.open("KubKraft", 640, 480);
|
||||
m_window.setMouseCursorGrabbed(true);
|
||||
m_window.setMouseCursorVisible(false);
|
||||
m_window.setVerticalSyncEnabled(true);
|
||||
|
||||
initGL();
|
||||
|
||||
//ResourceHandler::getInstance().loadResources();
|
||||
m_applicationStateStack = &ApplicationStateStack::getInstance();
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
}
|
||||
|
||||
void Application::initGL() {
|
||||
@ -58,23 +52,45 @@ void Application::initGL() {
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
|
||||
glClearColor(0.196078, 0.6, 0.8, 1.0); // Skyblue
|
||||
//glClearColor(0.0, 0.0, 0.0, 1.0); // Skyblue
|
||||
}
|
||||
|
||||
void Application::handleEvents() {
|
||||
Mouse::reset();
|
||||
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event) != 0) {
|
||||
switch(event.type) {
|
||||
case SDL_QUIT:
|
||||
m_window.close();
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
if(event.key.keysym.sym == SDLK_ESCAPE) {
|
||||
m_window.close();
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
Mouse::update(event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Application::run() {
|
||||
while(m_window.isOpen()) {
|
||||
m_clock.measureLastFrameDuration();
|
||||
|
||||
m_applicationStateStack->top().handleEvents();
|
||||
handleEvents();
|
||||
|
||||
m_clock.updateGame([&]{
|
||||
m_applicationStateStack->top().update();
|
||||
m_stateStack.top().update();
|
||||
});
|
||||
|
||||
m_clock.drawGame([&]{
|
||||
m_window.clear();
|
||||
|
||||
m_applicationStateStack->top().draw();
|
||||
m_stateStack.top().draw();
|
||||
|
||||
m_window.display();
|
||||
});
|
||||
|
49
source/core/SDLLoader.cpp
Normal file
49
source/core/SDLLoader.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: SDLLoader.cpp
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Created: 15/09/2014 00:07:14
|
||||
*
|
||||
* Author: Quentin Bazin, <gnidmoo@gmail.com>
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#include "Exception.hpp"
|
||||
#include "SDLHeaders.hpp"
|
||||
#include "SDLLoader.hpp"
|
||||
|
||||
SDLLoader::~SDLLoader() {
|
||||
if(m_mixInitialized) Mix_CloseAudio();
|
||||
if(m_imgInitialized) IMG_Quit();
|
||||
if(m_sdlInitialized) SDL_Quit();
|
||||
}
|
||||
|
||||
void SDLLoader::load() {
|
||||
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
throw EXCEPTION("SDL init error:", SDL_GetError());
|
||||
} else {
|
||||
m_sdlInitialized = true;
|
||||
}
|
||||
|
||||
int imgFlags = IMG_INIT_PNG;
|
||||
if((!IMG_Init(imgFlags)) & imgFlags) {
|
||||
throw EXCEPTION("SDL image init error:", IMG_GetError());
|
||||
} else {
|
||||
m_imgInitialized = true;
|
||||
}
|
||||
|
||||
if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) == -1) {
|
||||
throw EXCEPTION("SDL mixer init error:", Mix_GetError());
|
||||
} else {
|
||||
m_mixInitialized = true;
|
||||
}
|
||||
|
||||
Mix_AllocateChannels(32);
|
||||
|
||||
Mix_VolumeMusic(MIX_MAX_VOLUME / 3);
|
||||
Mix_Volume(-1, MIX_MAX_VOLUME);
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: SDLManager.cpp
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 20/12/2014 01:24:53
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Quentin BAZIN, <quent42340@gmail.com>
|
||||
* Company:
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#include "Exception.hpp"
|
||||
#include "SDLHeaders.hpp"
|
||||
#include "SDLManager.hpp"
|
||||
|
||||
bool SDLManager::sdlInitialized = false;
|
||||
bool SDLManager::imgInitialized = false;
|
||||
bool SDLManager::mixInitialized = false;
|
||||
|
||||
void SDLManager::init() {
|
||||
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
EXCEPTION("SDL init error:", SDL_GetError());
|
||||
} else {
|
||||
sdlInitialized = true;
|
||||
}
|
||||
|
||||
int imgFlags = IMG_INIT_PNG;
|
||||
if(!IMG_Init(imgFlags) & imgFlags) {
|
||||
EXCEPTION("SDL image init error:", SDL_GetError());
|
||||
} else {
|
||||
imgInitialized = true;
|
||||
}
|
||||
|
||||
if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) == -1) {
|
||||
EXCEPTION("SDL image init error:", SDL_GetError());
|
||||
} else {
|
||||
mixInitialized = true;
|
||||
}
|
||||
|
||||
Mix_AllocateChannels(32);
|
||||
Mix_VolumeMusic(MIX_MAX_VOLUME / 3);
|
||||
Mix_Volume(-1, MIX_MAX_VOLUME);
|
||||
}
|
||||
|
||||
void SDLManager::free() {
|
||||
if(mixInitialized) Mix_CloseAudio();
|
||||
if(imgInitialized) IMG_Quit();
|
||||
if(sdlInitialized) SDL_Quit();
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
Shader::Shader() {
|
||||
}
|
||||
|
||||
Shader::Shader(const char *vertexFilename, const char *fragmentFilename) {
|
||||
Shader::Shader(const std::string &vertexFilename, const std::string &fragmentFilename) {
|
||||
loadFromFile(vertexFilename, fragmentFilename);
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ Shader::~Shader() {
|
||||
glDeleteProgram(m_program);
|
||||
}
|
||||
|
||||
void Shader::loadFromFile(const char *vertexFilename, const char *fragmentFilename) {
|
||||
void Shader::loadFromFile(const std::string &vertexFilename, const std::string &fragmentFilename) {
|
||||
createProgram();
|
||||
|
||||
addShader(GL_VERTEX_SHADER, vertexFilename);
|
||||
@ -81,7 +81,7 @@ void Shader::linkProgram() {
|
||||
}
|
||||
}
|
||||
|
||||
void Shader::addShader(GLenum type, const char *filename) {
|
||||
void Shader::addShader(GLenum type, const std::string &filename) {
|
||||
GLuint shader = glCreateShader(type);
|
||||
|
||||
if(type == GL_VERTEX_SHADER) {
|
||||
@ -105,7 +105,7 @@ void Shader::addShader(GLenum type, const char *filename) {
|
||||
|
||||
const GLchar *sourceCodeString = sourceCode.c_str();
|
||||
|
||||
glShaderSource(shader, 1, &sourceCodeString, NULL);
|
||||
glShaderSource(shader, 1, &sourceCodeString, nullptr);
|
||||
|
||||
glCompileShader(shader);
|
||||
|
||||
@ -131,7 +131,7 @@ void Shader::addShader(GLenum type, const char *filename) {
|
||||
glAttachShader(m_program, shader);
|
||||
}
|
||||
|
||||
GLint Shader::attrib(std::string name) {
|
||||
GLint Shader::attrib(const std::string &name) {
|
||||
GLint attrib = glGetAttribLocation(m_program, name.c_str());
|
||||
|
||||
if(attrib == -1) {
|
||||
@ -141,7 +141,7 @@ GLint Shader::attrib(std::string name) {
|
||||
return attrib;
|
||||
}
|
||||
|
||||
GLint Shader::uniform(std::string name) {
|
||||
GLint Shader::uniform(const std::string &name) {
|
||||
GLint uniform = glGetUniformLocation(m_program, name.c_str());
|
||||
|
||||
if(uniform == -1) {
|
||||
@ -151,19 +151,19 @@ GLint Shader::uniform(std::string name) {
|
||||
return uniform;
|
||||
}
|
||||
|
||||
void Shader::enableVertexAttribArray(std::string name) {
|
||||
void Shader::enableVertexAttribArray(const std::string &name) {
|
||||
glEnableVertexAttribArray(attrib(name));
|
||||
}
|
||||
|
||||
void Shader::disableVertexAttribArray(std::string name) {
|
||||
void Shader::disableVertexAttribArray(const std::string &name) {
|
||||
glDisableVertexAttribArray(attrib(name));
|
||||
}
|
||||
|
||||
void Shader::setUniform(std::string name, int n) {
|
||||
void Shader::setUniform(const std::string &name, int n) {
|
||||
glUniform1i(uniform(name), n);
|
||||
}
|
||||
|
||||
void Shader::setUniform(std::string name, const glm::mat4 &matrix) {
|
||||
void Shader::setUniform(const std::string &name, const glm::mat4 &matrix) {
|
||||
glUniformMatrix4fv(uniform(name), 1, GL_FALSE, glm::value_ptr(matrix));
|
||||
}
|
||||
|
||||
|
@ -18,24 +18,25 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "Debug.hpp"
|
||||
#include "Exception.hpp"
|
||||
#include "SDLManager.hpp"
|
||||
#include "SDLLoader.hpp"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(int, char *[]) {
|
||||
SDLLoader sdlLoader;
|
||||
|
||||
try {
|
||||
SDLManager::init();
|
||||
sdlLoader.load();
|
||||
|
||||
Application &app = Application::getInstance();
|
||||
Application app;
|
||||
|
||||
app.run();
|
||||
}
|
||||
catch(const Exception &err) {
|
||||
std::cerr << Debug::textColor(Debug::TextColor::Red, true) << "Fatal error " << Debug::textColor() << err.what() << std::endl;
|
||||
catch(const Exception &e) {
|
||||
std::cerr << "Fatal error " << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
catch(const std::exception &e) {
|
||||
std::cerr << Debug::textColor(Debug::TextColor::Red, true) << "Exception caught: " << Debug::textColor(0, true) << e.what() << Debug::textColor() << std::endl;
|
||||
std::cerr << "Exception caught: " << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
catch(...) {
|
||||
@ -43,8 +44,6 @@ int main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDLManager::free();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: ApplicationState.cpp
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 14/12/2014 13:50:04
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Quentin BAZIN, <quent42340@gmail.com>
|
||||
* Company:
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#include "Application.hpp"
|
||||
#include "ApplicationState.hpp"
|
||||
#include "Config.hpp"
|
||||
#include "Mouse.hpp"
|
||||
|
||||
ApplicationState::ApplicationState() {
|
||||
|
||||
}
|
||||
|
||||
ApplicationState::~ApplicationState() {
|
||||
}
|
||||
|
||||
void ApplicationState::handleEvents() {
|
||||
Mouse::reset();
|
||||
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event) != 0) {
|
||||
switch(event.type) {
|
||||
case SDL_QUIT:
|
||||
Application::getInstance().window().close();
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
if(event.key.keysym.sym == SDLK_ESCAPE) {
|
||||
Application::getInstance().window().close();
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
Mouse::update(event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ void GameClock::measureLastFrameDuration() {
|
||||
void GameClock::updateGame(std::function<void(void)> updateFunc) {
|
||||
m_numUpdates = 0;
|
||||
|
||||
while(m_lag >= m_timestep && m_numUpdates < 10 && Application::getInstance().window().isOpen()) {
|
||||
while(m_lag >= m_timestep && m_numUpdates < 10) {
|
||||
ticks += m_timestep;
|
||||
|
||||
updateFunc();
|
||||
|
Loading…
x
Reference in New Issue
Block a user