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")) {
save_level(current_level);
get_levels();
if (strlen(current_level) == 0) {
YughWarn("Can't save level that has no name.");
} else {
save_level(current_level);
get_levels();
}
}
if (nk_button_label(ctx, "Save as")) {
strcpy(current_level, levelname);
strncat(current_level, EXT_LEVEL, MAXNAME);
save_level(current_level);
levelname[0] = '\0';
get_levels();
if (strlen(current_level) == 0) {
YughWarn("Can't save level that has no name.");
} else {
strcpy(current_level, levelname);
strncat(current_level, EXT_LEVEL, MAXNAME);
save_level(current_level);
levelname[0] = '\0';
get_levels();
}
}
nuke_nel(1);
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)) {
YughInfo("Making prefab '%s'.", 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 {
// SDL_AudioStream *srconv;
// SDL_AudioStream *srconv;
void *data;
};

View file

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