Skip to content

Add loading screen #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 24, 2024
Merged

Add loading screen #158

merged 12 commits into from
May 24, 2024

Conversation

Totto16
Copy link
Collaborator

@Totto16 Totto16 commented May 24, 2024

This adds a loading screen (since initializing the joysticks takes longer than 500 ms)

It is kept simple:
image

Totto16 added 5 commits May 24, 2024 03:02
- refactor the functionality which takes the most time, namely initializing joysticks (input manager), now it does nothing in the constructor, but we call the initialization later, while showing the loading screen, this is needed, since some thing need to be initialized, for the loading screent o work
- use SDL_GetTicks64 instead of SDL_GetTicks
- show the loading screen in the application
…y but it's the easiest way to do the job, and the loading screen shoudln't take ages, so it likely want be cancelled all the time
- make the animation better looking
- fix the drawing by using correct parameters for the render_mino function
- reset the background each frame, by overdrawing it
@Totto16 Totto16 added the enhancement New feature or request label May 24, 2024
@Totto16 Totto16 added this to the 0.5.7 milestone May 24, 2024
Copy link

github-actions bot commented May 24, 2024

badge

Code Coverage Summary

Filename                                                 Stmts    Miss  Cover    Missing
-----------------------------------------------------  -------  ------  -------  ------------------------------------------------------------------------
src/application.cpp                                        208     208  0.00%    29-397
src/application.hpp                                         33      33  0.00%    65-127
src/discord/core.cpp                                       102     102  0.00%    12-181
src/discord/core.hpp                                         6       6  0.00%    61-70
src/game/bag.cpp                                            22      22  0.00%    3-33
src/game/bag.hpp                                             2       2  0.00%    15-16
src/game/game.cpp                                           61      61  0.00%    7-106
src/game/game.hpp                                            0       0  100.00%
src/game/graphic_helpers.cpp                                41      41  0.00%    11-93
src/game/grid.cpp                                           73      73  0.00%    6-112
src/game/grid.hpp                                            0       0  100.00%
src/game/mino.cpp                                           10      10  0.00%    3-20
src/game/mino.hpp                                            1       1  0.00%    19
src/game/mino_stack.cpp                                     55      55  0.00%    7-86
src/game/mino_stack.hpp                                      0       0  100.00%
src/game/rotation.cpp                                       23      23  0.00%    5-37
src/game/tetrion.cpp                                       413     413  0.00%    18-651
src/game/tetrion.hpp                                         7       7  0.00%    123-129
src/game/tetromino.cpp                                      44      44  0.00%    5-75
src/game/tetromino.hpp                                       5       5  0.00%    18-29
src/game/tetromino_type.cpp                                 22      22  0.00%    5-45
src/graphics/point.hpp                                      24      24  0.00%    17-93
src/graphics/rect.hpp                                       23      23  0.00%    16-55
src/graphics/renderer.cpp                                   72      72  0.00%    6-123
src/graphics/renderer.hpp                                   30      30  0.00%    33-77
src/graphics/sdl_context.cpp                                14      14  0.00%    18-53
src/graphics/text.cpp                                       11      11  0.00%    6-25
src/graphics/text.hpp                                        0       0  100.00%
src/graphics/texture.cpp                                    71      71  0.00%    7-118
src/graphics/texture.hpp                                     9       9  0.00%    50-60
src/graphics/window.cpp                                     41      41  0.00%    6-62
src/helper/bool_wrapper.hpp                                  9       9  0.00%    14-34
src/helper/clock_source.cpp                                 28      28  0.00%    8-47
src/helper/clock_source.hpp                                  7       7  0.00%    9-24
src/helper/color.cpp                                        85      35  58.82%   11-31, 38-53, 61, 75, 145-156, 161-164
src/helper/color.hpp                                        94      85  9.57%    28-58, 80-108, 147-254
src/helper/color_literals.hpp                              320      30  90.62%   412, 582, 647-694, 708-711
src/helper/command_line_arguments.hpp                       38      38  0.00%    21-77
src/helper/const_utils.hpp                                  17       1  94.12%   72
src/helper/date.cpp                                         46      46  0.00%    9-113
src/helper/errors.cpp                                       27      27  0.00%    3-44
src/helper/errors.hpp                                        0       0  100.00%
src/helper/git_helper.hpp                                    2       2  0.00%    7-11
src/helper/graphic_utils.cpp                                16      16  0.00%    4-95
src/helper/message_box.cpp                                   7       7  0.00%    7-22
src/helper/music_utils.hpp                                   4       4  0.00%    9-30
src/helper/nfd.cpp                                         108     108  0.00%    21-196
src/helper/nfd_include.hpp                                   1       1  0.00%    23
src/helper/parse_json.cpp                                   23      23  0.00%    6-55
src/helper/parse_json.hpp                                   35      35  0.00%    26-87
src/helper/platform.cpp                                     12      12  0.00%    16-98
src/helper/platform.hpp                                      4       4  0.00%    14-36
src/helper/random.cpp                                       13      13  0.00%    4-24
src/helper/random.hpp                                        4       4  0.00%    21-24
src/helper/sleep.cpp                                        15      15  0.00%    20-71
src/helper/static_string.hpp                                30      30  0.00%    16-128
src/helper/string_manipulation.cpp                          41       7  82.93%   16-23
src/helper/timer.hpp                                        21      21  0.00%    16-49
src/helper/utils.hpp                                        19      19  0.00%    45-122
src/input/controller_input.cpp                             159     159  0.00%    12-325
src/input/controller_input.hpp                              52      52  0.00%    55-162
src/input/game_input.cpp                                    66      66  0.00%    8-99
src/input/game_input.hpp                                    16      16  0.00%    51-99
src/input/guid.cpp                                          17      17  0.00%    8-39
src/input/guid.hpp                                          46      46  0.00%    32-135
src/input/input.cpp                                        199     199  0.00%    20-401
src/input/input_creator.cpp                                 72      72  0.00%    18-149
src/input/input_creator.hpp                                  6       6  0.00%    20-31
src/input/input.hpp                                          9       9  0.00%    119-133
src/input/joystick_input.cpp                               201     201  0.00%    18-963
src/input/joystick_input.hpp                                74      74  0.00%    32-438
src/input/keyboard_input.cpp                               126     126  0.00%    8-221
src/input/keyboard_input.hpp                                53      53  0.00%    43-158
src/input/mouse_input.cpp                                   31      31  0.00%    9-70
src/input/mouse_input.hpp                                    0       0  100.00%
src/input/replay_input.cpp                                  53      53  0.00%    6-98
src/input/replay_input.hpp                                   0       0  100.00%
src/input/touch_input.cpp                                  173     173  0.00%    13-344
src/input/touch_input.hpp                                   57      57  0.00%    50-214
src/lobby/api.hpp                                           25      25  0.00%    143-235
src/manager/event_dispatcher.hpp                            71      71  0.00%    15-120
src/manager/event_listener.hpp                               8       8  0.00%    6-19
src/manager/font.cpp                                        12      12  0.00%    5-18
src/manager/font.hpp                                         4       4  0.00%    13-26
src/manager/music_manager.cpp                              216     216  0.00%    17-380
src/manager/music_manager.hpp                               12      12  0.00%    58-75
src/manager/resource_manager.hpp                             8       8  0.00%    18-37
src/manager/sdl_controller_key.cpp                          18      18  0.00%    5-34
src/manager/sdl_controller_key.hpp                           3       3  0.00%    32-34
src/manager/sdl_key.cpp                                    210      30  85.71%   26, 74, 153-155, 204-210, 221, 229, 287, 312, 367, 384, 394-413, 423-424
src/manager/sdl_key.hpp                                      3       3  0.00%    91-93
src/manager/service_provider.hpp                             2       2  0.00%    32-37
src/manager/settings_manager.cpp                            29      29  0.00%    9-54
src/manager/settings_manager.hpp                            35      35  0.00%    19-76
src/recordings/additional_information.cpp                  320     320  0.00%    9-544
src/recordings/additional_information.hpp                   23      23  0.00%    32-166
src/recordings/checksum_helper.cpp                          10      10  0.00%    5-21
src/recordings/checksum_helper.hpp                          13      13  0.00%    21-47
src/recordings/helper.hpp                                   81      81  0.00%    33-177
src/recordings/recording.cpp                                21      21  0.00%    6-47
src/recordings/recording.hpp                                 4       4  0.00%    48-57
src/recordings/recording_reader.cpp                        148     148  0.00%    10-279
src/recordings/recording_reader.hpp                          0       0  100.00%
src/recordings/recording_writer.cpp                         83      83  0.00%    4-172
src/recordings/recording_writer.hpp                          6       6  0.00%    52-59
src/recordings/tetrion_core_information.hpp                  6       6  0.00%    13-24
src/recordings/tetrion_snapshot.cpp                        100     100  0.00%    12-201
src/recordings/tetrion_snapshot.hpp                          0       0  100.00%
src/scenes/scene.cpp                                        18      18  0.00%    17-60
src/scenes/scene.hpp                                        13      13  0.00%    25-74
src/scenes/about_page/about_page.cpp                        57      57  0.00%    16-118
src/scenes/about_page/about_page.hpp                         0       0  100.00%
src/scenes/loading_screen/loading_screen.cpp                68      68  0.00%    15-126
src/scenes/loading_screen/loading_screen.hpp                 0       0  100.00%
src/scenes/logo/logo.cpp                                    25      25  0.00%    11-147
src/scenes/main_menu/main_menu.cpp                          95      95  0.00%    12-165
src/scenes/main_menu/main_menu.hpp                           0       0  100.00%
src/scenes/multiplayer_menu/multiplayer_menu.cpp            74      74  0.00%    12-134
src/scenes/multiplayer_menu/multiplayer_menu.hpp             0       0  100.00%
src/scenes/online_lobby/online_lobby.cpp                    89      89  0.00%    16-161
src/scenes/online_lobby/online_lobby.hpp                     0       0  100.00%
src/scenes/play_select_menu/play_select_menu.cpp            74      74  0.00%    11-129
src/scenes/play_select_menu/play_select_menu.hpp             0       0  100.00%
src/scenes/recording_selector/recording_chooser.cpp         75      75  0.00%    13-137
src/scenes/recording_selector/recording_chooser.hpp          0       0  100.00%
src/scenes/recording_selector/recording_component.cpp       93      93  0.00%    13-162
src/scenes/recording_selector/recording_component.hpp        1       1  0.00%    21
src/scenes/recording_selector/recording_selector.cpp       129     129  0.00%    29-232
src/scenes/recording_selector/recording_selector.hpp         2       2  0.00%    23-25
src/scenes/replay_game/replay_game.cpp                      74      74  0.00%    12-154
src/scenes/replay_game/replay_game.hpp                       0       0  100.00%
src/scenes/settings_menu/color_setting_row.cpp             123     123  0.00%    15-235
src/scenes/settings_menu/color_setting_row.hpp               0       0  100.00%
src/scenes/settings_menu/settings_details.hpp                1       1  0.00%    11
src/scenes/settings_menu/settings_menu.cpp                 112     112  0.00%    20-197
src/scenes/settings_menu/settings_menu.hpp                   2       2  0.00%    23-25
src/scenes/single_player_game/game_over.cpp                 26      26  0.00%    13-64
src/scenes/single_player_game/game_over.hpp                  0       0  100.00%
src/scenes/single_player_game/pause.cpp                     36      36  0.00%    11-63
src/scenes/single_player_game/pause.hpp                      0       0  100.00%
src/scenes/single_player_game/single_player_game.cpp        71      71  0.00%    17-135
src/scenes/single_player_game/single_player_game.hpp         0       0  100.00%
src/thirdparty/hash-library/sha256.cpp                     417     417  0.00%    40-604
src/ui/focusable.hpp                                        26      26  0.00%    14-65
src/ui/hoverable.hpp                                        28      28  0.00%    16-78
src/ui/layout.cpp                                           30      30  0.00%    5-62
src/ui/layout.hpp                                           38      38  0.00%    20-143
src/ui/widget.cpp                                            4       4  0.00%    6-11
src/ui/widget.hpp                                           12      12  0.00%    29-56
src/ui/components/abstract_slider.hpp                      115     115  0.00%    28-219
src/ui/components/button.hpp                                54      54  0.00%    29-130
src/ui/components/color_picker.cpp                         317     317  0.00%    17-565
src/ui/components/color_picker.hpp                           0       0  100.00%
src/ui/components/image_button.cpp                          12      12  0.00%    5-27
src/ui/components/image_button.hpp                           0       0  100.00%
src/ui/components/image_view.cpp                            16      16  0.00%    5-34
src/ui/components/image_view.hpp                             0       0  100.00%
src/ui/components/label.cpp                                 15      15  0.00%    6-36
src/ui/components/label.hpp                                  0       0  100.00%
src/ui/components/link_label.cpp                            43      43  0.00%    6-81
src/ui/components/link_label.hpp                             0       0  100.00%
src/ui/components/slider.cpp                                39      39  0.00%    7-75
src/ui/components/slider.hpp                                 0       0  100.00%
src/ui/components/text_button.cpp                           33      33  0.00%    5-65
src/ui/components/text_button.hpp                            0       0  100.00%
src/ui/components/textinput.cpp                            248     248  0.00%    13-441
src/ui/layouts/focus_layout.cpp                            147     147  0.00%    10-261
src/ui/layouts/focus_layout.hpp                             28      28  0.00%    40-97
src/ui/layouts/grid_layout.cpp                              63      63  0.00%    5-100
src/ui/layouts/grid_layout.hpp                               0       0  100.00%
src/ui/layouts/scroll_layout.cpp                           197     197  0.00%    6-329
src/ui/layouts/scroll_layout.hpp                            13      13  0.00%    72-90
src/ui/layouts/tile_layout.cpp                              62      62  0.00%    5-92
src/ui/layouts/tile_layout.hpp                               9       9  0.00%    31-49
TOTAL                                                     8554    7975  6.77%

Results for commit: e9f91c7

Minimum allowed coverage is 0%

♻️ This comment has been updated with latest results

@Totto16 Totto16 force-pushed the add-loading-screen branch from 9b4b2f7 to e9f91c7 Compare May 24, 2024 16:34
@Totto16 Totto16 merged commit 44dd620 into main May 24, 2024
18 checks passed
@Totto16 Totto16 deleted the add-loading-screen branch May 24, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant