graphics/gldrawmethods: Fix compilation

Was probably broken by ff27d69424

Signed-off-by: Nick Renieris <velocityra@gmail.com>
This commit is contained in:
Nick Renieris
2019-09-02 18:29:19 +03:00
committed by jacob1
parent 3db7feaeff
commit c08b333909

View File

@@ -1,5 +1,6 @@
#include "../data/font.h" #include "../data/font.h"
#include <cmath> #include <cmath>
#include <cstring>
int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, String s, int r, int g, int b, int a) int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, String s, int r, int g, int b, int a)
{ {
@@ -15,15 +16,15 @@ int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, String s, int r, int g, i
int PIXELMETHODS_CLASS::drawtext(int x, int y, String str, int r, int g, int b, int a) int PIXELMETHODS_CLASS::drawtext(int x, int y, String str, int r, int g, int b, int a)
{ {
bool invert = false; bool invert = false;
if(!strlen(s)) if(str.size() == 0)
return 0; return 0;
int oR = r, oG = g, oB = b; int oR = r, oG = g, oB = b;
int width, height; int width, height;
Graphics::textsize(s, width, height); Graphics::textsize(str, width, height);
VideoBuffer texture(width, height); VideoBuffer texture(width, height);
int characterX = 0, characterY = 0; int characterX = 0, characterY = 0;
int startX = characterX; int startX = characterX;
String::value_type *s = str.c_str(); const String::value_type *s = str.c_str();
for (; *s; s++) for (; *s; s++)
{ {
if (*s == '\n') if (*s == '\n')
@@ -131,7 +132,7 @@ int PIXELMETHODS_CLASS::drawtext(int x, int y, String str, int r, int g, int b,
int PIXELMETHODS_CLASS::drawchar(int x, int y, String::value_type c, int r, int g, int b, int a) int PIXELMETHODS_CLASS::drawchar(int x, int y, String::value_type c, int r, int g, int b, int a)
{ {
unsigned char *rp = font_data + font_ptrs[c]; const unsigned char *rp = font_data + font_ptrs[c];
int w = *(rp++); int w = *(rp++);
VideoBuffer texture(w, FONT_H); VideoBuffer texture(w, FONT_H);
texture.SetCharacter(0, 0, c, r, g, b, a); texture.SetCharacter(0, 0, c, r, g, b, a);
@@ -160,7 +161,7 @@ int PIXELMETHODS_CLASS::drawchar(int x, int y, String::value_type c, int r, int
int PIXELMETHODS_CLASS::addchar(int x, int y, String::value_type c, int r, int g, int b, int a) int PIXELMETHODS_CLASS::addchar(int x, int y, String::value_type c, int r, int g, int b, int a)
{ {
unsigned char *rp = font_data + font_ptrs[c]; const unsigned char *rp = font_data + font_ptrs[c];
int w = *(rp++); int w = *(rp++);
VideoBuffer texture(w, FONT_H); VideoBuffer texture(w, FONT_H);
texture.AddCharacter(0, 0, c, r, g, b, a); texture.AddCharacter(0, 0, c, r, g, b, a);