diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..1ecb8a8
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "Hearts/Codebase"]
+ path = Hearts/Codebase
+ url = https://github.com/Ratstail91/Codebase.git
diff --git a/Hearts/Codebase b/Hearts/Codebase
new file mode 160000
index 0000000..214d3f5
--- /dev/null
+++ b/Hearts/Codebase
@@ -0,0 +1 @@
+Subproject commit 214d3f51c4d08cdf37527a1ba292f893fccf7a29
diff --git a/Hearts/Hearts.vcproj b/Hearts/Hearts.vcproj
index dcacb6b..926d406 100644
--- a/Hearts/Hearts.vcproj
+++ b/Hearts/Hearts.vcproj
@@ -273,14 +273,6 @@
RelativePath=".\base_engine.h"
>
-
-
-
-
@@ -302,6 +294,162 @@
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Hearts/card.h b/Hearts/card.h
index 9b472d5..5b5ccc4 100644
--- a/Hearts/card.h
+++ b/Hearts/card.h
@@ -30,7 +30,7 @@
#include "SDL.h"
-#include "image.h"
+#include "Codebase/image.h"
#define ISCARD(CARD,RANK,SUIT) (CARD->GetSuit() == Card::SUIT && CARD->GetRank() == Card::RANK)
diff --git a/Hearts/deck.h b/Hearts/deck.h
index 540eda1..e6b8691 100644
--- a/Hearts/deck.h
+++ b/Hearts/deck.h
@@ -30,7 +30,7 @@
#include "SDL.h"
-#include "image.h"
+#include "Codebase/image.h"
#include "card_list.h"
diff --git a/Hearts/hearts_engine.h b/Hearts/hearts_engine.h
index 8f2dd04..3bfcb42 100644
--- a/Hearts/hearts_engine.h
+++ b/Hearts/hearts_engine.h
@@ -28,7 +28,7 @@
#ifndef KR_HEARTSENGINE_H_
#define KR_HEARTSENGINE_H_
#include "base_engine.h"
-#include "image.h"
+#include "Codebase/image.h"
#include "audio_manager.h"
#include "deck.h"
#include "player_ai.h"
diff --git a/Hearts/image.cpp b/Hearts/image.cpp
deleted file mode 100644
index a81d70e..0000000
--- a/Hearts/image.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/* File Name: image.cpp
- * Author: Kayne Ruse
- * Date (dd/mm/yyyy): 14/12/2012
- * Copyright: (c) Kayne Ruse 2012
- *
- * 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.
- *
- * Description:
- * ...
-*/
-#include "image.h"
-
-#include
-
-//-------------------------
-//Public access members
-//-------------------------
-
-Image::Image() {
- m_clip.x = m_clip.y = m_clip.w = m_clip.h = 0;
- m_pSurface = NULL;
- m_bLocal = false;
-}
-
-Image::~Image() {
- UnloadSurface();
-}
-
-//-------------------------
-//Surface handlers
-//-------------------------
-
-void Image::LoadSurface(const char* fname) {
- SDL_Surface* pSurface;
-
- if ( (pSurface = SDL_LoadBMP(fname)) == NULL)
- throw(std::exception("Failed to load surface"));
-
- UnloadSurface();
-
- SetSurface(pSurface);
-
- m_bLocal = true;
-
- SetColorKey(255, 0, 255);
-}
-
-void Image::UnloadSurface() {
- if (m_bLocal) {
- SDL_FreeSurface(m_pSurface);
- m_bLocal = false;
- }
-
- m_pSurface = NULL;
-}
-
-SDL_Surface* Image::SetSurface(SDL_Surface* pSurface) {
- if (m_bLocal)
- throw(std::exception("Failed to set surface, Image has a local surface"));
-
- if (!pSurface)
- throw(std::exception("Failed to set surface, given surface is NULL"));
-
- m_pSurface = pSurface;
-
- m_clip.x = 0;
- m_clip.y = 0;
- m_clip.w = m_pSurface->w;
- m_clip.h = m_pSurface->h;
-
- m_bLocal = false;
-
- return m_pSurface;
-}
-
-SDL_Surface* Image::GetSurface() {
- return m_pSurface;
-}
-
-void Image::SetColorKey(Uint8 r, Uint8 g, Uint8 b) {
- if (m_pSurface != NULL)
- SDL_SetColorKey(m_pSurface, SDL_SRCCOLORKEY, SDL_MapRGB(m_pSurface->format, r, g, b));
-}
-
-void Image::ClearColorKey() {
- if (m_pSurface != NULL)
- SDL_SetColorKey(m_pSurface, 0, 0);
-}
-
-//-------------------------
-//Rendering
-//-------------------------
-
-void Image::DrawTo(SDL_Surface* const pDest, Sint16 x, Sint16 y) {
- SDL_Rect sclip = m_clip, dclip = {x,y};
-
- SDL_BlitSurface(m_pSurface, &sclip, pDest, &dclip);
-}
diff --git a/Hearts/image.h b/Hearts/image.h
deleted file mode 100644
index 5cc00cc..0000000
--- a/Hearts/image.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* File Name: image.h
- * Author: Kayne Ruse
- * Date (dd/mm/yyyy): 14/12/2012
- * Copyright: (c) Kayne Ruse 2012
- *
- * 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.
- *
- * Description:
- * ...
-*/
-#ifndef KR_IMAGE_H_
-#define KR_IMAGE_H_ 2012121401
-
-#include "SDL.h"
-
-class Image {
-public:
- /* Public access members */
- Image();
- virtual ~Image();
-
- /* Surface handlers */
- void LoadSurface(const char* fname);
- void UnloadSurface();
-
- SDL_Surface* SetSurface(SDL_Surface*);
- SDL_Surface* GetSurface();
-
- void SetColorKey(Uint8 r, Uint8 g, Uint8 b);
- void ClearColorKey();
-
- /* Rendering */
- virtual void DrawTo(SDL_Surface* const, Sint16 x, Sint16 y);
-
- /* Clip handlers */
- SDL_Rect SetClip(SDL_Rect r) { return m_clip = r; }
- SDL_Rect GetClip() { return m_clip; }
-
- Sint16 SetClipX(Sint16 x) { return m_clip.x = x; }
- Sint16 SetClipY(Sint16 y) { return m_clip.y = y; }
- Uint16 SetClipW(Uint16 w) { return m_clip.w = w; }
- Uint16 SetClipH(Uint16 h) { return m_clip.h = h; }
-
- Sint16 GetClipX() { return m_clip.x; }
- Sint16 GetClipY() { return m_clip.y; }
- Uint16 GetClipW() { return m_clip.w; }
- Uint16 GetClipH() { return m_clip.h; }
-
- bool IsLoaded() { return m_pSurface != NULL; }
- bool IsLocal() { return m_bLocal; }
-
-private:
- SDL_Rect m_clip;
- SDL_Surface* m_pSurface;
- bool m_bLocal;
-};
-
-#endif