|
Atrinik Client 2.5
|
00001 /************************************************************************ 00002 * Atrinik, a Multiplayer Online Role Playing Game * 00003 * * 00004 * Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team * 00005 * * 00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game) * 00007 * and Crossfire (Multiplayer game for X-windows). * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 * The author can be reached at admin@atrinik.org * 00024 ************************************************************************/ 00025 00030 #include <global.h> 00031 00035 void progress_dots_create(progress_dots *progress) 00036 { 00037 progress->ticks = SDL_GetTicks(); 00038 progress->dot = 0; 00039 progress->done = 0; 00040 } 00041 00048 void progress_dots_show(progress_dots *progress, SDL_Surface *surface, int x, int y) 00049 { 00050 uint8 i; 00051 _BLTFX bltfx; 00052 00053 bltfx.surface = surface; 00054 bltfx.flags = 0; 00055 bltfx.alpha = 0; 00056 00057 for (i = 0; i < PROGRESS_DOTS_NUM; i++) 00058 { 00059 sprite_blt(Bitmaps[progress->dot == i || progress->done ? BITMAP_LOADING_ON : BITMAP_LOADING_OFF], x + (Bitmaps[BITMAP_LOADING_ON]->bitmap->w + PROGRESS_DOTS_SPACING) * i, y, NULL, &bltfx); 00060 } 00061 00062 /* Progress the lit dot. */ 00063 if (!progress->done && SDL_GetTicks() - progress->ticks > PROGRESS_DOTS_TICKS) 00064 { 00065 progress->ticks = SDL_GetTicks(); 00066 progress->dot++; 00067 00068 /* More than maximum, back to the first one. */ 00069 if (progress->dot >= PROGRESS_DOTS_NUM) 00070 { 00071 progress->dot = 0; 00072 } 00073 } 00074 } 00075 00080 int progress_dots_width(progress_dots *progress) 00081 { 00082 (void) progress; 00083 00084 return (Bitmaps[BITMAP_LOADING_ON]->bitmap->w + PROGRESS_DOTS_SPACING) * PROGRESS_DOTS_NUM - PROGRESS_DOTS_SPACING; 00085 }
1.7.4