-include sources.mk
-include src/sdl/subdir.mk
-include src/graphics/subdir.mk
+-include src/geometry/subdir.mk
-include src/battle/subdir.mk
-include src/app/subdir.mk
-include src/subdir.mk
src/sdl \
src \
src/graphics \
+src/geometry \
src/battle \
src/app \
--- /dev/null
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+CPP_SRCS += \
+../src/geometry/Point.cpp
+
+OBJS += \
+./src/geometry/Point.o
+
+CPP_DEPS += \
+./src/geometry/Point.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+src/geometry/%.o: ../src/geometry/%.cpp
+ @echo 'Building file: $<'
+ @echo 'Invoking: GCC C++ Compiler'
+ g++ -I/usr/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ @echo 'Finished building: $<'
+ @echo ' '
+
+
-include sources.mk
-include src/sdl/subdir.mk
-include src/graphics/subdir.mk
+-include src/geometry/subdir.mk
-include src/battle/subdir.mk
-include src/app/subdir.mk
-include src/subdir.mk
src/sdl \
src \
src/graphics \
+src/geometry \
src/battle \
src/app \
--- /dev/null
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+CPP_SRCS += \
+../src/geometry/Point.cpp
+
+OBJS += \
+./src/geometry/Point.o
+
+CPP_DEPS += \
+./src/geometry/Point.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+src/geometry/%.o: ../src/geometry/%.cpp
+ @echo 'Building file: $<'
+ @echo 'Invoking: GCC C++ Compiler'
+ g++ -I/usr/include/SDL -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ @echo 'Finished building: $<'
+ @echo ' '
+
+
--- /dev/null
+/*
+ * Point.cpp
+ *
+ * Created on: Aug 5, 2012
+ * Author: holy
+ */
+
+#include "Point.h"
+
+namespace geometry {
+
+} /* namespace geometry */
--- /dev/null
+/*
+ * Point.h
+ *
+ * Created on: Aug 5, 2012
+ * Author: holy
+ */
+
+#ifndef GEOMETRY_POINT_H_
+#define GEOMETRY_POINT_H_
+
+namespace geometry {
+
+template<class T>
+class Point {
+
+public:
+ Point() : x(0), y(0) { }
+ Point(T x, T y) : x(x), y(y) { }
+
+public:
+ T X() const { return x; }
+ T Y() const { return y; }
+
+private:
+ T x, y;
+
+};
+
+}
+
+#endif /* GEOMETRY_POINT_H_ */
#include "Sprite.h"
+using geometry::Point;
+
namespace graphics {
-void Sprite::Draw(SDL_Surface *dest, int x, int y, int col, int row) const {
+void Sprite::Draw(SDL_Surface *dest, Point<int> position, int col, int row) const {
SDL_Rect srcRect, destRect;
srcRect.x = col * Width();
srcRect.y = row * Height();
srcRect.w = Width();
srcRect.h = Height();
- destRect.x = x;
- destRect.y = y;
+ destRect.x = position.X();
+ destRect.y = position.Y();
destRect.w = Width();
destRect.h = Height();
SDL_BlitSurface(surface, &srcRect, dest, &destRect);
#ifndef GRAPHICS_SPRITE_H_
#define GRAPHICS_SPRITE_H_
+#include "../geometry/Point.h"
+
#include <SDL.h>
namespace graphics {
public:
int Width() const { return width; }
int Height() const { return height; }
- void Draw(SDL_Surface *dest, int x, int y, int col = 0, int row = 0) const;
+ void Draw(SDL_Surface *dest, geometry::Point<int> position, int col = 0, int row = 0) const;
private:
SDL_Surface *surface;