mirror of
https://github.com/Ratstail91/Hearts.git
synced 2025-11-29 02:24:28 +11:00
Added Codebase as a submodule
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "Hearts/Codebase"]
|
||||
path = Hearts/Codebase
|
||||
url = https://github.com/Ratstail91/Codebase.git
|
||||
1
Hearts/Codebase
Submodule
1
Hearts/Codebase
Submodule
Submodule Hearts/Codebase added at 214d3f51c4
@@ -273,14 +273,6 @@
|
||||
RelativePath=".\base_engine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\image.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\image.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\music.cpp"
|
||||
>
|
||||
@@ -302,6 +294,162 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Codebase"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Codebase\animator.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\animator.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\bbox.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\bbox.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\config_utility.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\config_utility.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\delta.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\delta.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\frame_rate.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\frame_rate.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\image.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\image.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\vector2.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Codebase\vector3.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "image.h"
|
||||
#include "Codebase/image.h"
|
||||
|
||||
#include "card_list.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"
|
||||
|
||||
115
Hearts/image.cpp
115
Hearts/image.cpp
@@ -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 <exception>
|
||||
|
||||
//-------------------------
|
||||
//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);
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user