summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-03-19 18:47:14 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-03-19 18:47:14 -0400
commit784de688d0a7a0ccbb177555c0e79795cb78ec5a (patch)
treea796f71b622d5a43f66fae110c97f1a277fb43a5
parentf0e0a403376f263cba7b3698e5ecc811a155b591 (diff)
downloadsigen-784de688d0a7a0ccbb177555c0e79795cb78ec5a.tar.gz
sigen-784de688d0a7a0ccbb177555c0e79795cb78ec5a.tar.xz
sigen-784de688d0a7a0ccbb177555c0e79795cb78ec5a.zip
Add a size member to Skins
-rw-r--r--sigmod/Skin.cpp8
-rw-r--r--sigmod/Skin.h14
2 files changed, 22 insertions, 0 deletions
diff --git a/sigmod/Skin.cpp b/sigmod/Skin.cpp
index 8dd1c1c0..30fb7043 100644
--- a/sigmod/Skin.cpp
+++ b/sigmod/Skin.cpp
@@ -38,6 +38,7 @@ Skin::Skin(const Skin& skin) :
Skin::Skin(const Game* parent, const int id) :
Object(parent, id),
m_name(""),
+ m_size(32, 32),
m_script("", "")
{
}
@@ -60,6 +61,7 @@ void Skin::validate()
TEST_BEGIN();
if (m_name.isEmpty())
emit(error("Name is empty"));
+ TEST(size);
TEST_END();
}
@@ -67,6 +69,7 @@ void Skin::load(const QDomElement& xml)
{
LOAD_BEGIN();
LOAD(name);
+ LOAD(size);
LOAD(script);
}
@@ -74,17 +77,21 @@ QDomElement Skin::save() const
{
SAVE_CREATE();
SAVE(name);
+ SAVE(size);
SAVE(script);
return xml;
}
SETTER(Skin, QString&, Name, name)
+SETTER(Skin, QSize&, Size, size)
SETTER(Skin, Script&, Script, script)
GETTER(Skin, QString, name)
+GETTER(Skin, QSize, size)
GETTER(Skin, Script, script)
CHECK(Skin, QString&, name)
+CHECK(Skin, QSize&, size)
CHECK(Skin, Script&, script)
Skin& Skin::operator=(const Skin& rhs)
@@ -92,6 +99,7 @@ Skin& Skin::operator=(const Skin& rhs)
if (this == &rhs)
return *this;
COPY(name);
+ COPY(size);
COPY(script);
return *this;
}
diff --git a/sigmod/Skin.h b/sigmod/Skin.h
index e2394b1b..d06fa7f6 100644
--- a/sigmod/Skin.h
+++ b/sigmod/Skin.h
@@ -100,6 +100,12 @@ class SIGMOD_EXPORT Skin : public Object
*/
void setName(const QString& name);
/**
+ * Sets the size of the skin. It is not allowed to draw outside of the rectangle from (0, 0) to its size.
+ *
+ * \param size The size of the skin.
+ */
+ void setSize(const QSize& size);
+ /**
* Sets the script that manages the images for the skin. The following objects will be available
* to the script:
*
@@ -124,6 +130,12 @@ class SIGMOD_EXPORT Skin : public Object
*/
QString name() const;
/**
+ * \sa setSize
+ *
+ * \return The size of the skin.
+ */
+ QSize size() const;
+ /**
* \sa setSkin
*
* \return The script for the skin.
@@ -131,11 +143,13 @@ class SIGMOD_EXPORT Skin : public Object
Sigcore::Script script() const;
bool nameCheck(const QString& name) const;
+ bool sizeCheck(const QSize& size) const;
bool scriptCheck(const Sigcore::Script& script) const;
Skin& operator=(const Skin& rhs);
private:
QString m_name;
+ QSize m_size;
Sigcore::Script m_script;
};
}