summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-06-13 16:04:40 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-06-13 16:04:40 +0200
commitb4472061c4c23b59a6d4c52e34eb38e68d766807 (patch)
tree7450d92edc74a800312df9ab7bf8e34d3c2cfc6d /engine
parent0de601984c8af1d88affe1ac88d47cc9fe12de75 (diff)
Added wriggle. Moved vector- and matrix-classes to wriggle.
Diffstat (limited to 'engine')
-rw-r--r--engine/bulletpattern.cpp2
-rw-r--r--engine/bulletpattern.h2
-rw-r--r--engine/config.h4
-rw-r--r--engine/enemy.h2
-rw-r--r--engine/matrix.cpp45
-rw-r--r--engine/matrix.h26
-rw-r--r--engine/vector.cpp133
-rw-r--r--engine/vector.h58
8 files changed, 5 insertions, 267 deletions
diff --git a/engine/bulletpattern.cpp b/engine/bulletpattern.cpp
index 39f6742..eabf554 100644
--- a/engine/bulletpattern.cpp
+++ b/engine/bulletpattern.cpp
@@ -1,6 +1,6 @@
#include <cmath>
#include "bulletpattern.h"
-#include "matrix.h"
+#include <wriggle/matrix.h>
BulletPattern1::BulletPattern1(const Vector2& initpos) {
num_bullets = steps = 0;
diff --git a/engine/bulletpattern.h b/engine/bulletpattern.h
index ab87635..5656680 100644
--- a/engine/bulletpattern.h
+++ b/engine/bulletpattern.h
@@ -1,7 +1,7 @@
#ifndef BULLETPATTERN_H
#define BULLETPATTERN_H
-#include "vector.h"
+#include <wriggle/vector.h>
#include "struct.h"
#include <SDL/SDL_opengl.h>
diff --git a/engine/config.h b/engine/config.h
index 6884b1a..cae33b4 100644
--- a/engine/config.h
+++ b/engine/config.h
@@ -2,8 +2,8 @@
#define CONFIG_H
namespace Config {
- const unsigned int window_w = 1280;
- const unsigned int window_h = 800;
+ const unsigned int window_w = 1440;
+ const unsigned int window_h = 1080;
const float viewport_x = 15.0 / 1080.0;
const float viewport_y = 15.0 / 1080.0;
diff --git a/engine/enemy.h b/engine/enemy.h
index 7396b55..ae8e599 100644
--- a/engine/enemy.h
+++ b/engine/enemy.h
@@ -1,7 +1,7 @@
#ifndef ENEMY_H
#define ENEMY_H
-#include "vector.h"
+#include <wriggle/vector.h>
#include "texture.h"
#include "bulletpattern.h"
diff --git a/engine/matrix.cpp b/engine/matrix.cpp
deleted file mode 100644
index 5970123..0000000
--- a/engine/matrix.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "matrix.h"
-
-#include <cmath>
-
-Matrix2::Matrix2() {
- m[0][0] = m[0][1] =
- m[1][0] = m[1][1] = 0;
-}
-
-Matrix2::Matrix2(float m00, float m01, float m10, float m11) {
- m[0][0] = m00;
- m[0][1] = m01;
- m[1][0] = m10;
- m[1][1] = m11;
-}
-
-Matrix2 Matrix2::operator*(const Matrix2& mat) {
- return Matrix2(
- m[0][0] * mat.m[0][0] + m[0][1] * mat.m[1][0],
- m[0][0] * mat.m[0][1] + m[0][1] * mat.m[1][1],
- m[1][0] * mat.m[0][0] + m[1][1] * mat.m[1][0],
- m[1][0] * mat.m[0][1] + m[1][1] * mat.m[1][1]);
-}
-
-Matrix2 Matrix2::operator*(float f) {
- return Matrix2(
- m[0][0] * f,
- m[0][1] * f,
- m[1][0] * f,
- m[1][1] * f);
-}
-
-Vector2 Matrix2::operator*(const Vector2& v) {
- return Vector2(
- m[0][0] * v.x + m[0][1] * v.y,
- m[1][0] * v.x + m[1][1] * v.y);
-}
-
-Matrix2 rotation_matrix(float rot) {
- float s = sinf(rot);
- float c = cosf(rot);
- return Matrix2(
- c, -s,
- s, c);
-} \ No newline at end of file
diff --git a/engine/matrix.h b/engine/matrix.h
deleted file mode 100644
index 8be483a..0000000
--- a/engine/matrix.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef MATRIX_H
-#define MATRIX_H
-
-#include "vector.h"
-
-template<int M, int N>
-class Matrix {
- public:
- float m[M][N];
-};
-
-class Matrix2 : Matrix<2, 2> {
- public:
- Matrix2();
- Matrix2(float m00, float m01, float m10, float m11);
-
- Matrix2 operator*(const Matrix2& mat);
-
- Matrix2 operator*(float f);
-
- Vector2 operator*(const Vector2& v);
-};
-
-Matrix2 rotation_matrix(float rot);
-
-#endif
diff --git a/engine/vector.cpp b/engine/vector.cpp
deleted file mode 100644
index 6c71991..0000000
--- a/engine/vector.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "vector.h"
-
-Vector2::Vector2() {
- x = y = 0;
-}
-
-Vector2::Vector2(float p1, float p2) {
- x = p1;
- y = p2;
-}
-
-Vector2::Vector2(const Vector2& v) {
- x = v.x;
- y = v.y;
-}
-
-Vector2& Vector2::operator=(const Vector2& v) {
- x = v.x;
- y = v.y;
- return *this;
-}
-
-Vector2& Vector2::operator+=(const Vector2& v) {
- x += v.x;
- y += v.y;
- return *this;
-}
-
-Vector2& Vector2::operator+(const Vector2& v) {
- return Vector2(*this) += v;
-}
-
-Vector2& Vector2::operator-=(const Vector2& v) {
- x -= v.x;
- y -= v.y;
- return *this;
-}
-
-Vector2& Vector2::operator-(const Vector2& v) {
- return Vector2(*this) -= v;
-}
-
-Vector3::Vector3() : Vector2() {
- z = 0;
-}
-
-Vector3::Vector3(float p1, float p2, float p3) {
- x = p1;
- y = p2;
- z = p3;
-}
-
-Vector3::Vector3(const Vector3& v) {
- x = v.x;
- y = v.y;
- z = v.z;
-}
-
-Vector3& Vector3::operator=(const Vector3& v) {
- x = v.x;
- y = v.y;
- z = v.z;
- return *this;
-}
-
-Vector3& Vector3::operator+=(const Vector3& v) {
- x += v.x;
- y += v.y;
- z += v.z;
- return *this;
-}
-
-Vector3& Vector3::operator+(const Vector3& v) {
- return Vector3(*this) += v;
-}
-
-Vector3& Vector3::operator-=(const Vector3& v) {
- x -= v.x;
- y -= v.y;
- z -= v.z;
- return *this;
-}
-
-Vector3& Vector3::operator-(const Vector3& v) {
- return Vector3(*this) -= v;
-}
-
-Vector4::Vector4() : Vector3() {
- w = 0;
-}
-
-Vector4::Vector4(float p1, float p2, float p3, float p4) : Vector3(p1, p2, p3) {
- w = p4;
-}
-
-Vector4::Vector4(const Vector4& v) {
- x = v.x;
- y = v.y;
- z = v.z;
- w = v.w;
-}
-
-Vector4& Vector4::operator=(const Vector4& v) {
- x = v.x;
- y = v.y;
- z = v.z;
- w = v.w;
- return *this;
-}
-
-Vector4& Vector4::operator+=(const Vector4& v) {
- x += v.x;
- y += v.y;
- z += v.z;
- w += v.w;
- return *this;
-}
-
-Vector4& Vector4::operator+(const Vector4& v) {
- return Vector4(*this) += v;
-}
-
-Vector4& Vector4::operator-=(const Vector4& v) {
- x -= v.x;
- y -= v.y;
- z -= v.z;
- w -= v.w;
- return *this;
-}
-
-Vector4& Vector4::operator-(const Vector4& v) {
- return Vector4(*this) -= v;
-}
diff --git a/engine/vector.h b/engine/vector.h
deleted file mode 100644
index 8d85684..0000000
--- a/engine/vector.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _VECTOR_H_
-#define _VECTOR_H_
-
-class Vector2 {
- public:
- union {
- float x, r;
- };
- union {
- float y, g;
- };
-
- Vector2();
- Vector2(float p1, float p2);
- Vector2(const Vector2& v);
-
- Vector2& operator=(const Vector2& v);
- Vector2& operator+=(const Vector2& v);
- Vector2& operator+(const Vector2& v);
- Vector2& operator-=(const Vector2& v);
- Vector2& operator-(const Vector2& v);
-};
-
-class Vector3 : public Vector2 {
- public:
- union {
- float z, b;
- };
-
- Vector3();
- Vector3(float p1, float p2, float p3);
- Vector3(const Vector3& v);
-
- Vector3& operator=(const Vector3& v);
- Vector3& operator+=(const Vector3& v);
- Vector3& operator+(const Vector3& v);
- Vector3& operator-=(const Vector3& v);
- Vector3& operator-(const Vector3& v);
-};
-
-class Vector4 : public Vector3 {
- public:
- union {
- float w, a;
- };
-
- Vector4();
- Vector4(float p1, float p2, float p3, float p4);
- Vector4(const Vector4& v);
-
- Vector4& operator=(const Vector4& v);
- Vector4& operator+=(const Vector4& v);
- Vector4& operator+(const Vector4& v);
- Vector4& operator-=(const Vector4& v);
- Vector4& operator-(const Vector4& v);
-};
-
-#endif