This commit is contained in:
John Alanbrook 2022-11-20 20:37:17 +00:00
parent 4224594ee4
commit 39bacf9508
3 changed files with 23 additions and 12 deletions

View file

@ -504,16 +504,27 @@ void editor_project_gui() {
} }
if (nk_button_label(ctx, "Save")) { if (nk_button_label(ctx, "Save")) {
save_level(current_level); if (strlen(current_level) == 0) {
get_levels(); YughWarn("Can't save level that has no name.");
} else {
save_level(current_level);
get_levels();
}
} }
if (nk_button_label(ctx, "Save as")) { if (nk_button_label(ctx, "Save as")) {
strcpy(current_level, levelname); if (strlen(current_level) == 0) {
strncat(current_level, EXT_LEVEL, MAXNAME); YughWarn("Can't save level that has no name.");
save_level(current_level); } else {
levelname[0] = '\0'; strcpy(current_level, levelname);
get_levels(); strncat(current_level, EXT_LEVEL, MAXNAME);
save_level(current_level);
levelname[0] = '\0';
get_levels();
}
} }
nuke_nel(1); nuke_nel(1);
nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, levelname, MAXNAME - 1, nk_filter_default); nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, levelname, MAXNAME - 1, nk_filter_default);
@ -994,8 +1005,6 @@ void editor_prefab_btn(char *prefab) {
if (nk_button_label(ctx, prefab)) { if (nk_button_label(ctx, prefab)) {
YughInfo("Making prefab '%s'.", prefab); YughInfo("Making prefab '%s'.", prefab);
gameobject_makefromprefab(prefab); gameobject_makefromprefab(prefab);
/*GameObject* newprefab = (GameObject*)createPrefab(*prefab); */
/*cam_inverse_goto(&camera, &newprefab->transform); */
} }
} }

View file

@ -23,7 +23,7 @@ struct soundstream {
}; };
struct soundconvstream { struct soundconvstream {
// SDL_AudioStream *srconv; // SDL_AudioStream *srconv;
void *data; void *data;
}; };

View file

@ -13,6 +13,8 @@ static struct {
struct Texture *value; struct Texture *value;
} *texhash = NULL; } *texhash = NULL;
struct Texture *tex_default;
struct Texture *texture_pullfromfile(const char *path) struct Texture *texture_pullfromfile(const char *path)
{ {
int index = shgeti(texhash, path); int index = shgeti(texhash, path);
@ -63,8 +65,8 @@ struct Texture *texture_loadfromfile(const char *path)
struct Texture *new = texture_pullfromfile(path); struct Texture *new = texture_pullfromfile(path);
if (new == NULL) { if (new == NULL) {
YughError("Texture not loaded!", 0); YughError("Texture %s not loaded! Loading the default instead ...", path);
return new; new = texture_pullfromfile("./ph.png");
} }
if (new->id == 0) { if (new->id == 0) {