The Omega Refactor(TM) + Input Options
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
static void _dialog_callback(void* userdata, const char* const* filelist, s32 filter);
|
||||
|
||||
// Callback that runs during the file dialog; will get the path and determine if one has been selected
|
||||
static void
|
||||
_dialog_callback(void* userdata, const char* const* filelist, s32 filter)
|
||||
{
|
||||
@@ -11,13 +12,14 @@ _dialog_callback(void* userdata, const char* const* filelist, s32 filter)
|
||||
|
||||
if (filelist && filelist[0] && strlen(filelist[0]) > 0)
|
||||
{
|
||||
strncpy(self->path, filelist[0], PATH_MAX - 1);
|
||||
self->path = filelist[0];
|
||||
self->isSelected = true;
|
||||
}
|
||||
else
|
||||
self->isSelected = false;
|
||||
}
|
||||
|
||||
// Initializes dialog
|
||||
void
|
||||
dialog_init(Dialog* self, Anm2* anm2, Anm2Reference* reference, Resources* resources, SDL_Window* window)
|
||||
{
|
||||
@@ -27,7 +29,7 @@ dialog_init(Dialog* self, Anm2* anm2, Anm2Reference* reference, Resources* resou
|
||||
self->window = window;
|
||||
}
|
||||
|
||||
/* Opens file dialog for user to pick anm2 files */
|
||||
// Opens file dialog to open a new anm2
|
||||
void
|
||||
dialog_anm2_open(Dialog* self)
|
||||
{
|
||||
@@ -35,7 +37,7 @@ dialog_anm2_open(Dialog* self)
|
||||
self->type = DIALOG_ANM2_OPEN;
|
||||
}
|
||||
|
||||
/* Opens file dialog for user to save new anm2 files */
|
||||
// Opens file dialog to save anm2
|
||||
void
|
||||
dialog_anm2_save(Dialog* self)
|
||||
{
|
||||
@@ -43,7 +45,7 @@ dialog_anm2_save(Dialog* self)
|
||||
self->type = DIALOG_ANM2_SAVE;
|
||||
}
|
||||
|
||||
/* Opens file dialog for user to pick png files for spritesheets */
|
||||
// Opens file dialog to open png
|
||||
void
|
||||
dialog_png_open(Dialog* self)
|
||||
{
|
||||
@@ -51,7 +53,7 @@ dialog_png_open(Dialog* self)
|
||||
self->type = DIALOG_PNG_OPEN;
|
||||
}
|
||||
|
||||
/* Opens file dialog for user to pick png file to replace selected one */
|
||||
// Opens file dialog to replace a given png
|
||||
void
|
||||
dialog_png_replace(Dialog* self)
|
||||
{
|
||||
@@ -59,6 +61,7 @@ dialog_png_replace(Dialog* self)
|
||||
self->type = DIALOG_PNG_REPLACE;
|
||||
}
|
||||
|
||||
// Ticks dialog
|
||||
void
|
||||
dialog_tick(Dialog* self)
|
||||
{
|
||||
@@ -82,19 +85,19 @@ dialog_tick(Dialog* self)
|
||||
case DIALOG_PNG_OPEN:
|
||||
id = map_next_id_get(self->resources->textures);
|
||||
self->anm2->spritesheets[id] = Anm2Spritesheet{};
|
||||
strncpy(self->anm2->spritesheets[id].path, self->path, PATH_MAX);
|
||||
anm2_spritesheet_texture_load(self->anm2, self->resources, self->path, id);
|
||||
self->path = self->anm2->spritesheets[id].path;
|
||||
resources_texture_init(self->resources, self->path, id);
|
||||
break;
|
||||
case DIALOG_PNG_REPLACE:
|
||||
strncpy(self->anm2->spritesheets[self->replaceID].path, self->path, PATH_MAX);
|
||||
anm2_spritesheet_texture_load(self->anm2, self->resources, self->path, self->replaceID);
|
||||
self->anm2->spritesheets[self->replaceID].path = self->path;
|
||||
resources_texture_init(self->resources, self->path, self->replaceID);
|
||||
self->replaceID = -1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
memset(self->path, '\0', PATH_MAX);
|
||||
self->path.clear();
|
||||
self->isSelected = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user