[Add] Implemented loading bar for nebulae.

This commit is contained in:
Allanis 2014-01-09 02:43:37 +00:00
parent 378f924366
commit 8573aa30ba
2 changed files with 12 additions and 4 deletions

View File

@ -84,7 +84,7 @@ char* namjoystick = NULL; /**< Name of joystick to use, NULL is none.
/* Loading. */ /* Loading. */
static void print_SDLversion(void); static void print_SDLversion(void);
static void loadscreen_load(void); static void loadscreen_load(void);
static void loadscreen_render(double done, const char* msg); void loadscreen_render(double done, const char* msg); /* nebulae.c */
static void loadscreen_unload(void); static void loadscreen_unload(void);
static void load_all(void); static void load_all(void);
static void unload_all(void); static void unload_all(void);
@ -306,13 +306,13 @@ void loadscreen_load(void) {
} }
/** /**
* @fn static void loadscreen_render(double done, const char* msg) * @fn void loadscreen_render(double done, const char* msg)
* *
* @brief Render the load screen with message. * @brief Render the load screen with message.
* @param done Amount done (1. == completed). * @param done Amount done (1. == completed).
* @param msg Loading screen message. * @param msg Loading screen message.
*/ */
static void loadscreen_render(double done, const char* msg) { void loadscreen_render(double done, const char* msg) {
double x, y, w, h, rh; double x, y, w, h, rh;
/* Clear background. */ /* Clear background. */

View File

@ -28,6 +28,7 @@
/* Extern. */ /* Extern. */
extern double gui_xoff, gui_yoff; extern double gui_xoff, gui_yoff;
extern Vec2 shake_pos; extern Vec2 shake_pos;
extern void loadscreen_render(double done, const char* msg);
/* The nebulae textures. */ /* The nebulae textures. */
static GLuint nebu_textures[NEBULAE_Z]; /**< BG Nebulae textures. */ static GLuint nebu_textures[NEBULAE_Z]; /**< BG Nebulae textures. */
@ -83,8 +84,9 @@ int nebu_init(void) {
int ret; int ret;
/* Special code to regenerate the nebulae. */ /* Special code to regenerate the nebulae. */
if((nebu_w == -9) && (nebu_h == -9)) if((nebu_w == -9) && (nebu_h == -9)) {
nebu_generate(); nebu_generate();
}
/* Set expected sizes. */ /* Set expected sizes. */
nebu_w = SCREEN_W; nebu_w = SCREEN_W;
@ -483,6 +485,9 @@ static int nebu_generate(void) {
int w, h; int w, h;
int ret; int ret;
/* Warn user of what is happening. */
loadscreen_render(0.05, "Generating Nebulae...");
w = SCREEN_W; w = SCREEN_W;
h = SCREEN_H; h = SCREEN_H;
@ -513,6 +518,9 @@ static void nebu_generatePuffs(void) {
SDL_Surface* sur; SDL_Surface* sur;
float* nebu; float* nebu;
/* Warn user of what is happening. */
loadscreen_render(0.05, "Generating Nebulae Puffs.");
/* Generate the nebulae puffs. */ /* Generate the nebulae puffs. */
for(i = 0; i < NEBULAE_PUFFS; i++) { for(i = 0; i < NEBULAE_PUFFS; i++) {
/* Generate the nebulae. */ /* Generate the nebulae. */