diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-06 19:36:04 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-06 19:36:04 +0000 |
| commit | ca019ecd6715557a572ac9a56de556434f9b31aa (patch) | |
| tree | 5e39db57af3433dd7b44162cdf5f388111e091fb /src/client | |
| parent | 05f2c8aacf46e643b2bd916b7c8139e8a259122a (diff) | |
- podpora chatu :)
git-svn-id: http://opensvn.csie.org/tuxanci_ng@109 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/client.c | 1 | ||||
| -rwxr-xr-x | src/client/font.c | 41 | ||||
| -rwxr-xr-x | src/client/font.h | 1 | ||||
| -rw-r--r-- | src/client/panel.c | 6 | ||||
| -rw-r--r-- | src/client/radar.c | 2 |
5 files changed, 50 insertions, 1 deletions
diff --git a/src/client/client.c b/src/client/client.c index 26df8dc..1ac74dd 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -172,6 +172,7 @@ void eventServerBuffer() if( strncmp(line, "additem", 7) == 0 )proto_recv_additem_client(line); if( strncmp(line, "shot", 4) == 0 )proto_recv_shot_client(line); if( strncmp(line, "kill", 4) == 0 )proto_recv_kill_client(line); + if( strncmp(line, "chat", 4) == 0 )proto_recv_chat_client(line); if( strncmp(line, "ping", 4) == 0 )proto_recv_ping_client(line); if( strncmp(line, "end", 3) == 0 )proto_recv_end_client(line); 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. */ diff --git a/src/client/font.h b/src/client/font.h index f938b3b..cf8ece6 100755 --- a/src/client/font.h +++ b/src/client/font.h @@ -19,6 +19,7 @@ extern bool_t isFontInicialized(); extern void initFont(char *file,int size); extern void drawFont(char *s,int x,int y,int r,int g,int b); +extern void drawFontMaxSize(char *s, int x, int y, int w, int h, int r, int g, int b); extern int getFontSize(); extern void getTextSize(char *s, int *w, int *h); extern void quitFont(); diff --git a/src/client/panel.c b/src/client/panel.c index 3338544..7a5b3e2 100644 --- a/src/client/panel.c +++ b/src/client/panel.c @@ -10,6 +10,7 @@ #include "image.h" #include "panel.h" #include "font.h" +#include "chat.h" static SDL_Surface *g_panel; static SDL_Surface *g_shot; @@ -145,6 +146,11 @@ void drawPanel(list_t *listTux) drawImage(g_panel, PANEL_LOCATION_X, PANEL_LOCATION_Y, 0, 0, g_panel->w, g_panel->h); drawScore(listTux); + if( isRecivedNewMsg() ) + { + drawFont("recived new msg", PANEL_LOCATION_X, PANEL_LOCATION_Y, COLOR_WHITE); + } + for( i = 0 ; i < listTux->count ; i++ ) { tux_t *thisTux; diff --git a/src/client/radar.c b/src/client/radar.c index 789fb45..6f6b028 100644 --- a/src/client/radar.c +++ b/src/client/radar.c @@ -85,7 +85,7 @@ void initRadar() assert( isImageInicialized() == TRUE ); assert( isInterfaceInicialized() == TRUE ); - g_radar = addImageData("radar.png", IMAGE_ALPHA, "radar", IMAGE_GROUP_USER); + g_radar = addImageData("radar.png", IMAGE_NO_ALPHA, "radar", IMAGE_GROUP_USER); listRadar = newList(); } |