mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-24 21:02:14 +00:00
MENU: More dynamic background changing
This commit is contained in:
parent
a150787339
commit
e3c5771604
3 changed files with 26 additions and 2 deletions
|
@ -6,6 +6,7 @@ float music_duration_time;
|
|||
|
||||
string menu_background;
|
||||
float menu_changetime;
|
||||
float menu_starttime;
|
||||
|
||||
|
||||
float current_menu;
|
||||
|
|
|
@ -443,9 +443,31 @@ void() Menu_DrawBackground =
|
|||
|
||||
#ifdef MENU
|
||||
|
||||
sui_pic([0, 0], sui_current_frame_size(), menu_background, [1, 1, 1], 1, 1);
|
||||
float elapsed_background_time = time - menu_starttime;
|
||||
|
||||
//
|
||||
// Slight background pan
|
||||
//
|
||||
float x_pos = 0 - (((sui_current_frame_size()[0] * 1.05) - sui_current_frame_size()[0]) * (elapsed_background_time/7));
|
||||
|
||||
sui_pic([x_pos, 0], [sui_current_frame_size()[0] * 1.05, sui_current_frame_size()[1]], menu_background, [1, 1, 1], 1, 1);
|
||||
sui_fill([0, 0], sui_current_frame_size(), [0, 0, 0], 0.7, 0);
|
||||
|
||||
//
|
||||
// Fade new images in/out
|
||||
//
|
||||
float alpha = 0;
|
||||
|
||||
if (elapsed_background_time < 1.0) {
|
||||
alpha = 1.0f - sin((elapsed_background_time / 1.0f) * (M_PI / 2)); // Opacity from 1 -> 0
|
||||
} else if (elapsed_background_time < 6.0f) {
|
||||
alpha = 0.0f;
|
||||
} else if (elapsed_background_time < 7.0f) {
|
||||
alpha = sin(((elapsed_background_time - 6.0f) / 1.0f) * (M_PI / 2)); // Opacity from 0 -> 1
|
||||
}
|
||||
|
||||
sui_fill([0, 0], sui_current_frame_size(), [0, 0, 0], alpha, 0);
|
||||
|
||||
#else
|
||||
|
||||
sui_fill([0, 0], sui_current_frame_size(), [0, 0, 0], 0.8, 0);
|
||||
|
|
|
@ -230,7 +230,8 @@ void(vector screensize) m_draw =
|
|||
// Menu Background Changing
|
||||
if (time > menu_changetime) {
|
||||
menu_background = Menu_PickBackground();
|
||||
menu_changetime = time + 5;
|
||||
menu_changetime = time + 7;
|
||||
menu_starttime = time;
|
||||
}
|
||||
|
||||
sui_begin(screensize_x, screensize_y);
|
||||
|
|
Loading…
Reference in a new issue