KlassischeKeplerKriege/game/main.cpp
2016-09-27 18:07:21 +02:00

37 lines
892 B
C++

#include "opengl.h"
#include <iostream>
class MainWindow : public endofthejedi::GLWindow {
private:
protected:
void init() override {
glClearColor(0.5f, 0.6f, 0.7f, 1.0f);
resize();
glEnable(GL_DEPTH_TEST);
}
void render(double time) override {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, 0.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glEnd();
}
void resize() override { glViewport(0, 0, getwidth(), getheight()); }
public:
MainWindow(unsigned int width, unsigned int height)
: endofthejedi::GLWindow(width, height) {}
};
int main(int argc, const char *argv[]) {
MainWindow window(500, 500);
window.set_maxfps(60.0);
window.loop();
window.stop();
}