Also fixed the project includes so that we don't need to always use the indirect include path, ie: #include "../include/foo.h" -> #include "foo.h" I'm don't know much about make files - if I busted the linux build, mea culpa, but I think we're okay on that front too. For future reference, here's the most straightforward link on the topic of adding pch support to make files: http://www.mercs-eng.com/~hulud/index.php?2008/06/13/6-writing-a-good-makefile-for-a-c-project
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#include "PrecompiledHeader.h"
|
|
|
|
#include "PlayGuiObject.h"
|
|
|
|
using namespace std;
|
|
|
|
PlayGuiObject::PlayGuiObject(float desiredHeight, float x, float y, bool hasFocus) : JGuiObject(0), Pos(x, y, 1.0, 0.0, 255) {
|
|
defaultHeight = desiredHeight;
|
|
mHeight = desiredHeight;
|
|
mHasFocus = hasFocus;
|
|
type = 0;
|
|
wave = 0;
|
|
}
|
|
PlayGuiObject::PlayGuiObject(float desiredHeight, const Pos& ref, bool hasFocus) : JGuiObject(0), Pos(ref) {
|
|
defaultHeight = desiredHeight;
|
|
mHeight = desiredHeight;
|
|
mHasFocus = hasFocus;
|
|
type = 0;
|
|
wave = 0;
|
|
}
|
|
|
|
|
|
void PlayGuiObject::Update(float dt){
|
|
if (mHasFocus && mHeight < defaultHeight * 1.2)
|
|
{
|
|
mHeight += defaultHeight*0.8f*dt;
|
|
// fprintf(stderr, "increasing size to %f - %d", mHeight, GetId() );
|
|
|
|
if (mHeight > defaultHeight * 1.2)
|
|
mHeight = defaultHeight * 1.2;
|
|
}
|
|
else if (!mHasFocus && mHeight > defaultHeight)
|
|
{
|
|
mHeight -= defaultHeight*0.8f*dt;
|
|
if (mHeight < defaultHeight)
|
|
mHeight = defaultHeight;
|
|
}
|
|
wave = (wave +2 * (int) (100 * dt) ) % 255;
|
|
for (vector<Effect*>::iterator it = effects.begin(); it != effects.end(); ++it)
|
|
(*it)->Update(dt);
|
|
Pos::Update(dt);
|
|
}
|
|
|
|
void PlayGuiObject::Render()
|
|
{
|
|
for (vector<Effect*>::iterator it = effects.begin(); it != effects.end(); ++it)
|
|
(*it)->Render();
|
|
}
|