From 131b0b433a22a75d02046ed7d2359f89f2dae491 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 26 Nov 2016 16:02:45 +1100 Subject: [PATCH] Renamed some folders --- .../graphics => client}/composite_image.hpp | 0 {common/graphics => client}/sprite_sheet.cpp | 0 {common/graphics => client}/sprite_sheet.hpp | 0 .../{utilities => debugging}/frame_rate.hpp | 0 .../barrier_defines.hpp | 0 .../character_defines.hpp | 0 .../creature_defines.hpp | 0 .../culling_defines.hpp | 0 .../item_type.hpp | 0 common/{gameplay => global_defines}/makefile | 0 common/graphics/makefile | 28 ----- common/utilities/bounding_box.hpp | 75 ------------ common/utilities/vector2.hpp | 111 ------------------ 13 files changed, 214 deletions(-) rename {common/graphics => client}/composite_image.hpp (100%) rename {common/graphics => client}/sprite_sheet.cpp (100%) rename {common/graphics => client}/sprite_sheet.hpp (100%) rename common/{utilities => debugging}/frame_rate.hpp (100%) rename common/{gameplay => global_defines}/barrier_defines.hpp (100%) rename common/{gameplay => global_defines}/character_defines.hpp (100%) rename common/{gameplay => global_defines}/creature_defines.hpp (100%) rename common/{gameplay => global_defines}/culling_defines.hpp (100%) rename common/{gameplay => global_defines}/item_type.hpp (100%) rename common/{gameplay => global_defines}/makefile (100%) delete mode 100644 common/graphics/makefile delete mode 100644 common/utilities/bounding_box.hpp delete mode 100644 common/utilities/vector2.hpp diff --git a/common/graphics/composite_image.hpp b/client/composite_image.hpp similarity index 100% rename from common/graphics/composite_image.hpp rename to client/composite_image.hpp diff --git a/common/graphics/sprite_sheet.cpp b/client/sprite_sheet.cpp similarity index 100% rename from common/graphics/sprite_sheet.cpp rename to client/sprite_sheet.cpp diff --git a/common/graphics/sprite_sheet.hpp b/client/sprite_sheet.hpp similarity index 100% rename from common/graphics/sprite_sheet.hpp rename to client/sprite_sheet.hpp diff --git a/common/utilities/frame_rate.hpp b/common/debugging/frame_rate.hpp similarity index 100% rename from common/utilities/frame_rate.hpp rename to common/debugging/frame_rate.hpp diff --git a/common/gameplay/barrier_defines.hpp b/common/global_defines/barrier_defines.hpp similarity index 100% rename from common/gameplay/barrier_defines.hpp rename to common/global_defines/barrier_defines.hpp diff --git a/common/gameplay/character_defines.hpp b/common/global_defines/character_defines.hpp similarity index 100% rename from common/gameplay/character_defines.hpp rename to common/global_defines/character_defines.hpp diff --git a/common/gameplay/creature_defines.hpp b/common/global_defines/creature_defines.hpp similarity index 100% rename from common/gameplay/creature_defines.hpp rename to common/global_defines/creature_defines.hpp diff --git a/common/gameplay/culling_defines.hpp b/common/global_defines/culling_defines.hpp similarity index 100% rename from common/gameplay/culling_defines.hpp rename to common/global_defines/culling_defines.hpp diff --git a/common/gameplay/item_type.hpp b/common/global_defines/item_type.hpp similarity index 100% rename from common/gameplay/item_type.hpp rename to common/global_defines/item_type.hpp diff --git a/common/gameplay/makefile b/common/global_defines/makefile similarity index 100% rename from common/gameplay/makefile rename to common/global_defines/makefile diff --git a/common/graphics/makefile b/common/graphics/makefile deleted file mode 100644 index 9363f70..0000000 --- a/common/graphics/makefile +++ /dev/null @@ -1,28 +0,0 @@ -#config -INCLUDES+=. ../utilities -LIBS+= -CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES)) - -#source -CXXSRC=$(wildcard *.cpp) - -#objects -OBJDIR=obj -OBJ+=$(addprefix $(OBJDIR)/,$(CXXSRC:.cpp=.o)) - -#targets -all: $(OBJ) $(OUT) - ar -crs $(OUT) $(OBJ) - -$(OBJ): | $(OBJDIR) - -$(OUT): | $(OUTDIR) - -$(OBJDIR): - mkdir $(OBJDIR) - -$(OUTDIR): - mkdir $(OUTDIR) - -$(OBJDIR)/%.o: %.cpp - $(CXX) $(CXXFLAGS) -c -o $@ $< diff --git a/common/utilities/bounding_box.hpp b/common/utilities/bounding_box.hpp deleted file mode 100644 index 06747b0..0000000 --- a/common/utilities/bounding_box.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright: (c) Kayne Ruse 2013-2016 - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. -*/ -#pragma once - -#include -#include - -class BoundingBox { -public: - //This is explicitly a POD - int x, y; - int w, h; - - BoundingBox() = default; - BoundingBox(int i, int j): x(i), y(j), w(0), h(0) {}; - BoundingBox(int i, int j, int k, int l): x(i), y(j), w(k), h(l) {}; - ~BoundingBox() = default; - BoundingBox& operator=(BoundingBox const&) = default; - - int Size() { - return std::max(w*h,0); - } - - bool CheckOverlap(BoundingBox rhs) { - return !( - x >= rhs.x + rhs.w || - y >= rhs.y + rhs.h || - rhs.x >= x + w || - rhs.y >= y + h); - } - - BoundingBox CalcOverlap(BoundingBox rhs) { - if (!CheckOverlap(rhs)) { - return {0, 0, 0, 0}; - } - BoundingBox ret; - ret.x = std::max(x, rhs.x); - ret.y = std::max(y, rhs.y); - ret.w = std::min(x+w, rhs.x+rhs.w) - ret.x; - ret.h = std::min(y+h, rhs.y+rhs.h) - ret.y; - return ret; - } -}; - -//This is explicitly a POD -static_assert(std::is_pod::value, "BoundingBox is not a POD"); - -#include "vector2.hpp" - -//operators -inline BoundingBox operator+(BoundingBox b, Vector2 v) { - return {b.x + (int)v.x, b.y + (int)v.y, b.w, b.h}; -} -inline BoundingBox operator+(Vector2 v, BoundingBox b) { - return b + v; -} diff --git a/common/utilities/vector2.hpp b/common/utilities/vector2.hpp deleted file mode 100644 index ad0b17f..0000000 --- a/common/utilities/vector2.hpp +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright: (c) Kayne Ruse 2013-2016 - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. -*/ -#pragma once - -#include -#include -#include - -class Vector2 { -public: - double x, y; - - Vector2() = default; - Vector2(double i, double j): x(i), y(j) {}; - ~Vector2() = default; - Vector2& operator=(Vector2 const&) = default; - - double Length() const { - return sqrt(x*x+y*y); - } - double SquaredLength() const { - return x*x+y*y; - } - void Normalize() { - double l = Length(); - if (l == 0) - throw(std::domain_error("Divide by zero")); - x /= l; - y /= l; - } - - //Arithmetic operators - Vector2 operator+(Vector2 v) const { - Vector2 ret; - ret.x = x + v.x; - ret.y = y + v.y; - return ret; - } - Vector2 operator-(Vector2 v) const { - Vector2 ret; - ret.x = x - v.x; - ret.y = y - v.y; - return ret; - } - Vector2 operator*(Vector2 v) const { - Vector2 ret; - ret.x = x * v.x; - ret.y = y * v.y; - return ret; - } - Vector2 operator*(double d) const { - Vector2 ret; - ret.x = x * d; - ret.y = y * d; - return ret; - } - - Vector2 operator/(Vector2 v) { - if (!v.x || !v.y) - throw(std::domain_error("Divide by zero")); - Vector2 ret; - ret.x = x / v.x; - ret.y = y / v.y; - return ret; - } - Vector2 operator/(double d) { - if (!d) - throw(std::domain_error("Divide by zero")); - Vector2 ret; - ret.x = x / d; - ret.y = y / d; - return ret; - } - - //unary operators - Vector2 operator-() { return {-x, -y}; } - - //comparison operators - bool operator==(Vector2 v) { return (x == v.x && y == v.y); } - bool operator!=(Vector2 v) { return (x != v.x || y != v.y); } - - //member templates (curry the above operators) - template Vector2 operator+=(T t) { return *this = *this + t; } - template Vector2 operator-=(T t) { return *this = *this - t; } - template Vector2 operator*=(T t) { return *this = *this * t; } - template Vector2 operator/=(T t) { return *this = *this / t; } - template bool operator==(T t) { return (x == t && y == t); } - template bool operator!=(T t) { return (x != t || y != t); } -}; - -//This is explicitly a POD -static_assert(std::is_pod::value, "Vector2 is not a POD");