summaryrefslogtreecommitdiff
path: root/hdaps-tux.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@xenon.tklauser.home>2006-07-08 15:47:34 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2006-07-08 15:47:34 +0200
commitc36bf8c15e68639d46942dd24df5d74ce0250af8 (patch)
treeb8f5add0046821a896e4a99c69d0c0c4eec32a39 /hdaps-tux.c
parent40e391572e076713a8dd52571b0471bc95702839 (diff)
Calculate tuxX and tuxY depending on W_WIDTH/W_HEIGHT and image.w/image.h
Diffstat (limited to 'hdaps-tux.c')
-rw-r--r--hdaps-tux.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hdaps-tux.c b/hdaps-tux.c
index 38ddf1a..1856040 100644
--- a/hdaps-tux.c
+++ b/hdaps-tux.c
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
SDL_Rect dst, dstwhite;
SDL_Event event;
Uint8 *keys;
- int tuxX = 180, tuxY = 170;
+ int tuxX = 0, tuxY = 0;
int hdapsX = 0, hdapsY = 0;
int hdapsXprev = 0, hdapsYprev = 0;
int vel = 4;
@@ -98,6 +98,10 @@ int main(int argc, char *argv[])
dstwhite.h = image->h + 1;
SDL_SetColorKey(image, SDL_SRCCOLORKEY, SDL_MapRGB(image->format, 255, 255, 255));
+ /* Calculate and set initial position of tux (centre of the window) */
+ tuxX = (W_WIDTH / 2) - (image->w / 2);
+ tuxY = (W_HEIGHT / 2) - (image->h / 2);
+
/* Get the hdaps position so we have something to start from */
get_pos(&hdapsX, &hdapsY);