summaryrefslogtreecommitdiff
path: root/src/client/font.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-06 19:36:04 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-06 19:36:04 +0000
commitca019ecd6715557a572ac9a56de556434f9b31aa (patch)
tree5e39db57af3433dd7b44162cdf5f388111e091fb /src/client/font.c
parent05f2c8aacf46e643b2bd916b7c8139e8a259122a (diff)
- podpora chatu :)
git-svn-id: http://opensvn.csie.org/tuxanci_ng@109 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/client/font.c')
-rwxr-xr-xsrc/client/font.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/client/font.c b/src/client/font.c
index 3b1267a..0e67921 100755
--- a/src/client/font.c
+++ b/src/client/font.c
@@ -69,6 +69,47 @@ void drawFont(char *s, int x, int y, int r, int g, int b)
SDL_FreeSurface(text);
}
+void drawFontMaxSize(char *s, int x, int y, int w, int h, int r, int g, int b)
+{
+ SDL_Rect src_rect, dst_rect;
+ SDL_Surface *text;
+ SDL_Surface *p;
+ SDL_Color farba_pisma = {r, g, b, 0};
+ int my_w, my_h;
+
+ assert( s != NULL );
+
+ p = getSDL_Screen();
+
+ text = TTF_RenderUTF8_Blended(g_font, s, farba_pisma);
+
+
+ my_w = text->w;
+
+ if( my_w > w )
+ {
+ my_w = w;
+ }
+
+ my_h = text->h;
+
+ if( my_w > w )
+ {
+ my_h = h;
+ }
+
+ src_rect.x = 0;
+ src_rect.y = 0;
+ src_rect.w = my_w;
+ src_rect.h = my_h;
+
+ dst_rect.x = x;
+ dst_rect.y = y;
+
+ SDL_BlitSurface(text, &src_rect, p, &dst_rect);
+ SDL_FreeSurface(text);
+}
+
/*
* Vrati velkost daneho fontu.
*/