00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "pent_include.h"
00020
00021 #include "TTFRenderedText.h"
00022 #include "TTFont.h"
00023 #include "RenderSurface.h"
00024 #include "Texture.h"
00025
00026 DEFINE_RUNTIME_CLASSTYPE_CODE(TTFRenderedText,RenderedText);
00027
00028
00029 TTFRenderedText::TTFRenderedText(Texture* texture_, int width_, int height_,
00030 int vlead_, TTFont* font_)
00031 : texture(texture_), font(font_)
00032 {
00033 width = width_;
00034 height = height_;
00035 vlead = vlead_;
00036 }
00037
00038 TTFRenderedText::~TTFRenderedText()
00039 {
00040 delete texture;
00041 }
00042
00043 void TTFRenderedText::draw(RenderSurface* surface, int x, int y,
00044 bool destmasked)
00045 {
00046 if (!destmasked)
00047 surface->Blit(texture, 0, 0, width, height, x, y-font->getBaseline(),
00048 font->isAntialiased());
00049 else
00050 surface->MaskedBlit(texture, 0, 0, width, height,
00051 x, y-font->getBaseline(),
00052 0, font->isAntialiased());
00053 }
00054
00055 void TTFRenderedText::drawBlended(RenderSurface* surface, int x, int y,
00056 uint32 col, bool destmasked)
00057 {
00058 if (!destmasked)
00059 surface->FadedBlit(texture, 0, 0, width, height,
00060 x, y-font->getBaseline(), col,
00061 font->isAntialiased());
00062 else
00063 surface->MaskedBlit(texture, 0, 0, width, height,
00064 x, y-font->getBaseline(), col,
00065 font->isAntialiased());
00066 }
00067