forked from jaildesigner-jailgames/jaildoctors_dilemma
Transició a surface acabada. Ja compila
This commit is contained in:
@@ -144,29 +144,25 @@ void Text::write(int x, int y, const std::string &text, int kerning, int lenght)
|
||||
// Escribe el texto en una surface
|
||||
std::shared_ptr<Surface> Text::writeToSurface(const std::string &text, int zoom, int kerning)
|
||||
{
|
||||
auto renderer = Screen::get()->getRenderer();
|
||||
auto width = lenght(text, kerning) * zoom;
|
||||
auto height = box_height_ * zoom;
|
||||
auto temp = SDL_GetRenderTarget(renderer);
|
||||
auto surface = std::make_shared<Surface>(Screen::get()->getRenderSurfaceData(), width, height);
|
||||
Screen::get()->setRenderSurfaceData(surface);
|
||||
Screen::get()->clean(stringToColor("transparent"));
|
||||
Screen::get()->clear(stringToColor("transparent"));
|
||||
write(0, 0, text, kerning);
|
||||
Screen::get()->setRenderSurfaceData(nullptr);
|
||||
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
// Escribe el texto con extras en una surface
|
||||
std::shared_ptr<Surface> Text::writeDXToSurface(Uint8 flags, const std::string &text, int kerning, Uint8 textColor, Uint8 shadow_distance, Uint8 shadow_color, int lenght)
|
||||
{
|
||||
auto renderer = Screen::get()->getRenderer();
|
||||
auto width = Text::lenght(text, kerning) + shadow_distance;
|
||||
auto height = box_height_ + shadow_distance;
|
||||
auto temp = SDL_GetRenderTarget(renderer);
|
||||
auto surface = std::make_shared<Surface>(Screen::get()->getRenderSurfaceData(), width, height);
|
||||
Screen::get()->setRenderSurfaceData(surface);
|
||||
Screen::get()->clean(stringToColor("transparent"));
|
||||
Screen::get()->clear(stringToColor("transparent"));
|
||||
writeDX(flags, 0, 0, text, kerning, textColor, shadow_distance, shadow_color, lenght);
|
||||
Screen::get()->setRenderSurfaceData(nullptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user