about to add SDL and probably break everything
This commit is contained in:
@ -78,7 +78,7 @@ int32_t DawnHost::init(DawnGame *game) {
|
||||
}
|
||||
|
||||
// Set up event listeners
|
||||
glfwSetWindowSizeCallback(this->data->window, &glfwOnResize);
|
||||
glfwSetFramebufferSizeCallback(this->data->window, &glfwOnResize);
|
||||
glfwSetKeyCallback(this->data->window, &glfwOnKey);
|
||||
|
||||
return DAWN_HOST_INIT_RESULT_SUCCESS;
|
||||
@ -118,6 +118,7 @@ int32_t DawnHost::start(DawnGame *game) {
|
||||
}
|
||||
|
||||
int32_t DawnHost::update(DawnGame *game, float_t delta) {
|
||||
// Tick game.
|
||||
auto ret = game->update(delta);
|
||||
switch(ret) {
|
||||
case DAWN_GAME_UPDATE_RESULT_SUCCESS:
|
||||
@ -148,17 +149,11 @@ void glfwOnError(int error, const char* description) {
|
||||
fputs(description, stderr);
|
||||
}
|
||||
|
||||
void glfwOnResize(
|
||||
GLFWwindow *window,
|
||||
int32_t width,
|
||||
int32_t height
|
||||
) {
|
||||
void glfwOnResize(GLFWwindow *window, int32_t w, int32_t h) {
|
||||
if(DAWN_HOST == nullptr) return;
|
||||
|
||||
// TODO: I may throttle this, it calls for every frame the window's resized.
|
||||
DAWN_HOST->game->renderManager.backBuffer.setSize(
|
||||
(float_t)width,
|
||||
(float_t)height
|
||||
);
|
||||
DAWN_HOST->game->renderManager.backBuffer.setSize((float_t)w, (float_t)h);
|
||||
}
|
||||
|
||||
void glfwOnKey(
|
||||
|
Reference in New Issue
Block a user