From ef16dbc591bec9a8cc07f76d44d1b4e991c83b65 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 8 Sep 2008 22:18:28 +0200 Subject: Simplyfy calculation of screen centre --- hdaps-tux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hdaps-tux.c b/hdaps-tux.c index 1856040..9228883 100644 --- a/hdaps-tux.c +++ b/hdaps-tux.c @@ -99,15 +99,15 @@ int main(int argc, char *argv[]) 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); + tuxX = (W_WIDTH - image->w) / 2; + tuxY = (W_HEIGHT - image->h) / 2; /* Get the hdaps position so we have something to start from */ get_pos(&hdapsX, &hdapsY); while (!done) { while (SDL_PollEvent(&event)) { - switch(event.type) { + switch (event.type) { case SDL_QUIT: done = 1; break; -- cgit v1.2.3-54-g00ecf