mirror of https://github.com/xemu-project/xemu.git
ui: Start logo animation on appearing
This commit is contained in:
parent
a10f24f030
commit
8a21065fe8
|
@ -287,8 +287,9 @@ void render_controller_port(float frame_x, float frame_y, int i, uint32_t port_c
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_logo(uint32_t primary_color, uint32_t secondary_color, uint32_t fill_color)
|
void render_logo(uint32_t time, uint32_t primary_color, uint32_t secondary_color, uint32_t fill_color)
|
||||||
{
|
{
|
||||||
|
s_logo->time = time;
|
||||||
glUseProgram(s_logo->prog);
|
glUseProgram(s_logo->prog);
|
||||||
glBindVertexArray(s->vao);
|
glBindVertexArray(s->vao);
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFunc(GL_ONE, GL_ZERO);
|
||||||
|
|
|
@ -36,7 +36,7 @@ void initialize_custom_ui_rendering(void);
|
||||||
void render_meter(struct decal_shader *s, float x, float y, float width, float height, float p, uint32_t color_bg, uint32_t color_fg);
|
void render_meter(struct decal_shader *s, float x, float y, float width, float height, float p, uint32_t color_bg, uint32_t color_fg);
|
||||||
void render_controller(float frame_x, float frame_y, uint32_t primary_color, uint32_t secondary_color, struct controller_state *state);
|
void render_controller(float frame_x, float frame_y, uint32_t primary_color, uint32_t secondary_color, struct controller_state *state);
|
||||||
void render_controller_port(float frame_x, float frame_y, int i, uint32_t port_color);
|
void render_controller_port(float frame_x, float frame_y, int i, uint32_t port_color);
|
||||||
void render_logo(uint32_t primary_color, uint32_t secondary_color, uint32_t fill_color);
|
void render_logo(uint32_t time, uint32_t primary_color, uint32_t secondary_color, uint32_t fill_color);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1112,6 +1112,12 @@ struct AboutWindow
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t time_start = 0;
|
||||||
|
if (ImGui::IsWindowAppearing()) {
|
||||||
|
time_start = SDL_GetTicks();
|
||||||
|
}
|
||||||
|
uint32_t now = SDL_GetTicks() - time_start;
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY()-50);
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY()-50);
|
||||||
ImGui::SetCursorPosX((ImGui::GetWindowWidth()-256)/2);
|
ImGui::SetCursorPosX((ImGui::GetWindowWidth()-256)/2);
|
||||||
|
|
||||||
|
@ -1123,7 +1129,10 @@ struct AboutWindow
|
||||||
ImVec2(t_w-x_off, t_h),
|
ImVec2(t_w-x_off, t_h),
|
||||||
ImVec2(x_off/t_w, t_h/t_h),
|
ImVec2(x_off/t_w, t_h/t_h),
|
||||||
ImVec2(t_w/t_w, 0));
|
ImVec2(t_w/t_w, 0));
|
||||||
render_logo(0x42e335ff, 0x42e335ff, 0x00000000);
|
if (ImGui::IsItemClicked()) {
|
||||||
|
time_start = SDL_GetTicks();
|
||||||
|
}
|
||||||
|
render_logo(now, 0x42e335ff, 0x42e335ff, 0x00000000);
|
||||||
render_to_default_fb();
|
render_to_default_fb();
|
||||||
ImGui::SetCursorPosX(10);
|
ImGui::SetCursorPosX(10);
|
||||||
|
|
||||||
|
@ -1186,6 +1195,12 @@ struct FirstBootWindow
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t time_start = 0;
|
||||||
|
if (ImGui::IsWindowAppearing()) {
|
||||||
|
time_start = SDL_GetTicks();
|
||||||
|
}
|
||||||
|
uint32_t now = SDL_GetTicks() - time_start;
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY()-50);
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY()-50);
|
||||||
ImGui::SetCursorPosX((ImGui::GetWindowWidth()-256)/2);
|
ImGui::SetCursorPosX((ImGui::GetWindowWidth()-256)/2);
|
||||||
|
|
||||||
|
@ -1197,7 +1212,7 @@ struct FirstBootWindow
|
||||||
ImVec2(t_w-x_off, t_h),
|
ImVec2(t_w-x_off, t_h),
|
||||||
ImVec2(x_off/t_w, t_h/t_h),
|
ImVec2(x_off/t_w, t_h/t_h),
|
||||||
ImVec2(t_w/t_w, 0));
|
ImVec2(t_w/t_w, 0));
|
||||||
render_logo(0x42e335ff, 0x42e335ff, 0x00000000);
|
render_logo(now, 0x42e335ff, 0x42e335ff, 0x00000000);
|
||||||
render_to_default_fb();
|
render_to_default_fb();
|
||||||
ImGui::SetCursorPosX(10);
|
ImGui::SetCursorPosX(10);
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct decal_shader *create_decal_shader(enum SHADER_TYPE type)
|
||||||
s->scale = 1.4;
|
s->scale = 1.4;
|
||||||
s->smoothing = 1.0;
|
s->smoothing = 1.0;
|
||||||
s->outline_dist = 1.0;
|
s->outline_dist = 1.0;
|
||||||
|
s->time = 0;
|
||||||
|
|
||||||
const char *vert_src =
|
const char *vert_src =
|
||||||
"#version 150 core\n"
|
"#version 150 core\n"
|
||||||
|
@ -244,7 +245,7 @@ void render_decal(
|
||||||
glUniform4f(s->ColorPrimary_loc, COL(primary, 3), COL(primary, 2), COL(primary, 1), COL(primary, 0));
|
glUniform4f(s->ColorPrimary_loc, COL(primary, 3), COL(primary, 2), COL(primary, 1), COL(primary, 0));
|
||||||
glUniform4f(s->ColorSecondary_loc, COL(secondary, 3), COL(secondary, 2), COL(secondary, 1), COL(secondary, 0));
|
glUniform4f(s->ColorSecondary_loc, COL(secondary, 3), COL(secondary, 2), COL(secondary, 1), COL(secondary, 0));
|
||||||
glUniform4f(s->ColorFill_loc, COL(fill, 3), COL(fill, 2), COL(fill, 1), COL(fill, 0));
|
glUniform4f(s->ColorFill_loc, COL(fill, 3), COL(fill, 2), COL(fill, 1), COL(fill, 0));
|
||||||
if (s->time_loc >= 0) glUniform1f(s->time_loc, SDL_GetTicks()/1000.0f);
|
if (s->time_loc >= 0) glUniform1f(s->time_loc, s->time/1000.0f);
|
||||||
if (s->scale_loc >= 0) glUniform1f(s->scale_loc, s->scale);
|
if (s->scale_loc >= 0) glUniform1f(s->scale_loc, s->scale);
|
||||||
#undef COL
|
#undef COL
|
||||||
glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
|
glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
|
||||||
|
|
|
@ -37,6 +37,7 @@ struct decal_shader
|
||||||
float scale;
|
float scale;
|
||||||
float smoothing;
|
float smoothing;
|
||||||
float outline_dist;
|
float outline_dist;
|
||||||
|
uint32_t time;
|
||||||
|
|
||||||
// GL object handles
|
// GL object handles
|
||||||
GLuint prog, vao, vbo, ebo;
|
GLuint prog, vao, vbo, ebo;
|
||||||
|
|
Loading…
Reference in New Issue