summaryrefslogtreecommitdiff
path: root/src/settings.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik.ramaekers@protonmail.com>2020-06-22 17:40:30 +0200
committerAldrik Ramaekers <aldrik.ramaekers@protonmail.com>2020-06-22 17:40:30 +0200
commitfee6c2364e8d22c41b53db90ace721cbe945f0af (patch)
treec0d7e5e82e73f926215fe0ba1ee30a6e0288a162 /src/settings.c
parent52d15199a4f2781f285d84fd78b71bbc23b85468 (diff)
cpu rendering
Diffstat (limited to 'src/settings.c')
-rw-r--r--src/settings.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/settings.c b/src/settings.c
index 118dca7..79b1a95 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -9,11 +9,10 @@ void set_status_text_to_finished_search();
void settings_page_create()
{
+ global_settings_page.use_gpu = global_use_gpu;
global_settings_page.active = false;
- global_settings_page.font_small = assets_load_font(_binary____data_fonts_mono_ttf_start,
- _binary____data_fonts_mono_ttf_end, 16);
- global_settings_page.logo_img = assets_load_image(_binary____data_imgs_logo_64_png_start,
- _binary____data_imgs_logo_64_png_end, true);
+ global_settings_page.font_small = load_font(mono_ttf, 15);
+ global_settings_page.logo_img = load_bitmap(logo_64_bmp);
global_settings_page.keyboard = keyboard_input_create();
global_settings_page.mouse = mouse_input_create();
@@ -24,6 +23,7 @@ void settings_page_create()
global_settings_page.camera = cam;
+ global_settings_page.cb_use_gpu = ui_create_checkbox(global_use_gpu);
global_settings_page.btn_close = ui_create_button();
global_settings_page.btn_save = ui_create_button();
global_settings_page.dropdown_language = ui_create_dropdown();
@@ -35,11 +35,24 @@ void settings_page_create()
static void load_current_settings_into_ui()
{
-
+ global_settings_page.use_gpu = global_use_gpu;
+ global_settings_page.cb_use_gpu.state = global_settings_page.use_gpu;
}
void settings_page_update_render()
{
+ if (global_settings_page.window.has_focus)
+ global_settings_page.window.do_draw = true;
+
+ // switch to cpu/gpu
+ if (global_use_gpu != global_settings_page.use_gpu)
+ {
+ global_use_gpu = global_settings_page.use_gpu;
+ platform_setup_backbuffer(main_window);
+ platform_setup_renderer();
+ assets_switch_render_method();
+ }
+
if (global_settings_page.active)
{
platform_window_make_current(&global_settings_page.window);
@@ -50,7 +63,7 @@ void settings_page_update_render()
{
global_settings_page.window.do_draw = false;
- render_clear();
+ render_clear(&global_settings_page.window);
camera_apply_transformations(&global_settings_page.window, &global_settings_page.camera);
@@ -99,6 +112,14 @@ void settings_page_update_render()
ui_block_begin(LAYOUT_HORIZONTAL);
{
+ if (ui_push_checkbox(&global_settings_page.cb_use_gpu, localize("use_gpu")))
+ {
+ }
+ }
+ ui_block_end();
+
+ ui_block_begin(LAYOUT_HORIZONTAL);
+ {
if (ui_push_hypertext_link(localize("copy_config_path")))
{
char buffer[PATH_MAX];
@@ -122,6 +143,7 @@ void settings_page_update_render()
if (ui_push_button(&global_settings_page.btn_close, localize("save")))
{
global_settings_page.active = false;
+ global_settings_page.use_gpu = global_settings_page.cb_use_gpu.state;
settings_page_hide();
return;
}
@@ -157,7 +179,7 @@ void settings_page_show()
load_current_settings_into_ui();
global_settings_page.window = platform_open_window(localize("mo_edit_settings"),
- 350, 220, 350, 220, 350, 220);
+ 350, 240, 350, 240, 350, 240);
settings_window = &global_settings_page.window;