mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
This commit is contained in:
parent
9bf9d5e653
commit
f7b2accd52
|
@ -111,6 +111,8 @@ bool gfx_init()
|
|||
dbg_msg("game", "failed to create gl context");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Init vertices
|
||||
if (g_pVertices)
|
||||
mem_free(g_pVertices);
|
||||
|
@ -160,6 +162,9 @@ bool gfx_init()
|
|||
// create null texture, will get id=0
|
||||
gfx_load_texture_raw(4,4,IMG_RGBA,null_texture_data);
|
||||
|
||||
// set vsync as needed
|
||||
gfx_set_vsync(config.vsync);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -168,6 +173,11 @@ int gfx_get_video_modes(video_mode *list, int maxcount)
|
|||
return context.getvideomodes((opengl::videomode *)list, maxcount);
|
||||
}
|
||||
|
||||
void gfx_set_vsync(int val)
|
||||
{
|
||||
context.set_vsync(val);
|
||||
}
|
||||
|
||||
int gfx_unload_texture(int index)
|
||||
{
|
||||
textures[index].tex.clear();
|
||||
|
|
|
@ -4,6 +4,7 @@ MACRO_CONFIG_INT(screen_width, 800, 0, 0)
|
|||
MACRO_CONFIG_INT(screen_height, 600, 0, 0)
|
||||
MACRO_CONFIG_INT(fullscreen, 1, 0, 1)
|
||||
MACRO_CONFIG_INT(color_depth, 24, 16, 24)
|
||||
MACRO_CONFIG_INT(vsync, 1, 0, 1)
|
||||
MACRO_CONFIG_INT(volume, 200, 0, 255)
|
||||
MACRO_CONFIG_STR(player_name, 32, "nameless tee")
|
||||
MACRO_CONFIG_STR(clan_name, 32, "")
|
||||
|
|
|
@ -62,6 +62,7 @@ void gfx_shutdown(); // NOT EXPOSED
|
|||
void gfx_swap(); // NOT EXPOSED
|
||||
|
||||
int gfx_get_video_modes(video_mode *list, int maxcount);
|
||||
void gfx_set_vsync(int val);
|
||||
|
||||
// textures
|
||||
/*
|
||||
|
|
|
@ -311,7 +311,6 @@ struct server_list
|
|||
int selected_index;
|
||||
};
|
||||
|
||||
|
||||
int ui_do_key_reader(void *id, float x, float y, float w, float h, int key)
|
||||
{
|
||||
// process
|
||||
|
@ -704,13 +703,6 @@ static int main_render()
|
|||
|
||||
if (!inited)
|
||||
{
|
||||
/*
|
||||
list.info_count = 256;
|
||||
|
||||
list.scroll_index = 0;
|
||||
list.selected_index = -1;
|
||||
*/
|
||||
|
||||
inited = true;
|
||||
|
||||
client_serverbrowse_refresh();
|
||||
|
@ -737,11 +729,11 @@ static int main_render()
|
|||
if (ui_do_button(&refresh_button, "Refresh", 0, 20, 420, 170, 48, draw_teewars_button))
|
||||
client_serverbrowse_refresh();
|
||||
|
||||
if (selected_index == -1)
|
||||
/*if (selected_index == -1)
|
||||
{
|
||||
ui_do_button(&join_button, "Join", 0, 620, 420, 128, 48, draw_teewars_button, (void *)1);
|
||||
}
|
||||
else if (ui_do_button(&join_button, "Join", 0, 620, 420, 128, 48, draw_teewars_button))
|
||||
else */if (ui_do_button(&join_button, "Join", 0, 620, 420, 128, 48, draw_teewars_button))
|
||||
{
|
||||
client_connect(address);
|
||||
|
||||
|
@ -758,9 +750,9 @@ static int main_render()
|
|||
screen = SCREEN_SETTINGS_GENERAL;
|
||||
}
|
||||
|
||||
//static int editor_button;
|
||||
//if (ui_do_button(&editor_button, "Kerning Editor", 0, 20, 470, 170, 48, draw_teewars_button))
|
||||
// screen = SCREEN_KERNING;
|
||||
/*static int editor_button;
|
||||
if (ui_do_button(&editor_button, "Kerning Editor", 0, 20, 470, 170, 48, draw_teewars_button))
|
||||
screen = SCREEN_KERNING;*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -840,7 +832,7 @@ static int settings_video_render()
|
|||
{
|
||||
for (int i = 0; i < resolution_count[depth_index]; i++)
|
||||
{
|
||||
if (config_copy.screen_width == resolutions[depth_index][i][0])
|
||||
if (config_copy.screen_width == resolutions[depth_index][i][0] && config_copy.screen_height == resolutions[depth_index][i][1])
|
||||
{
|
||||
selected_index = i;
|
||||
break;
|
||||
|
@ -858,7 +850,10 @@ static int settings_video_render()
|
|||
};
|
||||
|
||||
// we need to draw these bottom up, to make overlapping work correctly
|
||||
ui_do_label(column1_x, row3_y + 50, "(A restart of the game is required for these settings to take effect.)", 20);
|
||||
ui_do_label(column1_x, row4_y + 50, "(A restart of the game is required for these settings to take effect.)", 20);
|
||||
|
||||
ui_do_label(column1_x, row4_y, "V-sync:", 36);
|
||||
config_set_vsync(&config_copy, ui_do_check_box(&config_copy.vsync, column2_x, row4_y + 5, 32, 32, config_copy.vsync));
|
||||
|
||||
ui_do_label(column1_x, row3_y, "Fullscreen:", 36);
|
||||
config_set_fullscreen(&config_copy, ui_do_check_box(&config_copy.fullscreen, column2_x, row3_y + 5, 32, 32, config_copy.fullscreen));
|
||||
|
|
Loading…
Reference in a new issue