Archived
1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
jgl-template/GLGameTemplate/App.h
2013-01-05 12:41:46 +01:00

63 lines
1,006 B
C++

//
// App.h
// GLGameTemplate
//
// Created by Joshua Moerman on 5/4/12.
// Copyright (c) 2012 Vadovas. All rights reserved.
//
#ifndef GLGameTemplate_App_h
#define GLGameTemplate_App_h
#include <memory>
#include <cmath>
#include "shader.h"
#include "myGL.h"
#include "Game.h"
struct App {
constexpr static int preferred_frames_per_second(){ return 60; }
constexpr static bool multisample(){ return false; }
constexpr static bool depth(){ return true; }
unsigned int width, height;
float aspect;
float time;
Game game;
App(float w, float h)
: width(w)
, height(h)
, aspect(w/h)
, time(0)
, game()
{
}
~App() {
}
void resize(float w, float h) {
aspect = std::abs(w/h);
}
void update(float dt) {
time += dt;
game.update(dt);
// Update the FBO's here
// (can't be done in draw, because of apple's fbo shizzle)
}
void draw() {
glClearColor(0.1, 0.0, 0.05, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
game.draw();
}
};
#endif