From c36bf8c15e68639d46942dd24df5d74ce0250af8 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sat, 8 Jul 2006 15:47:34 +0200 Subject: Calculate tuxX and tuxY depending on W_WIDTH/W_HEIGHT and image.w/image.h --- hdaps-tux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3-54-g00ecf