00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <sprites/TextActionRenderer.h>
00022 #include <GLW/GLWFont.h>
00023 #include <GLEXT/GLCameraFrustum.h>
00024 #include <GLEXT/GLState.h>
00025
00026 TextActionRenderer::TextActionRenderer(
00027 Vector &position,
00028 Vector &color,
00029 const std::string &text) :
00030 position_(position),
00031 color_(color),
00032 text_(text),
00033 frameTime_(0.0f)
00034 {
00035 }
00036
00037 TextActionRenderer::~TextActionRenderer()
00038 {
00039 }
00040
00041 void TextActionRenderer::simulate(Action *action, float timepassed, bool &remove)
00042 {
00043 position_[2] += timepassed;
00044 frameTime_ += timepassed;
00045 remove = (frameTime_ > 6.0f);
00046 }
00047
00048 void TextActionRenderer::draw(Action *action)
00049 {
00050 if (!GLCameraFrustum::instance()->sphereInFrustum(position_))
00051 {
00052 return;
00053 }
00054
00055 GLState currentState(GLState::DEPTH_ON | GLState::TEXTURE_ON);
00056 glDepthMask(GL_FALSE);
00057 GLWFont::instance()->getGameFont()->drawBilboard(color_, 1.0f - (frameTime_ / 6.0f), 1.0f,
00058 position_[0], position_[1], position_[2],
00059 text_.c_str());
00060
00061 glDepthMask(GL_TRUE);
00062 }