Skip to content

Commit

Permalink
Added full screen mode (ability to hide the top bar)
Browse files Browse the repository at this point in the history
  • Loading branch information
windows-server-2003 committed Sep 3, 2021
1 parent a57b40a commit c742c36
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions include/variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern bool var_high_resolution_mode;
extern bool var_use_experimental_sslc;
extern bool var_use_experimental_sslc_changed;
extern bool var_show_fps;
extern bool var_full_screen_mode;
extern u8 var_wifi_state;
extern u8 var_wifi_signal;
extern u8 var_battery_charge;
Expand Down
1 change: 1 addition & 0 deletions romfs/gfx/msg/string_resources_en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<TIME_TO_TURN_OFF_LCD>Time to turn off the LCD</TIME_TO_TURN_OFF_LCD>
<NEVER_TURN_OFF>Never turn off</NEVER_TURN_OFF>
<ECO_MODE>Eco mode</ECO_MODE>
<FULL_SCREEN_MODE>Full screen mode</FULL_SCREEN_MODE>
<DARK_THEME>Dark theme</DARK_THEME>
<FLASH>Flash</FLASH>
<USE_EXPERIMENTAL_SSLC>Use experimental sslc</USE_EXPERIMENTAL_SSLC>
Expand Down
1 change: 1 addition & 0 deletions romfs/gfx/msg/string_resources_ja.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<TIME_TO_TURN_OFF_LCD>画面自動オフまでの時間</TIME_TO_TURN_OFF_LCD>
<NEVER_TURN_OFF>自動オフしない</NEVER_TURN_OFF>
<ECO_MODE>エコモード</ECO_MODE>
<FULL_SCREEN_MODE>フルスクリーンモード</FULL_SCREEN_MODE>
<DARK_THEME>ダークモード</DARK_THEME>
<FLASH>点滅</FLASH>
<USE_EXPERIMENTAL_SSLC>試験的なsslcを使用</USE_EXPERIMENTAL_SSLC>
Expand Down
13 changes: 13 additions & 0 deletions source/scenes/setting_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@ void Sem_init(void)
save_settings_request = true;
}
}),
// Eco mode
(new SelectorView(0, 0, 320, 35))
->set_texts({
(std::function<std::string ()>) []() { return LOCALIZED(OFF); },
(std::function<std::string ()>) []() { return LOCALIZED(ON); }
}, var_full_screen_mode)
->set_title([](const SelectorView &) { return LOCALIZED(FULL_SCREEN_MODE); })
->set_on_change([](const SelectorView &view) {
if (var_full_screen_mode != view.selected_button) {
var_full_screen_mode = view.selected_button;
save_settings_request = true;
}
}),
// Dark theme (plus flash)
(new SelectorView(0, 0, 320, 35))
->set_texts({
Expand Down
17 changes: 8 additions & 9 deletions source/scenes/video_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,14 +853,6 @@ static void decode_thread(void* arg)
vid_width += 16 - vid_width % 16;
if(vid_height % 16 != 0)
vid_height += 16 - vid_height % 16;

//fit to screen size
while(((vid_width * vid_zoom) > 400 || (vid_height * vid_zoom) > 225) && vid_zoom > 0.05)
vid_zoom -= 0.001;

vid_x = (400 - (vid_width * vid_zoom)) / 2;
vid_y = (225 - (vid_height * vid_zoom)) / 2;
vid_y += 15;
}
}

Expand Down Expand Up @@ -1562,6 +1554,13 @@ Intent VideoPlayer_draw(void)

thumbnail_set_active_scene(SceneType::VIDEO_PLAYER);

//fit to screen size
vid_zoom = std::min(400.0 / vid_width, (var_full_screen_mode ? 240.0 : 225.0) / vid_height);
vid_zoom = std::min(10.0, std::max(0.05, vid_zoom));
vid_x = (400 - (vid_width * vid_zoom)) / 2;
vid_y = ((var_full_screen_mode ? 240 : 225) - (vid_height * vid_zoom)) / 2;
if (!var_full_screen_mode) vid_y += 15;

bool video_playing_bar_show = video_is_playing();

if(var_need_reflesh || !var_eco_mode)
Expand All @@ -1587,7 +1586,7 @@ Intent VideoPlayer_draw(void)
if(Util_log_query_log_show_flag())
Util_log_draw();

Draw_top_ui();
if (!var_full_screen_mode || !network_decoder.ready) Draw_top_ui();
caption_overlay_view->cur_timestamp = vid_current_pos;
caption_overlay_view->draw();

Expand Down
2 changes: 2 additions & 0 deletions source/system/util/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void load_settings() {
var_time_to_turn_off_lcd = load_int("time_to_turn_off_lcd", 150);
if (var_time_to_turn_off_lcd < 10) var_time_to_turn_off_lcd = 150;
var_eco_mode = load_int("eco_mode", 1);
var_full_screen_mode = load_int("full_screen_mode", 0);
var_night_mode = load_int("dark_theme", 0);
var_flash_mode = load_int("dark_theme_flash", 0);
var_use_experimental_sslc = var_use_experimental_sslc_changed = load_int("use_experimental_sslc", 0);
Expand All @@ -46,6 +47,7 @@ void save_settings() {
"<lcd_brightness>" + std::to_string(var_lcd_brightness) + "</lcd_brightness>\n" +
"<time_to_turn_off_lcd>" + std::to_string(var_time_to_turn_off_lcd) + "</time_to_turn_off_lcd>\n" +
"<eco_mode>" + std::to_string(var_eco_mode) + "</eco_mode>\n" +
"<full_screen_mode>" + std::to_string(var_full_screen_mode) + "</full_screen_mode>\n" +
"<dark_theme>" + std::to_string(var_night_mode) + "</dark_theme>\n" +
"<dark_theme_flash>" + std::to_string(var_flash_mode) + "</dark_theme_flash>\n" +
"<use_experimental_sslc>" + std::to_string(var_use_experimental_sslc_changed) + "</use_experimental_sslc>\n";
Expand Down
1 change: 1 addition & 0 deletions source/variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ bool var_high_resolution_mode = true;
bool var_use_experimental_sslc = true;
bool var_use_experimental_sslc_changed = true;
bool var_show_fps = false;
bool var_full_screen_mode = false;
u8 var_wifi_state = 0;
u8 var_wifi_signal = 0;
u8 var_battery_charge = 0;
Expand Down

0 comments on commit c742c36

Please sign in to comment.