-
Notifications
You must be signed in to change notification settings - Fork 6
genre_bg
The GenreBG class renders the coloured horizontal bar that fills the song-select background when a folder is open. It displays the folder's genre name in a title tab at the centre of the screen and handles three distinct visual phases: an entry animation, a steady-state fill that tracks the visible box range, and an exit animation that sweeps the bar toward the centre before fading out. Used by navigator.
GenreBG(string& text_name, optional<ray::Color> color, TextureIndex texture_index, float distance);| Parameter | Description |
|---|---|
text_name |
The folder/genre name displayed in the title tab. Font size is reduced automatically for long strings. |
color |
Optional tint colour. When present, a colour-transform shader is loaded to recolour the bar texture. |
texture_index |
Selects the genre-specific frame from the background texture atlas. |
distance |
How far the bar slides in from the edge during the entry animation (clamped to screen width). |
On construction all entry animations are started immediately.
| Member | Type | Description |
|---|---|---|
shader |
ray::Shader |
Colour-transform shader; only loaded when color is provided |
shader_loaded |
bool |
Whether the shader is active |
name |
unique_ptr<OutlinedText> |
Outlined text for the genre/folder name shown in the title tab |
texture_index |
TextureIndex |
Frame index into the background texture atlas |
stretch |
MoveAnimation* |
Controls the vertical stretch of the bar during entry (cubic ease) |
scale |
TextureResizeAnimation* |
Scales the bar from 0.9× to 1.0× during entry |
move |
MoveAnimation* |
Slides the bar's right edge inward from distance to its resting position |
fade |
FadeAnimation* |
Controls overall opacity; reused for entry fade-in and exit fade-out |
move_left |
MoveAnimation* |
Created during exit: slides the bar's left edge toward centre |
move_right |
MoveAnimation* |
Created during exit: slides the bar's right edge toward centre |
void update(double current_ms, FolderBox* box);Advances all active animations. Also calls box->update() if box is not null, keeping the centre folder box in sync during transitions.
void draw(float start_position, float end_position, FolderBox* folder);Selects the correct draw path based on the current animation phase:
-
Entry (
!is_finished()): callsdraw_anim()— the bar scales and slides in around thefolderbox. -
Exit (
!is_complete()): callsdraw_exit_anim()— the two bar halves sweep toward the centre. -
Steady state: draws the bar spanning
[start_position, end_position], handling the wrap-around case wherestart_position > end_position. Draws the title tab at screen centre only when centre is covered by the bar.
The colour-transform shader is applied (BeginShaderMode/EndShaderMode) around all background texture draws when shader_loaded is true.
void exit(float left_position, float right_position, FolderBox* center_box);Begins the exit animation. Creates move_left and move_right to sweep the bar's edges toward the centre (x≈442 and x≈835 in unscaled coordinates). Replaces fade with a new fade-out that starts after the sweep completes. Also calls center_box->exit_box() and schedules a fade_in on it so the folder box becomes visible as the bar closes.
void fade_out();
void fade_in();Replace fade with a 300 ms fade-out or fade-in animation and start it immediately. Used when the navigator switches between genres without a full exit/entry cycle.
bool is_finished();Returns true when the entry move animation has completed — i.e. the bar has fully expanded and is now in steady state.
bool is_complete();Returns true when both move_left and move_right have finished — i.e. the exit animation is done. Returns true immediately if no exit has been started.
void draw_anim(FolderBox* box);Draws the bar in its animated entry form centred on the box, applying the current scale and stretch values. Draws left edge, centre fill, and right edge textures, plus the title tab.
void draw_exit_anim(float start_position, float end_position, FolderBox* folder);Draws the bar using the positions from move_left->attribute and move_right->attribute, then calls folder->draw(false) to render the folder box at its current state during the sweep.
Building
libs
- animation
- audio
- config
- filesystem
- global_data
- input
- logging
- ray
- scores
- screen
- script
- song_parser
- text
- texture
- video
- webcam
libs/parsers
objects
objects/game
- player
- background
- gauge
- judgment
- combo
- branch_indicator
- ending_animations
- gogo_time
- fireworks
- song_info
- transition
- result_transition
- judge_counter
- score_counter
- score_counter_animation
- balloon_counter
- drumroll_counter
- kusudama_counter
- drum_hit_effect
- lane_hit_effect
- gauge_hit_effect
- combo_announce
- note_arc
objects/global
objects/title
objects/entry
objects/settings
objects/result
objects/song_select
- player
- navigator
- box_base
- box_song
- box_folder
- neiro
- modifier
- ura_switch
- diff_sort
- search_box
- dan_transition
- genre_bg
- score_history
- song_select_script
scenes