This commit is contained in:
Andreas Ortmann 2016-09-27 19:01:21 +02:00
parent fbdddb1cd9
commit 3c716decdd
15 changed files with 13 additions and 193 deletions

View file

@ -24,12 +24,9 @@ set(GAME_SRC
)
set(GAME_HEADERS
opengl.h
glclasses.h
vector.h
config.h
simulation.h
renderer.h
opengl.hpp
glclasses.hpp
renderer.hpp
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

View file

@ -1,2 +0,0 @@
#include "config.h"

View file

@ -1,33 +0,0 @@
#pragma once
struct Config {
int maxPlayers;
int numPlanets;
int maxSegments;
int segmentSteps;
int numShots;
int fastmode;
int fullscreen;
int timeout;
int margintop;
int marginleft;
int marginright;
int marginbottom;
double playerSize;
int energy;
int realtime;
int debug;
double battlefieldW;
double battlefieldH;
int throttle;
char* ip;
char* message;
int pot;
int area;
};
class ConfigParser{
private:
protected:
public:
};

View file

@ -1,7 +1,7 @@
#pragma once
#include "opengl.h"
#include "renderer.h"
#include "opengl.hpp"
#include "renderer.hpp"
#include "game.hpp"

View file

@ -1,4 +1,4 @@
#include "glclasses.h"
#include "glclasses.hpp"
endofthejedi::VAO::VAO() { glGenVertexArrays(1, &m_name); }

View file

@ -1,8 +1,8 @@
#include "opengl.h"
#include "opengl.hpp"
#include <iostream>
//#include "triangle_window.h"
#include "game_window.h"
#include "game_window.hpp"
int main(int argc, const char *argv[]) {
GameWindow window(500, 500);

View file

@ -1,4 +1,4 @@
#include "opengl.h"
#include "opengl.hpp"
#include <iostream>
#include <sys/time.h>

View file

@ -1,4 +1,4 @@
#include "renderer.h"
#include "renderer.hpp"
endofthejedi::Renderer::Renderer() {

View file

@ -5,7 +5,7 @@
#include <epoxy/gl.h>
#include <epoxy/glx.h>
#include "glclasses.h"
#include "glclasses.hpp"
namespace endofthejedi {

View file

@ -1,2 +0,0 @@
#include "simulation.h"

View file

@ -1,50 +0,0 @@
#pragma once
#include "vector.h"
typedef struct
{
Vec2d position;
Vec2d speed;
int live;
int leftSource;
int stale;
} SimMissile;
typedef struct
{
Vec2d* dot;
SimMissile missile;
int length;
int player;
double angle;
double velocity;
} SimShot;
typedef struct
{
SimShot* shot;
int currentShot;
Vec2d position;
double angle;
double velocity;
double energy;
double oldVelocity;
int watch;
int deaths;
int kills;
int shots;
int active;
int valid;
int didShoot;
int timeout;
int timeoutcnt;
char name[16];
} SimPlayer;
typedef struct
{
Vec2d position;
double radius;
double mass;
} SimPlanet;

View file

@ -1,6 +1,6 @@
#pragma once
#include "opengl.h"
#include "opengl.hpp"
class TriangleWindow : public endofthejedi::GLWindow {
private:

View file

@ -1,90 +0,0 @@
#pragma once
#include <math.h>
struct Vec2d
{
double x;
double y;
double length() {
return sqrt(x*x + y*y);
}
double distance(Vec2d other) {
Vec2d tmp = (*this - other);
return tmp.length();
}
Vec2d & operator+=(const Vec2d& rhs) {
x+=rhs.x;
y+=rhs.y;
return *this;
}
Vec2d & operator-=(const Vec2d& rhs) {
x-=rhs.x;
y-=rhs.y;
return *this;
}
Vec2d & operator*=(const double& rhs) {
x*=rhs;
y*=rhs;
return *this;
}
Vec2d & operator/=(const double& rhs) {
x/=rhs;
y/=rhs;
return *this;
}
const Vec2d operator+(const Vec2d& rhs) const {
Vec2d result = *this;
result += rhs;
return result;
}
const Vec2d operator-(const Vec2d& rhs) const {
Vec2d result = *this;
result -= rhs;
return result;
}
const double operator*(const Vec2d& rhs) const {
return (this->x * rhs.x) + (this->y * rhs.y);
}
const Vec2d operator*(const double& rhs) const {
Vec2d result = *this;
result *= rhs;
return result;
}
const Vec2d operator/(const double& rhs) const {
Vec2d result = *this;
result /= rhs;
return result;
}
};
/*
struct Mat4d {
std::array<double, 16> data;
const Mat4d operator*(const Mat4d& rhs) const {
Mat4d result;
result[0] = result[0]*rhs[0] + result[1]*result[5] + result[2]*result[9] + result[3]*result[13];
result[1] = result[0]*rhs[1] + result[1]*result[6] + result[2]*result[10] + result[3]*result[14];
result[2] = result[0]*rhs[2] + result[1]*result[7] + result[2]*result[11] + result[3]*result[15];
result[3] = result[0]*rhs[3] + result[1]*result[8] + result[2]*result[12] + result[3]*result[16];
result[4] = result[4]*rhs[0] + result[5]*result[5] + result[6]*result[9] + result[7]*result[13];
result[5] = result[4]*rhs[1] + result[5]*result[6] + result[6]*result[10] + result[7]*result[14];
result[6] = result[4]*rhs[2] + result[5]*result[7] + result[6]*result[11] + result[7]*result[15];
result[7] = result[4]*rhs[3] + result[5]*result[8] + result[6]*result[12] + result[7]*result[16];
result[8] = result[8]*rhs[0] + result[9]*result[5] + result[10]*result[9] + result[11]*result[13];
result[9] = result[8]*rhs[1] + result[9]*result[6] + result[10]*result[10] + result[11]*result[14];
result[10] = result[8]*rhs[2] + result[9]*result[7] + result[10]*result[11] + result[11]*result[15];
result[11] = result[8]*rhs[3] + result[9]*result[8] + result[10]*result[12] + result[11]*result[16];
result[12] = result[12]*rhs[0] + result[13]*result[5] + result[14]*result[9] + result[15]*result[13];
result[13] = result[12]*rhs[1] + result[13]*result[6] + result[14]*result[10] + result[15]*result[14];
result[14] = result[12]*rhs[2] + result[13]*result[7] + result[14]*result[11] + result[15]*result[15];
result[15] = result[12]*rhs[3] + result[13]*result[8] + result[14]*result[12] + result[15]*result[16];
return result;
}
};
*/