[Fix] Animation was farked!

[Fix] Strings are now allocated from the heap.
This commit is contained in:
Tamir Atias 2012-04-17 03:58:42 +03:00
parent d4ede47353
commit e35cb64246
36 changed files with 216 additions and 149 deletions

View File

@ -86,6 +86,8 @@
<ClInclude Include="..\..\src\Actor\Actor.h" />
<ClInclude Include="..\..\src\Actor\NPC.h" />
<ClInclude Include="..\..\src\Actor\Player.h" />
<ClInclude Include="..\..\src\Animation\AnimatingSprite.h" />
<ClInclude Include="..\..\src\Animation\AnimationSequence.h" />
<ClInclude Include="..\..\src\Collision\AABB.h" />
<ClInclude Include="..\..\src\Font\Font.h" />
<ClInclude Include="..\..\src\Global\Constants.h" />
@ -131,6 +133,8 @@
<ClCompile Include="..\..\src\Actor\Actor.cpp" />
<ClCompile Include="..\..\src\Actor\NPC.cpp" />
<ClCompile Include="..\..\src\Actor\Player.cpp" />
<ClCompile Include="..\..\src\Animation\AnimatingSprite.cpp" />
<ClCompile Include="..\..\src\Animation\AnimationSequence.cpp" />
<ClCompile Include="..\..\src\Collision\AABB.cpp" />
<ClCompile Include="..\..\src\Font\Font.cpp" />
<ClCompile Include="..\..\src\Global\Constants.cpp" />

View File

@ -43,6 +43,9 @@
<Filter Include="Font">
<UniqueIdentifier>{be4a8635-8a7a-45ba-8c95-06e95cdfb8e3}</UniqueIdentifier>
</Filter>
<Filter Include="Animation">
<UniqueIdentifier>{2826112d-5f07-4ee2-b4b4-2be9289c6811}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\Main\Game.h">
@ -174,6 +177,12 @@
<ClInclude Include="..\..\src\System\String.h">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Animation\AnimatingSprite.h">
<Filter>Animation</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Animation\AnimationSequence.h">
<Filter>Animation</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\Main\main.cpp">
@ -281,5 +290,11 @@
<ClCompile Include="..\..\src\System\String.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Animation\AnimationSequence.cpp">
<Filter>Animation</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Animation\AnimatingSprite.cpp">
<Filter>Animation</Filter>
</ClCompile>
</ItemGroup>
</Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,3 +1,3 @@
2;
Idle 1 1;
Walk 2 4;
Walk 1 4;

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

View File

@ -0,0 +1,3 @@
2;
Idle 1 1;
Walk 1 4;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 845 B

View File

@ -0,0 +1,3 @@
2;
Idle 1 1;
Walk 1 4;

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

View File

@ -0,0 +1,3 @@
2;
Idle 1 1;
Walk 1 4;

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -4,8 +4,6 @@
#include "../Sound/SoundEffect.h"
Actor::Actor(void) {
_actor = new Sprite();
_stepSFX[0] = sfxManager.Load("../Data/SFX/step_cloth1.wav");
_stepSFX[1] = sfxManager.Load("../Data/SFX/step_cloth2.wav");
_stepSFX[2] = sfxManager.Load("../Data/SFX/step_cloth3.wav");
@ -13,9 +11,12 @@ Actor::Actor(void) {
_lastStepSFXPlayed = -1;
_velocity = 4.0f;
_direction = Front;
_direction = FRONT;
_preventMovement = NONE;
x = 0.0f;
y = 0.0f;
_actorLeft = new AnimatingSprite();
_actorRight = new AnimatingSprite();
_actorFront = new AnimatingSprite();
@ -29,44 +30,37 @@ Actor::~Actor(void) {
_stepSFX[i] = NULL;
}
}
delete _actor;
delete _actorLeft;
delete _actorRight;
delete _actorFront;
delete _actorBack;
}
void Actor::LoadSprite(const char* filename) {
_actor->LoadSprite(filename);
w = _actor->GetWidth();
h = _actor->GetHeight();
void Actor::LoadSprites(const String& basename) {
String frontFilename = String("../Data/Img/") + basename + "/Front/" + basename + "_F";
String leftFilename = String("../Data/Img/") + basename + "/Left/" + basename + "_L";
String rightFilename = String("../Data/Img/") + basename + "/Right/" + basename + "_R";
String backFilename = String("../Data/Img/") + basename + "/Back/" + basename + "_B";
_actorFront->LoadAnimatingSprite(frontFilename, frontFilename, 4, 1.0f / _velocity);
_actorLeft->LoadAnimatingSprite(leftFilename, leftFilename, 4, 1.0f / _velocity);
_actorRight->LoadAnimatingSprite(rightFilename, rightFilename, 4, 1.0f / _velocity);
_actorBack->LoadAnimatingSprite(backFilename, backFilename, 4, 1.0f / _velocity);
}
void Actor::Update(float dt) {
float oldX = x = _actor->GetX();
float oldY = y = _actor->GetY();
GetAnimation()->Update(dt);
if(_direction == LEFT) {
_actorLeft->Update(dt);
}
else if(_direction == RIGHT) {
_actorRight->Update(dt);
}
else if(_direction == Front) {
_actorFront->Update(dt);
}
else if(_direction == BACK) {
_actorBack->Update(dt);
}
float oldX = x;
float oldY = y;
// We should check for collisions now.
Move(dt);
if(x != oldX || y != oldY) {
GetAnimation()->SetCurrentAnimation(1);
if(!SoundEffect::IsPlaying(1)) {
int sfxIndex;
do {
@ -78,12 +72,39 @@ void Actor::Update(float dt) {
_lastStepSFXPlayed = sfxIndex;
}
}
else {
GetAnimation()->SetCurrentAnimation(0);
}
}
void Actor::Render(void) {
_actor->Draw();
GetAnimation()->Render(x, y);
}
void Actor::Render(float x, float y) {
_actor->Draw(x, y);
GetAnimation()->Render(x, y);
}
AnimatingSprite* Actor::GetAnimation(void) {
if(_direction == LEFT) {
return _actorLeft;
}
else if(_direction == RIGHT) {
return _actorRight;
}
else if(_direction == FRONT) {
return _actorFront;
}
else if(_direction == BACK) {
return _actorBack;
}
return NULL;
}
float Actor::GetWidth(void) {
return GetAnimation()->GetCurrentFrameSprite()->GetWidth();
}
float Actor::GetHeight(void) {
return GetAnimation()->GetCurrentFrameSprite()->GetHeight();
}

View File

@ -11,7 +11,7 @@ class Actor {
public:
enum Facing {
Front,
FRONT,
BACK,
LEFT,
RIGHT,
@ -26,7 +26,7 @@ public:
Actor(void);
~Actor(void);
void LoadSprite(const char* filename);
void LoadSprites(const String& basename);
virtual void Update(float dt);
virtual void Render(void);
@ -34,8 +34,8 @@ public:
float GetX(void) { return x; }
float GetY(void) { return y; }
float GetWidth(void) { return w; }
float GetHeight(void) { return h; }
float GetWidth(void);
float GetHeight(void);
void SetXY(float xArg, float yArg) { x = xArg; y = yArg; }
@ -45,9 +45,10 @@ public:
protected:
virtual void Move(float dt) = 0;
AnimatingSprite* GetAnimation(void);
float _velocity;
Sprite* _actor;
AnimatingSprite* _actorLeft;
AnimatingSprite* _actorRight;
AnimatingSprite* _actorFront;
@ -60,9 +61,8 @@ protected:
float y;
private:
float w;
float h;
SoundEffect* _stepSFX[4];
int _lastStepSFXPlayed;
String _walkAnimationID;
};

View File

@ -1,7 +1,6 @@
#include "NPC.h"
NPC::NPC(void) : Actor() {
LoadSprite("../Data/Img/Player.png");
}
NPC::~NPC(void) {
@ -12,7 +11,7 @@ void NPC::Update(float dt) {
}
void NPC::Render(void) {
Actor::Render(105, 125);
Actor::Render();
}
void NPC::Move(float dt) {

View File

@ -2,10 +2,7 @@
#include "../IO/Input.h"
Player::Player(void) : Actor() {
Actor::_actorFront->LoadAnimatingSprite("Player_F", "../Data/Img/Player/Front/Player_F", "../Data/Img/Player/Front/Player_F", 2, _velocity);
//Actor::_actorFront->LoadAnimatingSprite("Player_b", "../Data/Img/Player/Front/Player_B", "../Data/Img/Player/Front/Player_B", 4, _velocity);
//Actor::_actorFront->LoadAnimatingSprite("Player_L", "../Data/Img/Player/Front/Player_L", "../Data/Img/Player/Front/Player_L", 4, _velocity);
//Actor::_actorFront->LoadAnimatingSprite("Player_R", "../Data/Img/Player/Front/Player_R", "../Data/Img/Player/Front/Player_R", 4, _velocity);
_direction = Actor::RIGHT;
}
Player::~Player(void) {
@ -20,21 +17,21 @@ void Player::Render(void) {
}
void Player::Move(float dt) {
if(KeyStillDown(SDLK_w) || KeyStillDown(SDLK_UP)) {
y -= _velocity * 60 * dt;
_actor->SetY(y);
}
if(KeyStillDown(SDLK_s) || KeyStillDown(SDLK_DOWN)) {
y += _velocity * 60 * dt;
_actor->SetY(y);
}
if(KeyStillDown(SDLK_a) || KeyStillDown(SDLK_LEFT)) {
x -= _velocity * 60 * dt;
_actor->SetX(x);
_direction = Actor::LEFT;
}
if(KeyStillDown(SDLK_d) || KeyStillDown(SDLK_RIGHT)) {
x += _velocity * 60 * dt;
_actor->SetX(x);
_direction = Actor::RIGHT;
}
if(KeyStillDown(SDLK_w) || KeyStillDown(SDLK_UP)) {
y -= _velocity * 60 * dt;
_direction = Actor::BACK;
}
if(KeyStillDown(SDLK_s) || KeyStillDown(SDLK_DOWN)) {
y += _velocity * 60 * dt;
_direction = Actor::FRONT;
}
if(KeyDown(SDLK_LSHIFT)) {

View File

@ -8,6 +8,7 @@
AnimatingSprite::AnimatingSprite(void) {
_spriteCounter = 0;
_timer = 0;
_currentFrame = 1;
}
AnimatingSprite::~AnimatingSprite(void) {
@ -33,32 +34,21 @@ void AnimatingSprite::Update(float dt) {
* the _currentFrame is set to the next valid frame.
*/
_timer += dt;
if(_sequence) {
_timer += dt;
if(_timer > _animationSpeed) {
_timer = 0;
_currentFrame++;
if(_currentFrame > _sequence->GetAnimation(_currentAnimation)->frameEnd) {
if(_sequence->GetAnimation(_currentAnimation)->_loopTo != "") {
SetCurrentAnimation(_sequence->GetAnimation(_currentAnimation)->_loopTo);
} else {
_currentFrame = _sequence->GetAnimation(_currentAnimation)->frameBegin;
}
}
}
} else {
if(_timer > _animationSpeed) {
_timer = 0;
_currentFrame = 0;
if(_currentFrame > _numberOfFrames) {
_currentFrame = 1;
Animation* curAnim = _sequence->GetAnimation(_currentAnimation);
if(_currentFrame > curAnim->frameEnd) {
_currentFrame = curAnim->_loopTo;
}
}
}
}
void AnimatingSprite::LoadAnimatingSprite(const char* id, const char* filename, const char* sequence, int frames, float animationSpeed) {
void AnimatingSprite::LoadAnimatingSprite(const char* filename, const char* sequence, int frames, float animationSpeed) {
for(int i = 0; i < frames; i++) {
String tempFilename;
tempFilename = "";
@ -74,19 +64,16 @@ void AnimatingSprite::LoadAnimatingSprite(const char* id, const char* filename,
_sprites[_spriteCounter]->LoadSprite((const char*)tempFilename);
_spriteCounter++;
}
_id = id;
_numberOfFrames = frames;
_animationSpeed = animationSpeed;
_sequence = new AnimationSequence(sequence);
SetCurrentAnimation(0);
}
void AnimatingSprite::SetCurrentAnimation(const char* animation) {
void AnimatingSprite::SetCurrentAnimation(const String& animation) {
_currentAnimation = _sequence->GetAnimation(animation)->_animationID;
_currentFrame = _sequence->GetAnimation(animation)->frameBegin;
}
void AnimatingSprite::SetCurrentAnimation(int index) {
_currentAnimation = _sequence->GetAnimation(index)->_animationID;
_currentFrame = _sequence->GetAnimation(index)->frameBegin;
}

View File

@ -8,28 +8,26 @@ public:
AnimatingSprite(void);
~AnimatingSprite(void);
void SetCurrentAnimation(const char* filename);
void SetCurrentAnimation(const String& filename);
void SetCurrentAnimation(int index);
const char* GetCurrentAnimation(void);
int GetCurrentFrame(void) { return _currentFrame; }
int GetTotalFrames(void) { return _sequence->GetAnimation(_currentAnimation)->frameEnd; }
Sprite* GetCurrentFrameSprite(void) { return _sprites[_currentFrame - 1]; }
void Update(float dt);
void Render(void);
void Render(float x, float y);
void LoadAnimatingSprite(const char* id, const char* filename, const char* sequence, int frames, float animationSpeed);
const char* GetID(void) { return _id; }
void LoadAnimatingSprite(const char* filename, const char* sequence, int frames, float animationSpeed);
private:
Sprite* _sprites[MAX_ANIM_FRAMES];
int _spriteCounter;
AnimationSequence* _sequence;
const char* _id;
float _animationSpeed;
float _timer;
int _currentFrame;

View File

@ -18,12 +18,13 @@
*/
AnimationSequence::AnimationSequence(void) {
memset(_animations, 0, sizeof(_animations));
}
AnimationSequence::AnimationSequence(const char* filename) {
_numberOfFrames = 0;
_sequenceID = filename;
memset(_animations, 0, sizeof(_animations));
ReadFile();
}
@ -38,28 +39,30 @@ void AnimationSequence::ReadFile(void) {
// animation array.
if(_file.Exists(_sequenceID)) {
String name;
String loop;
char* temp;
_file.OpenFile(_sequenceID, "r");
_file.OpenFile(_sequenceID, "rb");
_file.ReadBuffer(temp);
_file.CloseFile();
int counter = 0;
_numberOfFrames = atoi(Scan(temp, counter));
{
String scanResult = Scan(temp, counter);
_numberOfFrames = atoi(scanResult.GetPointer());
}
for(int index = 0; index < _numberOfFrames; index++) {
name = "";
int startFrame = 0;
int endFrame = 0;
loop = "";
int loop = 1;
name = Scan(temp, counter);
startFrame = atoi(Scan(temp, counter));
endFrame = atoi(Scan(temp, counter));
if(temp[counter - 1] == SPACE) {
loop = Scan(temp, counter);
loop = atoi(Scan(temp, counter));
}
_animations[index] = new Animation();
@ -74,7 +77,7 @@ void AnimationSequence::ReadFile(void) {
}
}
const char* AnimationSequence::Scan(char* source, int &counter) {
String AnimationSequence::Scan(char* source, int &counter) {
String temp;
temp = "";
bool terminate = false;
@ -94,16 +97,16 @@ const char* AnimationSequence::Scan(char* source, int &counter) {
return temp;
}
AnimationSequence::Animation* AnimationSequence::GetAnimation(const char* filename) {
Animation* AnimationSequence::GetAnimation(const String& filename) {
for(int i = 0; i < _numberOfFrames; i++) {
if(strcmp(filename, _animations[i]->_animationID) == 0) {
if(filename == _animations[i]->_animationID) {
return _animations[i];
}
}
return 0;
}
AnimationSequence::Animation* AnimationSequence::GetAnimation(int index) {
Animation* AnimationSequence::GetAnimation(int index) {
if(index < _numberOfFrames) {
return _animations[index];
}

View File

@ -10,14 +10,14 @@
#define ENDOFLINE 59
#define SPACE 32
class AnimationSequence {
struct Animation {
const char* _animationID;
struct Animation {
String _animationID;
int frameBegin;
int frameEnd;
String _loopTo;
};
int _loopTo;
};
class AnimationSequence {
public:
AnimationSequence(void);
AnimationSequence(const char* filename);
@ -25,10 +25,10 @@ public:
void ReadFile(void);
Animation* GetAnimation(int index);
Animation* GetAnimation(const char* filename);
Animation* GetAnimation(const String& filename);
private:
const char* Scan(char* source, int& counter);
String Scan(char* source, int& counter);
const char* _sequenceID;
int _numberOfFrames;

View File

@ -43,6 +43,9 @@ bool Game::Init(void) {
_level->Load("../Data/Map/Ugly.tmx");
_level->PlayBGM();
_player->LoadSprites("Player");
_NPC->LoadSprites("Player");
// Return success.
return true;
}

View File

@ -29,5 +29,5 @@ void SoundEffect::Stop(int channel) {
}
bool SoundEffect::IsPlaying(int channel) {
return Mix_Playing(channel);
return Mix_Playing(channel) == 1;
}

View File

@ -24,8 +24,8 @@ void Sprite::Draw() const {
}
void Sprite::Draw(float x, float y) {
DrawRegion(Rect(0.0f, 0.0f, (float)texture->GetWidth(), (float)texture->GetHeight()));
SetPosition(Vec2(x, y));
DrawRegion(Rect(0.0f, 0.0f, (float)texture->GetWidth(), (float)texture->GetHeight()));
}
void Sprite::DrawRegion(const Rect& src) const {

View File

@ -14,7 +14,7 @@ FileReader::~FileReader(void) {
bool FileReader::Exists(const char* filename) {
// Check to see if _filename is existent in memory,
_file = fopen(filename, "r");
_file = fopen(filename, "rb");
if(_file) {
// Close the file we have.
@ -64,7 +64,7 @@ void FileReader::Write(const int buffer) {
}
void FileReader::Read(const int &value) {
if((_file) && (_accessType == "r")) {
if((_file) && (_accessType == "rb")) {
fscanf(_file, "%i", &value);
} else {
// _filename does not exist or we have the wrong accessType.
@ -85,13 +85,14 @@ void FileReader::WriteBuffer(const char* buffer, int count) {
}
void FileReader::ReadBuffer(char* &buffer) {
if((_file) && (_accessType == "r")) {
if((_file) && (_accessType == "rb")) {
size_t size = 0;
fseek(_file, 0, SEEK_END);
size = ftell(_file);
rewind(_file);
buffer = (char*)malloc(sizeof(char)* size);
buffer = (char*)malloc(sizeof(char)* size + sizeof(char));
buffer[size] = 0;
if(buffer != NULL) {
fread(buffer, 1, size, _file);

View File

@ -1,6 +1,3 @@
#ifdef _WIN32
#define "windows.h"
#endif
#include <stdio.h>
#include <string.h>
#include <assert.h>
@ -9,85 +6,110 @@
#define _CRT_SECURE_NO_WARNINGS
String::String(void) {
_string = new char[1];
_string[0] = 0;
_length = 0;
}
String::~String(void) {
if(_string) {
delete[] _string;
_string = NULL;
_length = 0;
}
}
String::String(char letter) {
// Char to string conversion.
char temp[1];
temp[0] = letter;
strcpy(_string, temp);
_string = new char[2];
_string[0] = letter;
_string[1] = 0;
_length = 1;
}
String::String(char* text) {
// char* or char array.
strcpy(_string, text);
String::String(const char* text) {
_length = strlen(text);
_string = new char[_length + 1];
memcpy(_string, text, _length);
_string[_length] = 0;
}
String::String(String& text) {
// Copy the String.
strcpy(_string, text.GetPointer());
String::String(const String& text) {
_length = text._length;
_string = new char[_length + 1];
memcpy(_string, text._string, _length);
_string[_length] = 0;
}
const char* String::GetPointer(void) {
const char* String::GetPointer(void) const {
// Return a pointer to the memory address of the string.
return _string;
}
int String::Length(void) {
// Return the length of the string.
return strlen(_string);
return _length;
}
void String::Format(const char* format, ...) {
char temp[256];
if(_string) {
delete[] _string;
}
_length = 4095;
_string = new char[_length + 1];
memset(_string, 0, _length + 1);
va_list vlist;
va_start(vlist, format);
#ifdef _WIN32
vsprintf_s(&temp[0], 256, format, vlist);
vsprintf_s(_string, _length, format, vlist);
#else
vsnprintf(&temp[0], 256, format, vlist);
vsnprintf(_string, _length, format, vlist);
#endif
va_end(vlist);
memcpy(_string, temp, strlen(temp)+1);
}
void String::Concatenate(char value) {
// Concatenate a char on the end of a string.
assert(strlen(_string) + 1 < MAX_STRING_LEN);
char temp[1] = "";
temp[0] = value;
strncat(_string, temp, 1);
char* oldString = _string;
int oldLength = _length;
_length = oldLength + 1;
_string = new char[_length + 1];
_string[_length] = 0;
memcpy(_string, oldString, oldLength);
_string[oldLength] = value;
delete[] oldString;
}
void String::Concatenate(const char* value) {
// Concatenate a char* or array to the end of the string.
assert(strlen(_string) + strlen(value) < MAX_STRING_LEN);
strcat(_string, value);
char* oldString = _string;
int oldLength = _length;
int valueLength = strlen(value);
_length = oldLength + valueLength;
_string = new char[_length + 1];
_string[_length] = 0;
memcpy(_string, oldString, oldLength);
memcpy(_string + oldLength, value, valueLength);
delete[] oldString;
}
void String::Concatenate(String& value) {
assert(strlen(_string) + strlen(value) < MAX_STRING_LEN);
strcat(_string, value.GetPointer());
void String::Concatenate(const String& value) {
Concatenate(value.GetPointer());
}
// Operator overloads, can't be bothered to comment
// them, use your brain. :)
String& String::operator=(const char* value) {
assert(strlen(value) < MAX_STRING_LEN);
strcpy(_string, value);
_length = strlen(value);
_string = new char[_length + 1];
_string[_length] = 0;
memcpy(_string, value, _length);
return *this;
}
String& String::operator=(String& value) {
assert(strlen(value) < MAX_STRING_LEN);
strcpy(_string, value.GetPointer());
String& String::operator=(const String& value) {
*this = value.GetPointer();
return *this;
}
@ -98,7 +120,7 @@ bool String::operator==(const char* value) const {
return false;
}
bool String::operator==(String& value) const {
bool String::operator==(const String& value) const {
if(strcmp(_string, value.GetPointer()) == 0) {
return true;
}
@ -119,6 +141,12 @@ bool String::operator!=(const char* value) const {
return false;
}
String String::operator+(const String& value) const {
String copy(*this);
copy.Concatenate(value);
return copy;
}
String::operator const char*() const {
return _string;
}

View File

@ -1,18 +1,17 @@
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#define MAX_STRING_LEN 255
class String {
public:
String(void);
String(char letter);
String(char text[]);
String(String& text);
String(const char* text);
String(const String& text);
~String(void);
const char* GetPointer(void);
const char* GetPointer(void) const;
void Concatenate(const char* value);
void Concatenate(String& value);
void Concatenate(const String& value);
void Concatenate(char value);
int Length(void);
@ -20,15 +19,18 @@ public:
// Operator overloads.
String& operator=(const char* value);
String& operator=(String& value);
String& operator=(const String& value);
bool operator==(const char* value) const;
bool operator==(String& value) const;
bool operator==(const String& value) const;
bool operator!=(String& value) const;
bool operator!=(const char* value) const;
String operator+(const String& value) const;
operator const char*() const;
private:
char _string[MAX_STRING_LEN];
char* _string;
int _length;
};