Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F126321
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/TextEntity.cpp b/src/TextEntity.cpp
index fa42cfd..b44de1f 100644
--- a/src/TextEntity.cpp
+++ b/src/TextEntity.cpp
@@ -1,69 +1,71 @@
/** This file is part of Witch Blast.
*
* FreeTumble is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FreeTumble 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FreeTumble. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sstream>
#include <iostream>
#include "TextEntity.h"
#include "WitchBlastGame.h"
TextEntity::TextEntity(std::string text, int size, float x, float y) : GameEntity(x, y)
{
this->text = text;
this->size = size;
alignment = ALIGN_LEFT;
colorType = COLOR_WHITE;
color = sf::Color(255, 255, 255);
}
void TextEntity::render(sf::RenderWindow* app)
{
game().Write(text, size, x, y, alignment, color);
}
void TextEntity::animate(float delay)
{
GameEntity::animate(delay);
// TODO : other colorType
if (colorType == COLOR_FADING_WHITE)
{
int alpha = 255 * (lifetime - age) / lifetime;
if (alpha > 255) alpha = 255;
else if (alpha < 0) alpha = 0;
color = sf::Color(255, 255, 255, alpha );
}
}
void TextEntity::setText(std::string text)
{
this->text = text;
}
void TextEntity::setColor(int colorType)
{
// TODO : other colorType
this->colorType = colorType;
if (colorType == COLOR_WHITE || colorType == COLOR_FADING_WHITE)
color = sf::Color(255, 255, 255);
+ else if (colorType == COLOR_GREEN)
+ color = sf::Color(0, 255, 0);
}
void TextEntity::setAlignment(int alignment)
{
this->alignment = alignment;
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Jun 11, 11:16 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
68691
Default Alt Text
(2 KB)
Attached To
Mode
R78 witchblast
Attached
Detach File
Event Timeline