summaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-05-05 03:03:59 (GMT)
committer jacob1 <jfu614@gmail.com>2013-05-05 03:03:59 (GMT)
commit07486c9885fdfde734c5f052a8c31e1af26acfeb (patch)
treec279fef5027933db0c83aa38bfcc10727236e169 /src/graphics
parent2d0ce60afe568fb129872abf674aec12cb520907 (diff)
downloadpowder-07486c9885fdfde734c5f052a8c31e1af26acfeb.zip
powder-07486c9885fdfde734c5f052a8c31e1af26acfeb.tar.gz
drawtext_outline to fix unreadable infotips, tooltips fade in and out (more like old tpt)
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/Graphics.h1
-rw-r--r--src/graphics/OpenGLDrawMethods.inl12
-rw-r--r--src/graphics/RasterDrawMethods.inl11
-rw-r--r--src/graphics/Renderer.h1
4 files changed, 25 insertions, 0 deletions
diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h
index e2ed119..3a87bb6 100644
--- a/src/graphics/Graphics.h
+++ b/src/graphics/Graphics.h
@@ -225,6 +225,7 @@ public:
void Clear();
void Finalise();
//
+ int drawtext_outline(int x, int y, const char *s, int r, int g, int b, int a);
int drawtext(int x, int y, const char *s, int r, int g, int b, int a);
int drawtext(int x, int y, std::string s, int r, int g, int b, int a);
int drawchar(int x, int y, int c, int r, int g, int b, int a);
diff --git a/src/graphics/OpenGLDrawMethods.inl b/src/graphics/OpenGLDrawMethods.inl
index 1ecd6b1..bfc338a 100644
--- a/src/graphics/OpenGLDrawMethods.inl
+++ b/src/graphics/OpenGLDrawMethods.inl
@@ -1,4 +1,16 @@
#include "../data/font.h"
+
+int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, const char *s, int r, int g, int b, int a)
+{
+ drawtext(x-1, y-1, s, 0, 0, 0, 120);
+ drawtext(x+1, y+1, s, 0, 0, 0, 120);
+
+ drawtext(x-1, y+1, s, 0, 0, 0, 120);
+ drawtext(x+1, y-1, s, 0, 0, 0, 120);
+
+ return drawtext(x, y, s, r, g, b, a);
+}
+
int PIXELMETHODS_CLASS::drawtext(int x, int y, const char *s, int r, int g, int b, int a)
{
bool invert = false;
diff --git a/src/graphics/RasterDrawMethods.inl b/src/graphics/RasterDrawMethods.inl
index 527d249..b4de875 100644
--- a/src/graphics/RasterDrawMethods.inl
+++ b/src/graphics/RasterDrawMethods.inl
@@ -1,5 +1,16 @@
#include "font.h"
+int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, const char *s, int r, int g, int b, int a)
+{
+ drawtext(x-1, y-1, s, 0, 0, 0, 120);
+ drawtext(x+1, y+1, s, 0, 0, 0, 120);
+
+ drawtext(x-1, y+1, s, 0, 0, 0, 120);
+ drawtext(x+1, y-1, s, 0, 0, 0, 120);
+
+ return drawtext(x, y, s, r, g, b, a);
+}
+
int PIXELMETHODS_CLASS::drawtext(int x, int y, const char *s, int r, int g, int b, int a)
{
if(!strlen(s))
diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h
index 6328c19..9251006 100644
--- a/src/graphics/Renderer.h
+++ b/src/graphics/Renderer.h
@@ -112,6 +112,7 @@ public:
void draw_icon(int x, int y, Icon icon);
+ int drawtext_outline(int x, int y, const char *s, int r, int g, int b, int a);
int drawtext(int x, int y, const char *s, int r, int g, int b, int a);
int drawtext(int x, int y, std::string s, int r, int g, int b, int a);
int drawchar(int x, int y, int c, int r, int g, int b, int a);