This commit is contained in:
Jakob Fries 2007-07-22 13:42:28 +00:00
parent 9bf9d5e653
commit f7b2accd52
4 changed files with 22 additions and 15 deletions

View file

@ -111,6 +111,8 @@ bool gfx_init()
dbg_msg("game", "failed to create gl context"); dbg_msg("game", "failed to create gl context");
return false; return false;
} }
// Init vertices // Init vertices
if (g_pVertices) if (g_pVertices)
mem_free(g_pVertices); mem_free(g_pVertices);
@ -160,6 +162,9 @@ bool gfx_init()
// create null texture, will get id=0 // create null texture, will get id=0
gfx_load_texture_raw(4,4,IMG_RGBA,null_texture_data); gfx_load_texture_raw(4,4,IMG_RGBA,null_texture_data);
// set vsync as needed
gfx_set_vsync(config.vsync);
return true; return true;
} }
@ -168,6 +173,11 @@ int gfx_get_video_modes(video_mode *list, int maxcount)
return context.getvideomodes((opengl::videomode *)list, maxcount); return context.getvideomodes((opengl::videomode *)list, maxcount);
} }
void gfx_set_vsync(int val)
{
context.set_vsync(val);
}
int gfx_unload_texture(int index) int gfx_unload_texture(int index)
{ {
textures[index].tex.clear(); textures[index].tex.clear();

View file

@ -4,6 +4,7 @@ MACRO_CONFIG_INT(screen_width, 800, 0, 0)
MACRO_CONFIG_INT(screen_height, 600, 0, 0) MACRO_CONFIG_INT(screen_height, 600, 0, 0)
MACRO_CONFIG_INT(fullscreen, 1, 0, 1) MACRO_CONFIG_INT(fullscreen, 1, 0, 1)
MACRO_CONFIG_INT(color_depth, 24, 16, 24) MACRO_CONFIG_INT(color_depth, 24, 16, 24)
MACRO_CONFIG_INT(vsync, 1, 0, 1)
MACRO_CONFIG_INT(volume, 200, 0, 255) MACRO_CONFIG_INT(volume, 200, 0, 255)
MACRO_CONFIG_STR(player_name, 32, "nameless tee") MACRO_CONFIG_STR(player_name, 32, "nameless tee")
MACRO_CONFIG_STR(clan_name, 32, "") MACRO_CONFIG_STR(clan_name, 32, "")

View file

@ -62,6 +62,7 @@ void gfx_shutdown(); // NOT EXPOSED
void gfx_swap(); // NOT EXPOSED void gfx_swap(); // NOT EXPOSED
int gfx_get_video_modes(video_mode *list, int maxcount); int gfx_get_video_modes(video_mode *list, int maxcount);
void gfx_set_vsync(int val);
// textures // textures
/* /*

View file

@ -311,7 +311,6 @@ struct server_list
int selected_index; int selected_index;
}; };
int ui_do_key_reader(void *id, float x, float y, float w, float h, int key) int ui_do_key_reader(void *id, float x, float y, float w, float h, int key)
{ {
// process // process
@ -704,13 +703,6 @@ static int main_render()
if (!inited) if (!inited)
{ {
/*
list.info_count = 256;
list.scroll_index = 0;
list.selected_index = -1;
*/
inited = true; inited = true;
client_serverbrowse_refresh(); 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)) if (ui_do_button(&refresh_button, "Refresh", 0, 20, 420, 170, 48, draw_teewars_button))
client_serverbrowse_refresh(); 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); 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); client_connect(address);
@ -758,9 +750,9 @@ static int main_render()
screen = SCREEN_SETTINGS_GENERAL; screen = SCREEN_SETTINGS_GENERAL;
} }
//static int editor_button; /*static int editor_button;
//if (ui_do_button(&editor_button, "Kerning Editor", 0, 20, 470, 170, 48, draw_teewars_button)) if (ui_do_button(&editor_button, "Kerning Editor", 0, 20, 470, 170, 48, draw_teewars_button))
// screen = SCREEN_KERNING; screen = SCREEN_KERNING;*/
return 0; return 0;
} }
@ -840,7 +832,7 @@ static int settings_video_render()
{ {
for (int i = 0; i < resolution_count[depth_index]; i++) 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; selected_index = i;
break; break;
@ -858,7 +850,10 @@ static int settings_video_render()
}; };
// we need to draw these bottom up, to make overlapping work correctly // 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); 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)); config_set_fullscreen(&config_copy, ui_do_check_box(&config_copy.fullscreen, column2_x, row3_y + 5, 32, 32, config_copy.fullscreen));