[Remove] My god! I was so stupid two years ago. Kill a shed load of unneeded namespaces.
This commit is contained in:
parent
2c00325c29
commit
4c0654e148
33
Bin/LibD.pro
33
Bin/LibD.pro
@ -42,25 +42,7 @@ HEADERS += ../src/Actor/Player.h \
|
|||||||
../src/System/Debug.h \
|
../src/System/Debug.h \
|
||||||
../src/System/ResourceManager.h \
|
../src/System/ResourceManager.h \
|
||||||
../src/System/Convert/str2int.h \
|
../src/System/Convert/str2int.h \
|
||||||
../src/System/Filesystem/SCpak.h \
|
|
||||||
../src/System/Filesystem/RlePackedFileWrapper.h \
|
|
||||||
../src/System/Filesystem/IOapi.h \
|
|
||||||
../src/System/Filesystem/FileTimestampChecker.h \
|
|
||||||
../src/System/Convert/ConvertType.h \
|
../src/System/Convert/ConvertType.h \
|
||||||
../src/System/Filesystem/OutputCompressedFileStream.h \
|
|
||||||
../src/System/Filesystem/InputCompressedFileStream.h \
|
|
||||||
../src/System/Filesystem/ZipPackage.h \
|
|
||||||
../src/System/Filesystem/InputStream.h \
|
|
||||||
../src/System/Filesystem/OutputStream.h \
|
|
||||||
../src/System/Filesystem/EmptyBuffer.h \
|
|
||||||
../src/System/Filesystem/IFileList.h \
|
|
||||||
../src/System/Filesystem/IFilePackage.h \
|
|
||||||
../src/System/Filesystem/FileList.h \
|
|
||||||
../src/System/Filesystem/InputFileStream.h \
|
|
||||||
../src/System/Filesystem/FilePackageManager.h \
|
|
||||||
../src/System/Filesystem/InputStreamWrapper.h \
|
|
||||||
../src/System/Filesystem/MemoryStream.h \
|
|
||||||
../src/System/Filesystem/Checksum.h \
|
|
||||||
../src/Texture/Texture.h \
|
../src/Texture/Texture.h \
|
||||||
../src/Sound/Music.h \
|
../src/Sound/Music.h \
|
||||||
../src/TMXParser/base64.h \
|
../src/TMXParser/base64.h \
|
||||||
@ -112,21 +94,6 @@ SOURCES += ../src/Actor/Player.cpp \
|
|||||||
../src/Sprite/Sprite.cpp \
|
../src/Sprite/Sprite.cpp \
|
||||||
../src/System/Debug.cpp \
|
../src/System/Debug.cpp \
|
||||||
../src/System/Convert/str2int.cpp \
|
../src/System/Convert/str2int.cpp \
|
||||||
../src/System/Filesystem/SCpak.cpp \
|
|
||||||
../src/System/Filesystem/RlePackedFileWrapper.cpp \
|
|
||||||
../src/System/Filesystem/FileTimestampChecker.cpp \
|
|
||||||
../src/System/Filesystem/OutputCompressedFileStream.cpp \
|
|
||||||
../src/System/Filesystem/InputCompressedFileStream.cpp \
|
|
||||||
../src/System/Filesystem/ZipPackage.cpp \
|
|
||||||
../src/System/Filesystem/InputStream.cpp \
|
|
||||||
../src/System/Filesystem/OutputStream.cpp \
|
|
||||||
../src/System/Filesystem/FileList.cpp \
|
|
||||||
../src/System/Filesystem/InputFileStream.cpp \
|
|
||||||
../src/System/Filesystem/FilePackageManager.cpp \
|
|
||||||
../src/System/Filesystem/InputStreamWrapper.cpp \
|
|
||||||
../src/System/Filesystem/MemoryStream.cpp \
|
|
||||||
../src/System/Filesystem/SCCopyFile.cpp \
|
|
||||||
../src/System/Filesystem/Checksum.cpp \
|
|
||||||
../src/Texture/Texture.cpp \
|
../src/Texture/Texture.cpp \
|
||||||
../src/Sound/Music.cpp \
|
../src/Sound/Music.cpp \
|
||||||
../src/Actor/NPC.cpp \
|
../src/Actor/NPC.cpp \
|
||||||
|
@ -2,12 +2,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../System/Debug.h"
|
#include "../System/Debug.h"
|
||||||
#include "../System/Filesystem/InputStreamWrapper.h"
|
|
||||||
#include "AnimationSequence.h"
|
#include "AnimationSequence.h"
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
|
||||||
using namespace saracraft::filesystem;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load and read a sequence file for an animating sprite then
|
* Load and read a sequence file for an animating sprite then
|
||||||
* stores the result so you can call the sprites animation at any time.
|
* stores the result so you can call the sprites animation at any time.
|
||||||
@ -47,7 +43,7 @@ void AnimationSequence::ReadFile(void) {
|
|||||||
fseek(file, 0, SEEK_END);
|
fseek(file, 0, SEEK_END);
|
||||||
int fileSize = ftell(file);
|
int fileSize = ftell(file);
|
||||||
rewind(file);
|
rewind(file);
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
char* temp = new char[fileSize + 1];
|
char* temp = new char[fileSize + 1];
|
||||||
temp[fileSize] = 0;
|
temp[fileSize] = 0;
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
#define ENDOFLINE 59
|
#define ENDOFLINE 59
|
||||||
#define SPACE 32
|
#define SPACE 32
|
||||||
|
|
||||||
using saracraft::util::String;
|
|
||||||
|
|
||||||
struct Animation {
|
struct Animation {
|
||||||
String _animationID;
|
String _animationID;
|
||||||
int frameBegin;
|
int frameBegin;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "Slot.h"
|
#include "Slot.h"
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
|
||||||
|
|
||||||
Slot::Slot(void) {
|
Slot::Slot(void) {
|
||||||
_triggered = false;
|
_triggered = false;
|
||||||
_selected = false;
|
_selected = false;
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#include "../System/Debug.h"
|
#include "../System/Debug.h"
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
|
||||||
|
|
||||||
Font::Font(void) {
|
Font::Font(void) {
|
||||||
_texture = 0;
|
_texture = 0;
|
||||||
_spaceWidth = 0;
|
_spaceWidth = 0;
|
||||||
@ -105,13 +103,13 @@ void Font::RenderText(int xOffset, int yOffset, const char* text) {
|
|||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
const int textLength = strlen(text);
|
const int textLength = strlen(text);
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
for(int i = 0; i < textLength; i++) {
|
for(int i = 0; i < textLength; i++) {
|
||||||
char c = text[i];
|
char c = text[i];
|
||||||
|
|
||||||
if(c == ' ') {
|
if(c == ' ') {
|
||||||
x += _spaceWidth;
|
x += _spaceWidth;
|
||||||
continue;
|
continue;
|
||||||
@ -132,14 +130,14 @@ void Font::RenderText(int xOffset, int yOffset, const char* text) {
|
|||||||
glVertex2i(
|
glVertex2i(
|
||||||
charInfo.xOffset + x + xOffset,
|
charInfo.xOffset + x + xOffset,
|
||||||
charInfo.yOffset + y + yOffset);
|
charInfo.yOffset + y + yOffset);
|
||||||
|
|
||||||
glTexCoord2f(
|
glTexCoord2f(
|
||||||
charInfo.uvX + charInfo.uvW,
|
charInfo.uvX + charInfo.uvW,
|
||||||
charInfo.uvY);
|
charInfo.uvY);
|
||||||
glVertex2i(
|
glVertex2i(
|
||||||
charInfo.xOffset + x + charInfo.width + xOffset,
|
charInfo.xOffset + x + charInfo.width + xOffset,
|
||||||
charInfo.yOffset + y + yOffset);
|
charInfo.yOffset + y + yOffset);
|
||||||
|
|
||||||
glTexCoord2f(
|
glTexCoord2f(
|
||||||
charInfo.uvX + charInfo.uvW,
|
charInfo.uvX + charInfo.uvW,
|
||||||
charInfo.uvY + charInfo.uvH);
|
charInfo.uvY + charInfo.uvH);
|
||||||
@ -165,7 +163,7 @@ void Font::RenderText(int xOffset, int yOffset, const char* text) {
|
|||||||
void Font::TextSize(const char* text, int& width, int& height) {
|
void Font::TextSize(const char* text, int& width, int& height) {
|
||||||
width = 0;
|
width = 0;
|
||||||
height = _lineSkip;
|
height = _lineSkip;
|
||||||
|
|
||||||
int textLength = strlen(text);
|
int textLength = strlen(text);
|
||||||
for(int i = 0; i < textLength; i++) {
|
for(int i = 0; i < textLength; i++) {
|
||||||
char c = text[i];
|
char c = text[i];
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Input.h"
|
#include "Input.h"
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
|
||||||
|
|
||||||
static mouse_t mouse;
|
static mouse_t mouse;
|
||||||
static keyboard_t keyboard;
|
static keyboard_t keyboard;
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
|
||||||
|
|
||||||
Level::Level(Game* game) {
|
Level::Level(Game* game) {
|
||||||
_game = game;
|
_game = game;
|
||||||
_width = 0;
|
_width = 0;
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#include "../System/String.h"
|
#include "../System/String.h"
|
||||||
#include "../Math/Vec2.h"
|
#include "../Math/Vec2.h"
|
||||||
|
|
||||||
using saracraft::util::String;
|
|
||||||
|
|
||||||
class Warp {
|
class Warp {
|
||||||
public:
|
public:
|
||||||
Warp(void);
|
Warp(void);
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "TitleScreen.h"
|
#include "TitleScreen.h"
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
|
||||||
|
|
||||||
Game::Game(void) {
|
Game::Game(void) {
|
||||||
_level = new Level(this);
|
_level = new Level(this);
|
||||||
_player = new Player(_level);
|
_player = new Player(_level);
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#include "../Global/Constants.h"
|
#include "../Global/Constants.h"
|
||||||
#include "../System/Debug.h"
|
#include "../System/Debug.h"
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
|
||||||
|
|
||||||
void Destroy(void) {
|
void Destroy(void) {
|
||||||
TTF_Quit();
|
TTF_Quit();
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "Music.h"
|
#include "Music.h"
|
||||||
|
|
||||||
saracraft::util::ResourceManager<Music> musicManager;
|
ResourceManager<Music> musicManager;
|
||||||
|
|
||||||
Music::Music() : Resource() {
|
Music::Music() : Resource() {
|
||||||
_music = NULL;
|
_music = NULL;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
struct _Mix_Music;
|
struct _Mix_Music;
|
||||||
|
|
||||||
class Music : public saracraft::util::Resource {
|
class Music : public Resource {
|
||||||
template<class T> friend class saracraft::util::ResourceManager;
|
template<class T> friend class ResourceManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Music();
|
Music();
|
||||||
@ -21,4 +21,4 @@ private:
|
|||||||
struct _Mix_Music* _music;
|
struct _Mix_Music* _music;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern saracraft::util::ResourceManager<Music> musicManager;
|
extern ResourceManager<Music> musicManager;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "SoundEffect.h"
|
#include "SoundEffect.h"
|
||||||
|
|
||||||
saracraft::util::ResourceManager<SoundEffect> sfxManager;
|
ResourceManager<SoundEffect> sfxManager;
|
||||||
|
|
||||||
SoundEffect::SoundEffect() {
|
SoundEffect::SoundEffect() {
|
||||||
_chunk = NULL;
|
_chunk = NULL;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
struct Mix_Chunk;
|
struct Mix_Chunk;
|
||||||
|
|
||||||
class SoundEffect : public saracraft::util::Resource {
|
class SoundEffect : public Resource {
|
||||||
template<class T> friend class saracraft::util::ResourceManager;
|
template<class T> friend class ResourceManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SoundEffect();
|
SoundEffect();
|
||||||
@ -22,4 +22,4 @@ private:
|
|||||||
Mix_Chunk* _chunk;
|
Mix_Chunk* _chunk;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern saracraft::util::ResourceManager<SoundEffect> sfxManager;
|
extern ResourceManager<SoundEffect> sfxManager;
|
||||||
|
@ -5,9 +5,6 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace saracraft {
|
|
||||||
namespace util {
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct ConvertBase {
|
struct ConvertBase {
|
||||||
enum { charCount = sizeof(T) };
|
enum { charCount = sizeof(T) };
|
||||||
@ -49,6 +46,3 @@ struct ConvertTo: private ConvertBase<T> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
|
|
||||||
} // Namespace util.
|
|
||||||
} // Namespace saracraft.
|
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace saracraft {
|
|
||||||
namespace util {
|
|
||||||
|
|
||||||
extern char* int2str(int value);
|
extern char* int2str(int value);
|
||||||
extern int str2int(const char* string);
|
extern int str2int(const char* string);
|
||||||
extern int str2int_errno(void);
|
extern int str2int_errno(void);
|
||||||
extern char* time2str(int secs); // hh:mm::ss.
|
extern char* time2str(int secs); // hh:mm::ss.
|
||||||
|
|
||||||
} // Namespace util.
|
|
||||||
} // Namespace saracraft.
|
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace saracraft {
|
|
||||||
namespace util {
|
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
// The Debug log allows us to display ever piece of data that
|
// The Debug log allows us to display ever piece of data that
|
||||||
// populates our class components, anything that is loaded, serialized,
|
// populates our class components, anything that is loaded, serialized,
|
||||||
@ -103,6 +100,3 @@ void Debug::closeLog(void) {
|
|||||||
delete logger;
|
delete logger;
|
||||||
logger = NULL;
|
logger = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace util.
|
|
||||||
} // End of namespace saracraft.
|
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "string"
|
#include "string"
|
||||||
|
|
||||||
namespace saracraft {
|
|
||||||
namespace util {
|
|
||||||
|
|
||||||
class Debug {
|
class Debug {
|
||||||
public:
|
public:
|
||||||
Debug(bool logToFile);
|
Debug(bool logToFile);
|
||||||
@ -16,14 +13,11 @@ public:
|
|||||||
void message(const char *msg, ...);
|
void message(const char *msg, ...);
|
||||||
static bool openLog(bool logToFile);
|
static bool openLog(bool logToFile);
|
||||||
static void closeLog(void);
|
static void closeLog(void);
|
||||||
|
|
||||||
static Debug *logger;
|
static Debug *logger;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::ofstream _logFile;
|
std::ofstream _logFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace util.
|
|
||||||
} // Namespace saracraft.
|
|
||||||
|
|
||||||
#endif // _DEBUG_H_
|
#endif // _DEBUG_H_
|
||||||
|
@ -5,9 +5,6 @@
|
|||||||
|
|
||||||
#include "../System/String.h"
|
#include "../System/String.h"
|
||||||
|
|
||||||
namespace saracraft {
|
|
||||||
namespace util {
|
|
||||||
|
|
||||||
class Resource {
|
class Resource {
|
||||||
public:
|
public:
|
||||||
virtual bool Load(const std::string& filename) = 0;
|
virtual bool Load(const std::string& filename) = 0;
|
||||||
@ -99,6 +96,3 @@ public:
|
|||||||
private:
|
private:
|
||||||
ResourceMap m_resources;
|
ResourceMap m_resources;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace util.
|
|
||||||
} // Namespace saracraft.
|
|
||||||
|
@ -5,9 +5,6 @@
|
|||||||
#include "String.h"
|
#include "String.h"
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
namespace saracraft {
|
|
||||||
namespace util {
|
|
||||||
|
|
||||||
String::String(void) {
|
String::String(void) {
|
||||||
_string = new char[1];
|
_string = new char[1];
|
||||||
_string[0] = 0;
|
_string[0] = 0;
|
||||||
@ -62,7 +59,7 @@ void String::Format(const char* format, ...) {
|
|||||||
_length = 4095;
|
_length = 4095;
|
||||||
_string = new char[_length + 1];
|
_string = new char[_length + 1];
|
||||||
memset(_string, 0, _length + 1);
|
memset(_string, 0, _length + 1);
|
||||||
|
|
||||||
va_list vlist;
|
va_list vlist;
|
||||||
|
|
||||||
va_start(vlist, format);
|
va_start(vlist, format);
|
||||||
@ -153,6 +150,3 @@ String String::operator+(const String& value) const {
|
|||||||
String::operator const char*() const {
|
String::operator const char*() const {
|
||||||
return _string;
|
return _string;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace util.
|
|
||||||
} // End of namespace saracraft.
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
namespace saracraft {
|
|
||||||
namespace util {
|
|
||||||
|
|
||||||
class String {
|
class String {
|
||||||
public:
|
public:
|
||||||
String(void);
|
String(void);
|
||||||
@ -37,6 +34,3 @@ private:
|
|||||||
char* _string;
|
char* _string;
|
||||||
int _length;
|
int _length;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace util.
|
|
||||||
} // Namespace saracraft.
|
|
||||||
|
@ -11,9 +11,7 @@ using namespace std;
|
|||||||
#define GL_BGRA_EXT 0x80E1
|
#define GL_BGRA_EXT 0x80E1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using saracraft::util::Debug;
|
ResourceManager<Texture> textureManager;
|
||||||
|
|
||||||
saracraft::util::ResourceManager<Texture> textureManager;
|
|
||||||
|
|
||||||
static GLuint boundTexture = 0;
|
static GLuint boundTexture = 0;
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ void BindTexture(GLuint texID);
|
|||||||
|
|
||||||
#include "../System/ResourceManager.h"
|
#include "../System/ResourceManager.h"
|
||||||
|
|
||||||
class Texture : public saracraft::util::Resource {
|
class Texture : public Resource {
|
||||||
template<class T> friend class saracraft::util::ResourceManager;
|
template<class T> friend class ResourceManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Texture();
|
Texture();
|
||||||
@ -46,4 +46,4 @@ private:
|
|||||||
int height;
|
int height;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern saracraft::util::ResourceManager<Texture> textureManager;
|
extern ResourceManager<Texture> textureManager;
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include "../System/String.h"
|
#include "../System/String.h"
|
||||||
#include "../Font/Font.h"
|
#include "../Font/Font.h"
|
||||||
|
|
||||||
using saracraft::util::String;
|
|
||||||
|
|
||||||
class Button {
|
class Button {
|
||||||
public:
|
public:
|
||||||
Button(void);
|
Button(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user