diff options
author | Stijn Buys <ingar@osirion.org> | 2014-07-09 19:18:31 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2014-07-09 19:18:31 +0000 |
commit | 1d518a54914531d7a4fab3a6835b75de85bd7bc7 (patch) | |
tree | cabfcb6f735e3c928cddf79169fb84d9b422747f /src/client | |
parent | 25a7edee2f003f259fc3a97bbfc047d72adaa361 (diff) |
Initial support for multi-layered materials, requires shaders files in the new format.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/savegamemenu.cc | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/src/client/savegamemenu.cc b/src/client/savegamemenu.cc index 8efd746..78cf56f 100644 --- a/src/client/savegamemenu.cc +++ b/src/client/savegamemenu.cc @@ -218,7 +218,7 @@ void SaveGameMenu::refresh() listitem->set_label("new"); listitem->set_sortkey("[new]"); listitem->set_font(ui::root()->font_tiny()); - listitem->set_height(listitem->font()->height() * 2.0f); + listitem->set_height(listitem->font()->height() * 3.0f); savegamemenu_savebutton->set_text("Save"); if (!core::localcontrol()) { @@ -275,10 +275,17 @@ void SaveGameMenu::hide() Window::hide(); model::Material *screenshotmaterial = model::Material::find("ui/screenshot"); - if (screenshotmaterial && screenshotmaterial->texture().size()) { - render::Textures::unload(screenshotmaterial->texture()); - screenshotmaterial->set_texture(""); + if (screenshotmaterial) { + for (model::Material::Layers::const_iterator lit = screenshotmaterial->layers().begin(); lit != screenshotmaterial->layers().end(); ++lit) { + if ((*lit)->texture().size()) { + render::Textures::unload((*lit)->texture()); + (*lit)->set_texture(""); + } + } + } + + savegamemenu_screenshot->set_texture(""); } void SaveGameMenu::show() @@ -323,15 +330,26 @@ void SaveGameMenu::show_file_info() model::Material *screenshotmaterial = model::Material::find("ui/screenshot"); if (!screenshotmaterial) { screenshotmaterial = new model::Material("ui/screenshot"); - model::Material::add(screenshotmaterial); - screenshotmaterial ->set_flags(model::Material::FlagTexture); - screenshotmaterial ->set_flags(model::Material::FlagBright); - } else if (screenshotmaterial->texture().size()) { - render::Textures::unload(screenshotmaterial->texture()); + model::Material::registry()["ui/screenshot"] = 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->set_bright(true); + } + if (screenshotlayer->texture().size()) { + render::Textures::unload(screenshotlayer->texture()); + screenshotlayer->set_texture(""); } std::string screenshotfilename("savegames/" + savename); - screenshotmaterial->set_texture(screenshotfilename); + screenshotlayer->set_texture(screenshotfilename); + render::Textures::image_loader(screenshotlayer); + screenshotmaterial->set_size(screenshotlayer->size()); savegamemenu_screenshot->set_texture("ui/screenshot"); savegamemenu_screenshot->show(); |