summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-17 20:49:03 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-17 20:49:03 +0000
commit77465c2629ef63629d69c97a0af60a47a07ce7f5 (patch)
tree3d361898d0f29f4b789e52682e0945c741df6cb0 /src
parentb6af4e925f4cf9dd284728e846b99e1de776ec31 (diff)
- opravena chyba, tux mophol pomocou bombballu vybuchnuteho v objekte do ktoreho sa dostal ako duch pridavat itemy
- kod namiesto SDL_Surface pouziva moj typ image_t git-svn-id: http://opensvn.csie.org/tuxanci_ng@154 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src')
-rw-r--r--src/base/arena.h4
-rw-r--r--src/base/item.c10
-rw-r--r--src/base/item.h4
-rw-r--r--src/base/modules.h4
-rw-r--r--src/base/proto.c2
-rw-r--r--src/base/shot.c8
-rw-r--r--src/base/shot.h4
-rw-r--r--src/base/tux.c30
-rw-r--r--src/base/tux.h1
-rw-r--r--src/client/chat.c2
-rwxr-xr-xsrc/client/font.c1
-rwxr-xr-xsrc/client/image.c39
-rwxr-xr-xsrc/client/image.h13
-rwxr-xr-xsrc/client/layer.c2
-rwxr-xr-xsrc/client/layer.h5
-rw-r--r--src/client/panel.c8
-rw-r--r--src/client/radar.c2
-rwxr-xr-xsrc/modules/modPipe.c4
-rwxr-xr-xsrc/modules/modTeleport.c4
-rwxr-xr-xsrc/modules/modWall.c4
-rw-r--r--src/screen/screen_analyze.c2
-rw-r--r--src/screen/screen_browser.c2
-rw-r--r--src/screen/screen_choiceArena.c3
-rw-r--r--src/screen/screen_credits.c2
-rw-r--r--src/screen/screen_gameType.c2
-rw-r--r--src/screen/screen_mainMenu.c2
-rw-r--r--src/screen/screen_setting.c2
-rw-r--r--src/screen/screen_table.c3
-rw-r--r--src/screen/screen_world.c10
-rw-r--r--src/widget/widget_button.c4
-rw-r--r--src/widget/widget_buttonimage.c2
-rw-r--r--src/widget/widget_buttonimage.h4
-rw-r--r--src/widget/widget_check.c2
-rw-r--r--src/widget/widget_image.c2
-rw-r--r--src/widget/widget_image.h4
-rw-r--r--src/widget/widget_textfield.c4
36 files changed, 123 insertions, 78 deletions
diff --git a/src/base/arena.h b/src/base/arena.h
index e7f70ea..9512222 100644
--- a/src/base/arena.h
+++ b/src/base/arena.h
@@ -6,7 +6,7 @@
#include "main.h"
#ifndef PUBLIC_SERVER
-#include "interface.h"
+#include "image.h"
#endif
#ifdef __WIN32__
@@ -21,7 +21,7 @@ typedef struct arena_struct
#ifndef PUBLIC_SERVER
char music[STR_SIZE];
- SDL_Surface *background;
+ image_t *background;
#endif
int w, h;
list_t *listTimer;
diff --git a/src/base/item.c b/src/base/item.c
index ef83066..c341754 100644
--- a/src/base/item.c
+++ b/src/base/item.c
@@ -33,7 +33,7 @@
#endif
#ifndef PUBLIC_SERVER
-static SDL_Surface *g_item[ITEM_COUNT];
+static image_t *g_item[ITEM_COUNT];
#endif
static bool_t isItemInit = FALSE;
@@ -512,6 +512,8 @@ static void action_giveitem(space_t *space, item_t *item, tux_t *tux)
}
delObjectFromSpaceWithObject(space, item, destroyItem);
+
+ addNewItem(space, ID_UNKNOWN);
break;
case ITEM_MINE :
@@ -543,10 +545,10 @@ static void action_giveitem(space_t *space, item_t *item, tux_t *tux)
}
delObjectFromSpaceWithObject(space, item, destroyItem);
+
+ addNewItem(space, ID_UNKNOWN);
break;
}
-
- addNewItem(space, ID_UNKNOWN);
}
void eventGiveTuxListItem(tux_t *tux, space_t *spaceItem)
@@ -558,7 +560,7 @@ void eventGiveTuxListItem(tux_t *tux, space_t *spaceItem)
if( getNetTypeGame() == NET_GAME_TYPE_CLIENT )
{
- return;
+ return;
}
if( tux->status == TUX_STATUS_DEAD )
diff --git a/src/base/item.h b/src/base/item.h
index e7900d7..9dcb678 100644
--- a/src/base/item.h
+++ b/src/base/item.h
@@ -8,7 +8,7 @@
#define ITEM_SYNC_TIMEOUT 5000
#ifndef PUBLIC_SERVER
-#include "interface.h"
+#include "image.h"
#endif
#ifdef __WIN32__
@@ -35,7 +35,7 @@ typedef struct item_struct
int author_id;
#ifndef PUBLIC_SERVER
- SDL_Surface *img; //obrazok
+ image_t *img; //obrazok
#endif
} item_t;
diff --git a/src/base/modules.h b/src/base/modules.h
index 1d68568..9705d7f 100644
--- a/src/base/modules.h
+++ b/src/base/modules.h
@@ -21,9 +21,9 @@ typedef struct export_fce_s
int (*fce_getValue)(char *line, char *env, char *val, int len);
#ifndef PUBLIC_SERVER
- SDL_Surface* (*fce_getImage)(char *group, char *name);
+ image_t* (*fce_getImage)(char *group, char *name);
- void (*fce_addLayer)(SDL_Surface *img,
+ void (*fce_addLayer)(image_t *img,
int x,int y, int px,int py,
int w,int h, int player);
#endif
diff --git a/src/base/proto.c b/src/base/proto.c
index 6d4c2f2..e42e4d9 100644
--- a/src/base/proto.c
+++ b/src/base/proto.c
@@ -115,7 +115,7 @@ void proto_recv_hello_server(client_t *client, char *msg)
name[STR_NAME_SIZE-1] = '\0';
}
- strcpy(client->tux->name, name);
+ tuxSetName(client->tux, name);
sendInfoCreateClient(client);
}
diff --git a/src/base/shot.c b/src/base/shot.c
index c631a26..5e95a8e 100644
--- a/src/base/shot.c
+++ b/src/base/shot.c
@@ -22,10 +22,10 @@
#ifndef PUBLIC_SERVER
-static SDL_Surface *g_shot_simple;
-static SDL_Surface *g_shot_lasserX;
-static SDL_Surface *g_shot_lasserY;
-static SDL_Surface *g_shot_bombball;
+static image_t *g_shot_simple;
+static image_t *g_shot_lasserX;
+static image_t *g_shot_lasserY;
+static image_t *g_shot_bombball;
#endif
diff --git a/src/base/shot.h b/src/base/shot.h
index c507976..d279c02 100644
--- a/src/base/shot.h
+++ b/src/base/shot.h
@@ -13,7 +13,7 @@
#endif
#ifndef PUBLIC_SERVER
-#include "interface.h"
+#include "image.h"
#endif
typedef struct shot_struct
@@ -36,7 +36,7 @@ typedef struct shot_struct
bool_t isCanKillAuthor;
#ifndef PUBLIC_SERVER
- SDL_Surface *img;
+ image_t *img;
#endif
} shot_t;
diff --git a/src/base/tux.c b/src/base/tux.c
index cfaaddf..bbc63e0 100644
--- a/src/base/tux.c
+++ b/src/base/tux.c
@@ -18,6 +18,7 @@
#include "idManager.h"
#ifndef PUBLIC_SERVER
+#include "font.h"
#include "image.h"
#include "layer.h"
#include "term.h"
@@ -36,11 +37,11 @@
#ifndef PUBLIC_SERVER
-static SDL_Surface *g_tux_up;
-static SDL_Surface *g_tux_right;
-static SDL_Surface *g_tux_left;
-static SDL_Surface *g_tux_down;
-static SDL_Surface *g_cross;
+static image_t *g_tux_up;
+static image_t *g_tux_right;
+static image_t *g_tux_left;
+static image_t *g_tux_down;
+static image_t *g_cross;
#endif
@@ -104,6 +105,12 @@ tux_t* newTux()
return new;
}
+void tuxSetName(tux_t *tux, char *name)
+{
+ strcpy(tux->name, name);
+ //tux->g_name = getFontImage(name, COLOR_WHITE);
+}
+
bool_t isTuxAnyGun(tux_t *tux)
{
int i;
@@ -156,7 +163,7 @@ void getCourse(int n, int *x, int *y)
void drawTux(tux_t *tux)
{
- SDL_Surface *g_image = NULL;
+ image_t *g_image = NULL;
assert( tux != NULL );
@@ -202,7 +209,16 @@ void drawTux(tux_t *tux)
return;
}
-
+/*
+ if( tux->g_name != NULL )
+ {
+ addLayer(tux->g_name,
+ tux->x - TUX_IMG_WIDTH / 2,
+ ( tux->y + TUX_HEIGHT / 2 ) - TUX_IMG_HEIGHT,
+ 0, 0,
+ tux->g_name->w, tux->g_name->h, TUX_LAYER);
+ }
+*/
addLayer(g_image,
tux->x - TUX_IMG_WIDTH / 2,
( tux->y + TUX_HEIGHT / 2 ) - TUX_IMG_HEIGHT,
diff --git a/src/base/tux.h b/src/base/tux.h
index 4908af7..2d39195 100644
--- a/src/base/tux.h
+++ b/src/base/tux.h
@@ -112,6 +112,7 @@ typedef struct tux_struct
extern bool_t isTuxInicialized();
extern void initTux();
extern tux_t* newTux();
+extern void tuxSetName(tux_t *tux, char *name);
extern bool_t isTuxAnyGun(tux_t *tux);
extern void getCourse(int n, int *x, int *y);
extern void drawTux(tux_t *tux);
diff --git a/src/client/chat.c b/src/client/chat.c
index bad3826..a50af88 100644
--- a/src/client/chat.c
+++ b/src/client/chat.c
@@ -14,7 +14,7 @@
#include "chat.h"
#include "font.h"
-static SDL_Surface *g_chat;
+static image_t *g_chat;
static list_t *listText;
diff --git a/src/client/font.c b/src/client/font.c
index 0e67921..b81c398 100755
--- a/src/client/font.c
+++ b/src/client/font.c
@@ -1,4 +1,3 @@
-
#include "main.h"
#include "interface.h"
#include "font.h"
diff --git a/src/client/image.c b/src/client/image.c
index 3c3b40f..e76e1cf 100755
--- a/src/client/image.c
+++ b/src/client/image.c
@@ -60,10 +60,25 @@ static SDL_Surface *loadImage(const char *filename, int alpha)
return ret;
}
-static void destroySDLSurface(void *p)
+image_t* newImage(SDL_Surface *surface)
+{
+ image_t *new;
+
+ assert( surface != NULL );
+
+ new = malloc( sizeof(image_t) );
+ new->image = surface;
+ new->w = surface->w;
+ new->h = surface->h;
+
+ return new;
+}
+
+static void destroyImage(image_t *p)
{
assert( p != NULL );
- SDL_FreeSurface((SDL_Surface *)p);
+ SDL_FreeSurface((SDL_Surface *)p->image);
+ free(p);
}
/*
@@ -72,15 +87,17 @@ static void destroySDLSurface(void *p)
* *name - nazov obrazku ( pouzije sa ako vyhadavaci retazec v zazanem )
* alpha - 0 - nema alpha kanal | 1 - ma alpha kanal
*/
-SDL_Surface* addImageData(char *file, int alpha, char *name, char *group)
+image_t* addImageData(char *file, int alpha, char *name, char *group)
{
- SDL_Surface *new;
+ SDL_Surface *surface;
+ image_t *new;
assert( file != NULL );
assert( name != NULL );
assert( group != NULL );
- new = loadImage(file, alpha);
+ surface = loadImage(file, alpha);
+ new = newImage(surface);
addItemToStorage(listStorage, group, name, new );
@@ -93,7 +110,7 @@ SDL_Surface* addImageData(char *file, int alpha, char *name, char *group)
* Vrati odkaz na image_data v globalnom zozname obrazkov
* a nazvom *s
*/
-SDL_Surface* getImage(char *group, char *name)
+image_t* getImage(char *group, char *name)
{
assert( group != NULL );
assert( name != NULL );
@@ -106,17 +123,17 @@ void delImage(char *group, char *name)
assert( group != NULL );
assert( name != NULL );
- delItemFromStorage(listStorage, group, name, destroySDLSurface);
+ delItemFromStorage(listStorage, group, name, destroyImage);
}
void delAllImageInGroup(char *group)
{
assert( group != NULL );
- delAllItemFromStorage(listStorage, group, destroySDLSurface);
+ delAllItemFromStorage(listStorage, group, destroyImage);
}
-void drawImage(SDL_Surface *p, int x,int y, int px, int py, int w, int h)
+void drawImage(image_t *p, int x,int y, int px, int py, int w, int h)
{
static SDL_Surface *screen = NULL;
SDL_Rect dst_rect, src_rect;
@@ -134,7 +151,7 @@ void drawImage(SDL_Surface *p, int x,int y, int px, int py, int w, int h)
src_rect.w = w;
src_rect.h = h;
- SDL_BlitSurface(p, &src_rect, screen, &dst_rect);
+ SDL_BlitSurface(p->image, &src_rect, screen, &dst_rect);
}
/*
@@ -143,7 +160,7 @@ void drawImage(SDL_Surface *p, int x,int y, int px, int py, int w, int h)
void quitImageData()
{
printf("quit image database..\n");
- destroyStorage(listStorage, destroySDLSurface);
+ destroyStorage(listStorage, destroyImage);
isImageDataInit = FALSE;
}
diff --git a/src/client/image.h b/src/client/image.h
index e80efb5..c154ff0 100755
--- a/src/client/image.h
+++ b/src/client/image.h
@@ -23,13 +23,20 @@ typedef struct image_struct
} image_data_t;
*/
+typedef struct image_struct
+{
+ int w;
+ int h;
+ SDL_Surface *image;
+} image_t;
+
extern bool_t isImageInicialized();
extern void initImageData();
-extern SDL_Surface* addImageData(char *file, int alpha, char *name, char *group);
-extern SDL_Surface* getImage(char *group, char *name);
+extern image_t* addImageData(char *file, int alpha, char *name, char *group);
+extern image_t* getImage(char *group, char *name);
extern void delImage(char *group, char *name);
extern void delAllImageInGroup(char *group);
-extern void drawImage(SDL_Surface *p, int x,int y, int px, int py, int w, int h);
+extern void drawImage(image_t *p, int x,int y, int px, int py, int w, int h);
extern void quitImageData();
#endif
diff --git a/src/client/layer.c b/src/client/layer.c
index 102af1c..efac264 100755
--- a/src/client/layer.c
+++ b/src/client/layer.c
@@ -37,7 +37,7 @@ void initLayer()
* px py pw ph - suradnica casti obrazka *img ktora sa ma zobrazit
* layer - vrstva na ktorej sa zobrazi obrazok
*/
-void addLayer(SDL_Surface *img,
+void addLayer(image_t *img,
int x,int y, int px,int py,
int w,int h, int player)
{
diff --git a/src/client/layer.h b/src/client/layer.h
index 04a4617..f61a162 100755
--- a/src/client/layer.h
+++ b/src/client/layer.h
@@ -4,6 +4,7 @@
#define MY_LAYER_H
#include "main.h"
+#include "image.h"
typedef struct layer_str
{
@@ -21,7 +22,7 @@ typedef struct layer_str
int layer;
- SDL_Surface *image; //dane surfrace
+ image_t *image; //dane surfrace
} layer_t;
extern bool_t isLayerInicialized();
@@ -38,7 +39,7 @@ extern void initLayer();
* (0 - pod tuxancami | 1 - na tej istej ako tuxanci | 2 - nad tuxancami)
*/
-extern void addLayer(SDL_Surface *img,
+extern void addLayer(image_t *img,
int x,int y, int px,int py,
int w,int h, int player);
diff --git a/src/client/panel.c b/src/client/panel.c
index 7a5b3e2..f63e481 100644
--- a/src/client/panel.c
+++ b/src/client/panel.c
@@ -12,10 +12,10 @@
#include "font.h"
#include "chat.h"
-static SDL_Surface *g_panel;
-static SDL_Surface *g_shot;
-static SDL_Surface *g_icon[ITEM_COUNT];
-static SDL_Surface *g_bonus;
+static image_t *g_panel;
+static image_t *g_shot;
+static image_t *g_icon[ITEM_COUNT];
+static image_t *g_bonus;
static bool_t isPanelInit = FALSE;
diff --git a/src/client/radar.c b/src/client/radar.c
index 49c72de..afa48d4 100644
--- a/src/client/radar.c
+++ b/src/client/radar.c
@@ -12,7 +12,7 @@
#include "image.h"
#include "radar.h"
-static SDL_Surface *g_radar;
+static image_t *g_radar;
static list_t *listRadar;
typedef struct radar_item_struct
diff --git a/src/modules/modPipe.c b/src/modules/modPipe.c
index 3edbc0b..b0516c8 100755
--- a/src/modules/modPipe.c
+++ b/src/modules/modPipe.c
@@ -36,7 +36,7 @@ typedef struct pipe_struct
int layer; // vrstva
#ifndef PUBLIC_SERVER
- SDL_Surface *img; //obrazok
+ image_t *img; //obrazok
#endif
} pipe_t;
@@ -46,7 +46,7 @@ static list_t *listPipe;
static space_t *spacePipe;
#ifndef PUBLIC_SERVER
-static pipe_t* newPipe(int x, int y, int w, int h, int layer, int id, int id_out, int position, SDL_Surface *img)
+static pipe_t* newPipe(int x, int y, int w, int h, int layer, int id, int id_out, int position, image_t *img)
#endif
#ifdef PUBLIC_SERVER
diff --git a/src/modules/modTeleport.c b/src/modules/modTeleport.c
index 785c1a3..1411b88 100755
--- a/src/modules/modTeleport.c
+++ b/src/modules/modTeleport.c
@@ -34,7 +34,7 @@ typedef struct teleport_struct
int layer; // vrstva
#ifndef PUBLIC_SERVER
- SDL_Surface *img; //obrazok
+ image_t *img; //obrazok
#endif
} teleport_t;
@@ -44,7 +44,7 @@ static space_t *spaceTeleport;
static list_t *listTeleport;
#ifndef PUBLIC_SERVER
-teleport_t* newTeleport(int x, int y, int w, int h, int layer, SDL_Surface *img)
+teleport_t* newTeleport(int x, int y, int w, int h, int layer, image_t *img)
#endif
#ifdef PUBLIC_SERVER
diff --git a/src/modules/modWall.c b/src/modules/modWall.c
index c2cf69e..0422bbe 100755
--- a/src/modules/modWall.c
+++ b/src/modules/modWall.c
@@ -36,7 +36,7 @@ typedef struct wall_struct
int layer; // vrstva
#ifndef PUBLIC_SERVER
- SDL_Surface *img; //obrazok
+ image_t *img; //obrazok
#endif
} wall_t;
@@ -52,7 +52,7 @@ static list_t *listWall;
#ifndef PUBLIC_SERVER
wall_t* newWall(int x, int y, int w, int h,
- int img_x, int img_y, int layer, SDL_Surface *img)
+ int img_x, int img_y, int layer, image_t *img)
#endif
#ifdef PUBLIC_SERVER
diff --git a/src/screen/screen_analyze.c b/src/screen/screen_analyze.c
index 9299c7b..7723f94 100644
--- a/src/screen/screen_analyze.c
+++ b/src/screen/screen_analyze.c
@@ -147,7 +147,7 @@ void endAnalyze()
void initScreenAnalyze()
{
- SDL_Surface *image;
+ image_t *image;
image = getImage(IMAGE_GROUP_BASE, "screen_main");
image_backgorund = newWidgetImage(0, 0, image);
diff --git a/src/screen/screen_browser.c b/src/screen/screen_browser.c
index 17a05b6..3130dd4 100644
--- a/src/screen/screen_browser.c
+++ b/src/screen/screen_browser.c
@@ -676,7 +676,7 @@ static int RefreshServers ()
void initScreenBrowser()
{
- SDL_Surface *image;
+ image_t *image;
image = getImage(IMAGE_GROUP_BASE, "screen_main");
image_backgorund = newWidgetImage(0, 0, image);
diff --git a/src/screen/screen_choiceArena.c b/src/screen/screen_choiceArena.c
index cd61c9c..f1a13b3 100644
--- a/src/screen/screen_choiceArena.c
+++ b/src/screen/screen_choiceArena.c
@@ -123,7 +123,7 @@ static void eventWidget(void *p)
void initScreenChoiceArena()
{
- SDL_Surface *image;
+ image_t *image;
int i;
image = getImage(IMAGE_GROUP_BASE, "screen_main");
@@ -137,7 +137,6 @@ void initScreenChoiceArena()
for( i = 0 ; i < getArenaCount() ; i++ )
{
- SDL_Surface *image;
widget_buttonimage_t *widget_buttonimage;
int x, y;
diff --git a/src/screen/screen_credits.c b/src/screen/screen_credits.c
index 6de034a..8bbd433 100644
--- a/src/screen/screen_credits.c
+++ b/src/screen/screen_credits.c
@@ -96,7 +96,7 @@ static void eventWidget(void *p)
void initScreenCredits()
{
- SDL_Surface *image;
+ image_t *image;
int i;
image = getImage(IMAGE_GROUP_BASE, "screen_main");
diff --git a/src/screen/screen_gameType.c b/src/screen/screen_gameType.c
index fb971db..bafa747 100644
--- a/src/screen/screen_gameType.c
+++ b/src/screen/screen_gameType.c
@@ -170,7 +170,7 @@ static void eventWidget(void *p)
void initScreenGameType()
{
- SDL_Surface *image;
+ image_t *image;
image = getImage(IMAGE_GROUP_BASE, "screen_main");
image_backgorund = newWidgetImage(0, 0, image);
diff --git a/src/screen/screen_mainMenu.c b/src/screen/screen_mainMenu.c
index 024d3bd..eb07cab 100644
--- a/src/screen/screen_mainMenu.c
+++ b/src/screen/screen_mainMenu.c
@@ -96,7 +96,7 @@ static void eventWidget(void *p)
void initScreenMainMenu()
{
- SDL_Surface *image;
+ image_t *image;
image = addImageData("screen_main.png", IMAGE_NO_ALPHA, "screen_main", IMAGE_GROUP_BASE);
image_backgorund = newWidgetImage(0, 0, image);
diff --git a/src/screen/screen_setting.c b/src/screen/screen_setting.c
index 876c464..350788d 100644
--- a/src/screen/screen_setting.c
+++ b/src/screen/screen_setting.c
@@ -313,7 +313,7 @@ static void saveAndDestroyConfigFile()
void initScreenSetting()
{
- SDL_Surface *image;
+ image_t *image;
int i;
image = getImage(IMAGE_GROUP_BASE, "screen_main");
diff --git a/src/screen/screen_table.c b/src/screen/screen_table.c
index 498dc7a..1f53b8d 100644
--- a/src/screen/screen_table.c
+++ b/src/screen/screen_table.c
@@ -203,8 +203,7 @@ int addPlayerInHighScore(char *name, int score)
void initScreenTable()
{
- SDL_Surface *image;
-
+ image_t *image;
image = addImageData("screen_table.png", IMAGE_NO_ALPHA, "screen_table", IMAGE_GROUP_BASE);
image_backgorund = newWidgetImage(0, 0, image);
diff --git a/src/screen/screen_world.c b/src/screen/screen_world.c
index b770bd5..cbd5400 100644
--- a/src/screen/screen_world.c
+++ b/src/screen/screen_world.c
@@ -119,6 +119,7 @@ void countRoundInc()
void prepareArena()
{
tux_t *tux;
+ char name[STR_NAME_SIZE];
//printf("getSettingAI = %s\n", getSettingAI());
setCurrentArena(NULL);
@@ -133,13 +134,15 @@ void prepareArena()
tux = newTux();
tux->control = TUX_CONTROL_KEYBOARD_RIGHT;
tuxWithControlRightKeyboard = tux;
- getSettingNameRight(tux->name);
+ getSettingNameRight(name);
+ tuxSetName(tux, name);
addObjectToSpace(arena->spaceTux, tux);
tux = newTux();
tux->control = TUX_CONTROL_KEYBOARD_LEFT;
tuxWithControlLeftKeyboard = tux;
- getSettingNameLeft(tux->name);
+ getSettingNameLeft(name);
+ tuxSetName(tux, name);
addObjectToSpace(arena->spaceTux, tux);
if( isSettingAI() )
@@ -159,7 +162,8 @@ void prepareArena()
tux = newTux();
tux->control = TUX_CONTROL_KEYBOARD_RIGHT;
tuxWithControlRightKeyboard = tux;
- getSettingNameRight(tux->name);
+ getSettingNameRight(name);
+ tuxSetName(tux, name);
addObjectToSpace(arena->spaceTux, tux);
break;
diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c
index 0bdab86..4cff900 100644
--- a/src/widget/widget_button.c
+++ b/src/widget/widget_button.c
@@ -25,8 +25,8 @@ widget_button_t* newWidgetButton(char *text, int x, int y, void (*fce_event)(voi
void drawWidgetButton(widget_button_t *p)
{
- static SDL_Surface *g_button0 = NULL;
- static SDL_Surface *g_button1 = NULL;
+ static image_t *g_button0 = NULL;
+ static image_t *g_button1 = NULL;
int x, y;
getMousePosition(&x, &y);
diff --git a/src/widget/widget_buttonimage.c b/src/widget/widget_buttonimage.c
index 0b6e961..6dfbe66 100644
--- a/src/widget/widget_buttonimage.c
+++ b/src/widget/widget_buttonimage.c
@@ -6,7 +6,7 @@
#include "image.h"
#include "widget_buttonimage.h"
-widget_buttonimage_t* newWidgetButtonimage(SDL_Surface *image, int x, int y, void (*fce_event)(void *))
+widget_buttonimage_t* newWidgetButtonimage(image_t *image, int x, int y, void (*fce_event)(void *))
{
widget_buttonimage_t *new;
diff --git a/src/widget/widget_buttonimage.h b/src/widget/widget_buttonimage.h
index d03423e..e85ce70 100644
--- a/src/widget/widget_buttonimage.h
+++ b/src/widget/widget_buttonimage.h
@@ -12,11 +12,11 @@ typedef struct widget_buttonimageimage
int x, y;
int w, h;
int active;
- SDL_Surface *image;
+ image_t *image;
void (*fce_event)(void *);
} widget_buttonimage_t;
-extern widget_buttonimage_t* newWidgetButtonimage(SDL_Surface *image, int x, int y,
+extern widget_buttonimage_t* newWidgetButtonimage(image_t *image, int x, int y,
void (*fce_event)(void *));
extern void drawWidgetButtonimage(widget_buttonimage_t *p);
diff --git a/src/widget/widget_check.c b/src/widget/widget_check.c
index 192ae9b..584b6da 100644
--- a/src/widget/widget_check.c
+++ b/src/widget/widget_check.c
@@ -21,7 +21,7 @@ widget_check_t* newWidgetCheck(int x, int y, bool_t status, void (*fce_event)(vo
void drawWidgetCheck(widget_check_t *p)
{
- static SDL_Surface *g_check = NULL;
+ static image_t *g_check = NULL;
int x, y;
int offset;
diff --git a/src/widget/widget_image.c b/src/widget/widget_image.c
index 6437451..8be8080 100644
--- a/src/widget/widget_image.c
+++ b/src/widget/widget_image.c
@@ -8,7 +8,7 @@
#include "font.h"
#include "widget_image.h"
-widget_image_t* newWidgetImage(int x, int y, SDL_Surface *image)
+widget_image_t* newWidgetImage(int x, int y, image_t *image)
{
widget_image_t *new;
diff --git a/src/widget/widget_image.h b/src/widget/widget_image.h
index 6bb316c..8a038da 100644
--- a/src/widget/widget_image.h
+++ b/src/widget/widget_image.h
@@ -9,10 +9,10 @@
typedef struct widget_image
{
int x, y;
- SDL_Surface *image;
+ image_t *image;
} widget_image_t;
-extern widget_image_t* newWidgetImage(int x, int y, SDL_Surface *image);
+extern widget_image_t* newWidgetImage(int x, int y, image_t *image);
extern void drawWidgetImage(widget_image_t *p);
extern void eventWidgetImage(widget_image_t *p);
extern void destroyWidgetImage(widget_image_t *p);
diff --git a/src/widget/widget_textfield.c b/src/widget/widget_textfield.c
index 2a8a02c..70e2a66 100644
--- a/src/widget/widget_textfield.c
+++ b/src/widget/widget_textfield.c
@@ -30,8 +30,8 @@ widget_textfield_t* newWidgetTextfield(char *text, int filter, int x, int y)
static void drawBackground(widget_textfield_t *p)
{
- static SDL_Surface *g_textfield0 = NULL;
- static SDL_Surface *g_textfield1 = NULL;
+ static image_t *g_textfield0 = NULL;
+ static image_t *g_textfield1 = NULL;
int x, y;
getMousePosition(&x, &y);