start 380 project5
changes to 380 project 4 changes to 350 project 2 Signed-off-by: Amrit Panesar <apanesar@4195tech.com>
This commit is contained in:
1 parent
40ac78074b
commit
39ee821f54
174 files changed
+13356
-80
No files matched your search
+65
@@ -0,0 +1,65 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// GambleKit Copyright (C) 2014 Ivan Donev
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// contact: gamblekit@gmail.com
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "GkGameAnimationsSoundBinding.h"
|
||||
|
||||
|
||||
GkGameAnimationsSoundBinding::GkGameAnimationsSoundBinding(GkSoundSource *soundSource, GkSoundDevice *soundDevice, bool looping, int numAnimations, ...)
|
||||
: GkGameEntity()
|
||||
{
|
||||
this->soundSource = soundSource;
|
||||
this->soundDevice = soundDevice;
|
||||
this->looping = looping;
|
||||
|
||||
this->numAnimations = numAnimations;
|
||||
GkGameAnimation **parameters = (GkGameAnimation **)((int)&numAnimations + 4);
|
||||
this->animations = new GkGameAnimationsSoundBindingAnimation[numAnimations];
|
||||
for (int i = 0; i < numAnimations; i++)
|
||||
{
|
||||
this->animations[i].animation = parameters[i];
|
||||
this->animations[i].played = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GkGameAnimationsSoundBinding::~GkGameAnimationsSoundBinding(void)
|
||||
{
|
||||
delete[] this->animations;
|
||||
}
|
||||
|
||||
void GkGameAnimationsSoundBinding::Process(GkGame *game)
|
||||
{
|
||||
for (int i = 0; i < this->numAnimations; i++)
|
||||
{
|
||||
if (this->animations[i].animation->visible && this->animations[i].animation->active)
|
||||
{
|
||||
if (!this->animations[i].played)
|
||||
{
|
||||
if (this->looping)
|
||||
this->soundDevice->PlaySourceLooping(this->soundSource);
|
||||
else
|
||||
this->soundDevice->PlaySource(this->soundSource);
|
||||
|
||||
this->animations[i].played = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->looping)
|
||||
{
|
||||
this->soundDevice->PauseSource(this->soundSource);
|
||||
}
|
||||
|
||||
this->animations[i].played = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\..\..\GkDefinitions.h"
|
||||
|
||||
#include "..\GkGameAnimation.h"
|
||||
#include "..\..\..\Sound\GkSoundDevice.h"
|
||||
|
||||
struct GkGameAnimationsSoundBindingAnimation
|
||||
{
|
||||
GkGameAnimation *animation;
|
||||
bool played;
|
||||
};
|
||||
|
||||
class GKDLLCLASS GkGameAnimationsSoundBinding :
|
||||
public GkGameEntity
|
||||
{
|
||||
public:
|
||||
GkSoundDevice *soundDevice;
|
||||
GkSoundSource *soundSource;
|
||||
|
||||
int numAnimations;
|
||||
GkGameAnimationsSoundBindingAnimation *animations;
|
||||
|
||||
bool looping;
|
||||
|
||||
GkGameAnimationsSoundBinding(GkSoundSource *soundSource, GkSoundDevice *soundDevice, bool looping, int numAnimations, ...);
|
||||
~GkGameAnimationsSoundBinding(void);
|
||||
|
||||
void Process(GkGame *game);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// GambleKit Copyright (C) 2014 Ivan Donev
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// contact: gamblekit@gmail.com
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "GkGameButtonsBinding.h"
|
||||
|
||||
|
||||
GkGameButtonsBinding::GkGameButtonsBinding(int numGameButtons, ...)
|
||||
{
|
||||
GkGameButton **parameters = (GkGameButton **)((int)&numGameButtons + 4);
|
||||
this->numGameButtons = numGameButtons;
|
||||
this->gameButtons = new GkGameButton*[numGameButtons];
|
||||
for (int i = 0; i < numGameButtons; i++)
|
||||
this->gameButtons[i] = parameters[i];
|
||||
|
||||
this->enabled = true;
|
||||
|
||||
this->pushedValue = false;
|
||||
this->clickedValue = false;
|
||||
}
|
||||
|
||||
|
||||
GkGameButtonsBinding::~GkGameButtonsBinding(void)
|
||||
{
|
||||
delete this->gameButtons;
|
||||
}
|
||||
|
||||
void GkGameButtonsBinding::SyncPush(int syncButtonIndex)
|
||||
{
|
||||
GkGameButton *syncButton = this->gameButtons[syncButtonIndex];
|
||||
|
||||
for (int buttonIndex = 0; buttonIndex < this->numGameButtons; buttonIndex++)
|
||||
{
|
||||
if (buttonIndex != syncButtonIndex)
|
||||
{
|
||||
GkGameButton *button = this->gameButtons[buttonIndex];
|
||||
|
||||
if (button->IsActive())
|
||||
{
|
||||
if (button->pushed != syncButton->pushed)
|
||||
{
|
||||
if (syncButton->pushed)
|
||||
button->Down();
|
||||
else
|
||||
button->Up(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->pushedValue = syncButton->pushed;
|
||||
}
|
||||
|
||||
void GkGameButtonsBinding::SyncClick(int syncButtonIndex)
|
||||
{
|
||||
GkGameButton *syncButton = this->gameButtons[syncButtonIndex];
|
||||
|
||||
for (int buttonIndex = 0; buttonIndex < this->numGameButtons; buttonIndex++)
|
||||
{
|
||||
if (buttonIndex != syncButtonIndex)
|
||||
{
|
||||
GkGameButton *button = this->gameButtons[buttonIndex];
|
||||
|
||||
if (button->IsActive())
|
||||
{
|
||||
button->clicked = syncButton->clicked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->clickedValue = syncButton->clicked;
|
||||
}
|
||||
|
||||
void GkGameButtonsBinding::Process(GkGame *game)
|
||||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
|
||||
for (int buttonIndex = 0; buttonIndex < this->numGameButtons; buttonIndex++)
|
||||
{
|
||||
GkGameButton *button = this->gameButtons[buttonIndex];
|
||||
if (button->IsActive())
|
||||
{
|
||||
if (button->pushed != this->pushedValue)
|
||||
{
|
||||
this->SyncPush(buttonIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int buttonIndex = 0; buttonIndex < this->numGameButtons; buttonIndex++)
|
||||
{
|
||||
GkGameButton *button = this->gameButtons[buttonIndex];
|
||||
if (button->IsActive())
|
||||
{
|
||||
if (button->clicked != this->clickedValue)
|
||||
{
|
||||
// SyncClick is required beside SyncPush, because mouse events execute separately from the Process sequence and MouseUp usually sets a button pushed to false, which actually prevents SyncPush to execute mouse up (for it checks if the button is pushed)
|
||||
this->SyncClick(buttonIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\..\..\GkDefinitions.h"
|
||||
|
||||
#include "..\..\GkGameEntity.h"
|
||||
#include "..\..\Entities\GkGameButton.h"
|
||||
|
||||
class GKDLLCLASS GkGameButtonsBinding :
|
||||
public GkGameEntity
|
||||
{
|
||||
public:
|
||||
int numGameButtons;
|
||||
GkGameButton **gameButtons;
|
||||
|
||||
bool enabled;
|
||||
|
||||
bool pushedValue, clickedValue;
|
||||
|
||||
GkGameButtonsBinding(int numGameButtons, ...);
|
||||
~GkGameButtonsBinding(void);
|
||||
|
||||
void SyncPush(int syncButtonIndex);
|
||||
void SyncClick(int syncButtonIndex);
|
||||
|
||||
void Process(GkGame *game);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// GambleKit Copyright (C) 2014 Ivan Donev
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// contact: gamblekit@gmail.com
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "GkGameButtonsSoundBinding.h"
|
||||
|
||||
|
||||
GkGameButtonsSoundBinding::GkGameButtonsSoundBinding(GkSoundSource *soundSource, GkSoundDevice *soundDevice, int numButtons, ...)
|
||||
: GkGameEntity()
|
||||
{
|
||||
this->soundSource = soundSource;
|
||||
this->soundDevice = soundDevice;
|
||||
|
||||
this->numButtons = numButtons;
|
||||
GkGameButton **parameters = (GkGameButton **)((int)&numButtons + 4);
|
||||
this->buttons = new GameButtonsSoundBindingButton[numButtons];
|
||||
for (int i = 0; i < numButtons; i++)
|
||||
{
|
||||
this->buttons[i].button = parameters[i];
|
||||
this->buttons[i].played = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GkGameButtonsSoundBinding::~GkGameButtonsSoundBinding(void)
|
||||
{
|
||||
delete[] this->buttons;
|
||||
}
|
||||
|
||||
void GkGameButtonsSoundBinding::Process(GkGame *game)
|
||||
{
|
||||
for (int i = 0; i < this->numButtons; i++)
|
||||
{
|
||||
if (this->buttons[i].button->pushed)
|
||||
{
|
||||
if (!this->buttons[i].played)
|
||||
{
|
||||
this->soundDevice->PlaySource(this->soundSource);
|
||||
|
||||
this->buttons[i].played = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->buttons[i].played = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\..\..\GkDefinitions.h"
|
||||
|
||||
#include "..\GkGameButton.h"
|
||||
#include "..\..\..\Sound\GkSoundDevice.h"
|
||||
|
||||
struct GameButtonsSoundBindingButton
|
||||
{
|
||||
GkGameButton *button;
|
||||
bool played;
|
||||
};
|
||||
|
||||
class GKDLLCLASS GkGameButtonsSoundBinding :
|
||||
public GkGameEntity
|
||||
{
|
||||
public:
|
||||
GkSoundDevice *soundDevice;
|
||||
GkSoundSource *soundSource;
|
||||
|
||||
int numButtons;
|
||||
GameButtonsSoundBindingButton *buttons;
|
||||
|
||||
GkGameButtonsSoundBinding(GkSoundSource *soundSource, GkSoundDevice *soundDevice, int numButtons, ...);
|
||||
~GkGameButtonsSoundBinding(void);
|
||||
|
||||
void Process(GkGame *game);
|
||||
};
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// GambleKit Copyright (C) 2014 Ivan Donev
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// contact: gamblekit@gmail.com
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "GkGameTextsDateTimeBinding.h"
|
||||
|
||||
#include "..\..\..\Utils\GkStrings.h"
|
||||
|
||||
GkGameTextsDateTimeBinding::GkGameTextsDateTimeBinding(DateTime* valueAddress, const wchar_t *formatString, int numGameTexts, ...)
|
||||
: GkGameEntity()
|
||||
{
|
||||
this->valueAddress = valueAddress;
|
||||
this->formatString = GkStrings::Copy(formatString);
|
||||
|
||||
this->numGameTexts = numGameTexts;
|
||||
|
||||
GkGameText **parameters = (GkGameText **)((int)&numGameTexts + 4);
|
||||
this->gameTexts = new GkGameText*[this->numGameTexts];
|
||||
for (int i = 0; i < this->numGameTexts; i++)
|
||||
this->gameTexts[i] = parameters[i];
|
||||
}
|
||||
|
||||
|
||||
GkGameTextsDateTimeBinding::~GkGameTextsDateTimeBinding(void)
|
||||
{
|
||||
delete[] this->formatString;
|
||||
delete[] this->gameTexts;
|
||||
}
|
||||
|
||||
void GkGameTextsDateTimeBinding::Process(GkGame *game)
|
||||
{
|
||||
for (int i = 0; i < this->numGameTexts; i++)
|
||||
this->gameTexts[i]->SetText(GkStrings::Format(this->formatString, GkStrings::IntToString(this->valueAddress->day, 10, 2).c_str(), GkStrings::IntToString(this->valueAddress->month, 10, 2).c_str(), GkStrings::IntToString(this->valueAddress->year, 10, 4).c_str(), GkStrings::IntToString(this->valueAddress->hour, 10, 2).c_str(), GkStrings::IntToString(this->valueAddress->minute, 10, 2).c_str(), GkStrings::IntToString(this->valueAddress->second, 10, 2).c_str()).c_str());
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\..\..\GkDefinitions.h"
|
||||
|
||||
#include "..\..\GkGameEntity.h"
|
||||
|
||||
#include "..\GkGameText.h"
|
||||
|
||||
#include "..\..\..\OSSpecific\GkOSUtils.h"
|
||||
|
||||
class GKDLLCLASS GkGameTextsDateTimeBinding :
|
||||
public GkGameEntity
|
||||
{
|
||||
public:
|
||||
DateTime * valueAddress;
|
||||
|
||||
int numGameTexts;
|
||||
GkGameText **gameTexts;
|
||||
|
||||
wchar_t *formatString;
|
||||
|
||||
GkGameTextsDateTimeBinding(DateTime* valueAddress, const wchar_t *formatString, int numGameTexts, ...);
|
||||
~GkGameTextsDateTimeBinding(void);
|
||||
|
||||
void Process(GkGame *game);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// GambleKit Copyright (C) 2014 Ivan Donev
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// contact: gamblekit@gmail.com
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "GkGameTextsFormatBinding.h"
|
||||
|
||||
|
||||
GkGameTextsFormatBinding::GkGameTextsFormatBinding(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GkGameTextsFormatBinding::~GkGameTextsFormatBinding(void)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\..\..\GkDefinitions.h"
|
||||
|
||||
#include "..\..\GkGameEntity.h"
|
||||
|
||||
class GKDLLCLASS GkGameTextsFormatBinding :
|
||||
public GkGameEntity
|
||||
{
|
||||
public:
|
||||
GkGameTextsFormatBinding(void);
|
||||
~GkGameTextsFormatBinding(void);
|
||||
};
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// GambleKit Copyright (C) 2014 Ivan Donev
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// contact: gamblekit@gmail.com
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "GkGameTextsFormatIntBinding.h"
|
||||
|
||||
#include "..\..\..\Utils\GkStrings.h"
|
||||
|
||||
|
||||
GkGameTextsFormatIntBinding::GkGameTextsFormatIntBinding(const wchar_t *format, int numValues, int numGameTexts, ...)
|
||||
{
|
||||
this->numValues = numValues;
|
||||
this->numGameTexts = numGameTexts;
|
||||
this->format = GkStrings::Copy(format);
|
||||
|
||||
int **valueAddressParams = (int**)((int)&numGameTexts + 4);
|
||||
this->valueAddresses = new int*[this->numValues];
|
||||
this->values = new wchar_t*[this->numValues];
|
||||
for (int i = 0; i < this->numValues; i++)
|
||||
this->valueAddresses[i] = valueAddressParams[i];
|
||||
|
||||
GkGameText **gameTextParams = (GkGameText **)((int)&valueAddressParams[this->numValues - 1] + 4);
|
||||
this->gameTexts = new GkGameText*[this->numGameTexts];
|
||||
for (int i = 0; i < this->numGameTexts; i++)
|
||||
this->gameTexts[i] = gameTextParams[i];
|
||||
}
|
||||
|
||||
|
||||
GkGameTextsFormatIntBinding::~GkGameTextsFormatIntBinding(void)
|
||||
{
|
||||
delete[] this->valueAddresses;
|
||||
delete[] this->values;
|
||||
|
||||
delete[] this->gameTexts;
|
||||
|
||||
delete[] this->format;
|
||||
}
|
||||
|
||||
void GkGameTextsFormatIntBinding::Process(GkGame *game)
|
||||
{
|
||||
for (int i = 0; i < this->numValues; i++)
|
||||
this->values[i] = GkStrings::Copy(GkStrings::IntToString(*this->valueAddresses[i]).c_str());
|
||||
|
||||
for (int gameTextIndex = 0; gameTextIndex < this->numGameTexts; gameTextIndex++)
|
||||
{
|
||||
this->gameTexts[gameTextIndex]->SetText(GkStrings::FormatArray(this->format, this->values).c_str());
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->numValues; i++)
|
||||
delete[] this->values[i];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\..\..\GkDefinitions.h"
|
||||
|
||||
#include "..\..\GkGameEntity.h"
|
||||
|
||||
#include "..\GkGameText.h"
|
||||
|
||||
|
||||
class GKDLLCLASS GkGameTextsFormatIntBinding :
|
||||
public GkGameEntity
|
||||
{
|
||||
public:
|
||||
int numValues;
|
||||
int **valueAddresses;
|
||||
wchar_t **values;
|
||||
|
||||
int numGameTexts;
|
||||
GkGameText **gameTexts;
|
||||
|
||||
wchar_t *format;
|
||||
|
||||
GkGameTextsFormatIntBinding(const wchar_t *format, int numValues, int numGameTexts, ...);
|
||||
~GkGameTextsFormatIntBinding(void);
|
||||
|
||||
void Process(GkGame *game);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// GambleKit Copyright (C) 2014 Ivan Donev
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// contact: gamblekit@gmail.com
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "GkGameTextsIntBinding.h"
|
||||
|
||||
#include "..\..\..\Utils\GkStrings.h"
|
||||
|
||||
GkGameTextsIntBinding::GkGameTextsIntBinding(int* valueAddress, int numGameTexts, ...)
|
||||
: GkGameEntity()
|
||||
{
|
||||
this->valueAddress = valueAddress;
|
||||
|
||||
this->numGameTexts = numGameTexts;
|
||||
|
||||
GkGameText **parameters = (GkGameText **)((int)&numGameTexts + 4);
|
||||
this->gameTexts = new GkGameText*[this->numGameTexts];
|
||||
for (int i = 0; i < this->numGameTexts; i++)
|
||||
this->gameTexts[i] = parameters[i];
|
||||
}
|
||||
|
||||
|
||||
GkGameTextsIntBinding::~GkGameTextsIntBinding(void)
|
||||
{
|
||||
delete[] this->gameTexts;
|
||||
}
|
||||
|
||||
void GkGameTextsIntBinding::Process(GkGame *game)
|
||||
{
|
||||
for (int i = 0; i < this->numGameTexts; i++)
|
||||
this->gameTexts[i]->SetText(GkStrings::IntToString(*this->valueAddress).c_str());
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\..\..\GkDefinitions.h"
|
||||
|
||||
#include "..\..\GkGameEntity.h"
|
||||
|
||||
#include "..\GkGameText.h"
|
||||
|
||||
class GKDLLCLASS GkGameTextsIntBinding :
|
||||
public GkGameEntity
|
||||
{
|
||||
public:
|
||||
int * valueAddress;
|
||||
|
||||
int numGameTexts;
|
||||
GkGameText **gameTexts;
|
||||
|
||||
GkGameTextsIntBinding(int* valueAddress, int numGameTexts, ...);
|
||||
~GkGameTextsIntBinding(void);
|
||||
|
||||
void Process(GkGame *game);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user