From e0be7afc936c39e2b0e1db84a13653cfd78a6035 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Wed, 25 Mar 2009 11:31:02 -0600 Subject: Modified skin loading to save and load a skin's XML path, as well as modified the skin loading method to take a default value, in case the value in the configuration file fails to load for one reason or another. While this doesn't directly expose skinning on a per window basis to the user at the moment, it does allow people to change what skins get loaded with which windows now without needing to modify the code. TODO: Determine a decent approach to allowing the user to change their window skins in game, as well as moving all widget skin loading to the skin class (for instance, the button skins, progressbar skins, etc.) so that different skin configurations can use different widget skins. Signed-off-by: Ira Rice --- src/gui/skin.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/gui/skin.h') diff --git a/src/gui/skin.h b/src/gui/skin.h index c90952e3..b7e2c29f 100644 --- a/src/gui/skin.h +++ b/src/gui/skin.h @@ -33,7 +33,8 @@ class Image; class Skin { public: - Skin(ImageRect skin, Image* close, std::string name = ""); + Skin(ImageRect skin, Image* close, std::string filePath, + std::string name = ""); ~Skin(); /** @@ -43,6 +44,11 @@ class Skin */ std::string getName() { return mName; } + /** + * Returns the skin's xml file path. + */ + std::string getFilePath() { return mFilePath; } + /** * Returns the background skin. */ @@ -76,6 +82,7 @@ class Skin int instances; private: + std::string mFilePath; /**< File name path for the skin */ std::string mName; /**< Name of the skin to use */ ImageRect border; /**< The window border and background */ Image *closeImage; /**< Close Button Image */ @@ -98,7 +105,7 @@ class SkinLoader /** * Loads a skin */ - Skin* load(const std::string &filename); + Skin* load(const std::string &filename, const std::string &defaultPath); /** * Updates the alpha values of all of the skins -- cgit v1.2.3-60-g2f50