added loading screen
This commit is contained in:
parent
7d0b12494b
commit
ba05d61d94
7 changed files with 28 additions and 2 deletions
BIN
gfx/loading.png
Normal file
BIN
gfx/loading.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 686 KiB |
|
@ -31,7 +31,6 @@ void init_gl(void) {
|
|||
init_quadvbo();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,6 +82,8 @@ int main(int argc, char** argv) {
|
|||
printf("-- ALUT\n");
|
||||
}
|
||||
|
||||
draw_loading_screen();
|
||||
|
||||
init_global();
|
||||
gamepad_init();
|
||||
printf("initialization complete.\n");
|
||||
|
|
|
@ -170,6 +170,6 @@ void draw_main_menu(MenuData *menu) {
|
|||
}
|
||||
|
||||
void main_menu_loop(MenuData *menu) {
|
||||
set_transition(TransFadeBlack, -1, FADE_TIME);
|
||||
set_transition(TransLoader, -1, FADE_TIME*2);
|
||||
menu_loop(menu, NULL, draw_main_menu, NULL);
|
||||
}
|
||||
|
|
|
@ -134,3 +134,19 @@ void free_resources(void) {
|
|||
delete_shaders();
|
||||
}
|
||||
}
|
||||
|
||||
void draw_loading_screen(void) {
|
||||
const char *prefix = get_prefix();
|
||||
char *buf = malloc(strlen(prefix)+16);
|
||||
Texture *tex;
|
||||
|
||||
strcpy(buf, prefix);
|
||||
strcat(buf, "gfx/loading.png");
|
||||
|
||||
set_ortho();
|
||||
|
||||
tex = load_texture(buf);
|
||||
|
||||
draw_texture_p(SCREEN_W/2,SCREEN_H/2, tex);
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
|
@ -49,4 +49,6 @@ extern Resources resources;
|
|||
|
||||
void load_resources(void);
|
||||
void free_resources(void);
|
||||
|
||||
void draw_loading_screen(void);
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,12 @@ void TransFadeWhite(Transition *t) {
|
|||
colorfill(1,1,1,trans_fade(t));
|
||||
}
|
||||
|
||||
void TransLoader(Transition *t) {
|
||||
glColor4f(1,1,1,trans_fade(t));
|
||||
draw_texture(SCREEN_W/2,SCREEN_H/2,"loading");
|
||||
glColor4f(1,1,1,1);
|
||||
}
|
||||
|
||||
void set_transition(TransitionRule rule, int dur1, int dur2) {
|
||||
if(!rule)
|
||||
return;
|
||||
|
|
|
@ -21,6 +21,7 @@ struct Transition {
|
|||
|
||||
void TransFadeBlack(Transition *t);
|
||||
void TransFadeWhite(Transition *t);
|
||||
void TransLoader(Transition *t);
|
||||
|
||||
void set_transition(TransitionRule rule, int dur1, int dur2);
|
||||
void draw_transition(void);
|
||||
|
|
Loading…
Reference in a new issue