|
|
@@ -72,6 +72,24 @@ static void IZ_GetConfigPath(char* config_path) { |
|
|
|
strcat_s(config_path, 128, "config.ini"); |
|
|
|
} |
|
|
|
|
|
|
|
static void IZ_SaveConfig(IZ_Config* config) { |
|
|
|
static char config_path[128]; |
|
|
|
IZ_GetConfigPath(config_path); |
|
|
|
FILE* fp; |
|
|
|
fopen_s(&fp, config_path, "w"); |
|
|
|
fprintf_s(fp, "[Video]\n"); |
|
|
|
fprintf_s(fp, "Width=%u\n", config->video.width); |
|
|
|
fprintf_s(fp, "Height=%u\n", config->video.height); |
|
|
|
fprintf_s(fp, "\n"); |
|
|
|
|
|
|
|
for (unsigned int p = 0; p < PLAYERS; p += 1) { |
|
|
|
fprintf_s(fp, "[Controls.%u.Keyboard]\n", p); |
|
|
|
for (unsigned int i = 0; i < CONTROLS; i += 1) { |
|
|
|
fprintf_s(fp, "%s=%s\n", ACTION_NAMES[i], SDL_GetKeyName(config->controls[p].keyboard[i])); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void IZ_LoadConfig(IZ_Config* config) { |
|
|
|
static char config_path[128]; |
|
|
|
IZ_GetConfigPath(config_path); |
|
|
@@ -90,6 +108,7 @@ int main(int argc, char* args[]) { |
|
|
|
SDL_Surface* screen_surface = NULL; |
|
|
|
IZ_Config config; |
|
|
|
IZ_LoadConfig(&config); |
|
|
|
IZ_SaveConfig(&config); |
|
|
|
|
|
|
|
if (SDL_Init( |
|
|
|
SDL_INIT_VIDEO |
|
|
|