diff options
-rw-r--r-- | src/client/savegamemenu.cc | 7 | ||||
-rw-r--r-- | src/model/material.cc | 7 | ||||
-rw-r--r-- | src/model/material.h | 17 |
3 files changed, 22 insertions, 9 deletions
diff --git a/src/client/savegamemenu.cc b/src/client/savegamemenu.cc index 6983ef6..4b546ac 100644 --- a/src/client/savegamemenu.cc +++ b/src/client/savegamemenu.cc @@ -330,15 +330,14 @@ void SaveGameMenu::show_file_info() model::Material *screenshotmaterial = model::Material::find("ui/screenshot"); if (!screenshotmaterial) { screenshotmaterial = new model::Material("ui/screenshot"); - model::Material::registry()["ui/screenshot"] = screenshotmaterial; + model::Material::registry()[screenshotmaterial->name()] = screenshotmaterial; } model::Layer *screenshotlayer = 0; if (screenshotmaterial->layers().size() > 0) { screenshotlayer = (*screenshotmaterial->layers().begin()); } else { - screenshotlayer = new model::Layer(); - screenshotmaterial->layers().push_back(screenshotlayer); + screenshotlayer = screenshotmaterial->add_layer(); screenshotlayer->set_fullbright(true); } if (screenshotlayer->texture().size()) { @@ -351,7 +350,7 @@ void SaveGameMenu::show_file_info() render::Textures::image_loader(screenshotlayer); screenshotmaterial->set_size(screenshotlayer->size()); - savegamemenu_screenshot->set_texture("ui/screenshot"); + savegamemenu_screenshot->set_texture(screenshotmaterial->name()); savegamemenu_screenshot->show(); resize(); diff --git a/src/model/material.cc b/src/model/material.cc index 3d67cad..9f47f1e 100644 --- a/src/model/material.cc +++ b/src/model/material.cc @@ -40,6 +40,13 @@ void Material::set_size(const math::Vector2f & size) material_size.assign(size); } +Layer * Material::add_layer() +{ + Layer * layer = new Layer(); + material_layers.push_back(layer); + return (layer); +} + void Material::print() { con_print << name() << std::endl; diff --git a/src/model/material.h b/src/model/material.h index a3ad5fc..c775c04 100644 --- a/src/model/material.h +++ b/src/model/material.h @@ -16,7 +16,9 @@ namespace model { -/// fragment surface material parameters +/** + * @brief fragment material properties + * */ class Material { public: @@ -161,6 +163,11 @@ public: { return material_layers; } + + /** + * @brief add a new layer to the material + * */ + Layer *add_layer(); /* ---- static ----------------------------------------------------- */ @@ -175,7 +182,7 @@ public: /** * @brief initialize material registry * reads materials from the shader files listed in shaderlist.txt - */ + * */ static void init(); /** @@ -185,7 +192,7 @@ public: /** * @brief clear material registry - */ + * */ static void clear(); /** @@ -199,12 +206,12 @@ public: * If it doesnt, a mew material will be created, containing a single layer * with a texture with the same name as the material. * @param ui_texture set to true if the material is a material used by the user interface - */ + * */ static Material *load(const std::string &name, const bool ui_texture=false); /** * @brief find a material in the registry - */ + * */ static Material *find(const std::string &name); static void set_imageloader_func(ImageLoaderFuncPtr func); |