63 lines
1,006 B
C++
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
|