summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-06 17:40:26 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-06 17:40:26 +0300
commit1d563a171844af47aa013519618ad018d2b194ea (patch)
treeacfd151ade17f31992dbc24fa1948dab19083885
parent99cca58b333793bec5c916870901e964360ed4f4 (diff)
downloadplus-1d563a171844af47aa013519618ad018d2b194ea.tar.gz
plus-1d563a171844af47aa013519618ad018d2b194ea.tar.bz2
plus-1d563a171844af47aa013519618ad018d2b194ea.tar.xz
plus-1d563a171844af47aa013519618ad018d2b194ea.zip
Add image type for image classes. for detect what kind of class used in image.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/resources/imagetype.h33
-rw-r--r--src/resources/image.h5
-rw-r--r--src/resources/subimage.h3
5 files changed, 43 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 02375d26b..2c169bd4c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -665,6 +665,7 @@ SET(SRCS
resources/iteminfo.cpp
resources/itemslot.h
enums/resources/imageposition.h
+ enums/resources/imagetype.h
enums/resources/itemdbtype.h
enums/resources/itemsoundevent.h
enums/resources/itemtype.h
diff --git a/src/Makefile.am b/src/Makefile.am
index b6aed9ae1..771e348f8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1255,6 +1255,7 @@ manaplus_SOURCES += main.cpp \
resources/iteminfo.cpp \
resources/itemslot.h \
enums/resources/imageposition.h \
+ enums/resources/imagetype.h \
enums/resources/itemdbtype.h \
enums/resources/itemsoundevent.h \
enums/resources/itemtype.h \
diff --git a/src/enums/resources/imagetype.h b/src/enums/resources/imagetype.h
new file mode 100644
index 000000000..8e42fb380
--- /dev/null
+++ b/src/enums/resources/imagetype.h
@@ -0,0 +1,33 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_RESOURCES_IMAGETYPE_H
+#define ENUMS_RESOURCES_IMAGETYPE_H
+
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(ImageType)
+{
+ Image = 0,
+ SubImage = 1
+}
+enumEnd(ImageType);
+
+#endif // ENUMS_RESOURCES_IMAGETYPE_H
diff --git a/src/resources/image.h b/src/resources/image.h
index e1c100e28..39492c360 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -25,6 +25,8 @@
#include "localconsts.h"
+#include "enums/resources/imagetype.h"
+
#include "resources/resource.h"
#include <SDL_video.h>
@@ -191,6 +193,9 @@ class Image notfinal : public Resource
int calcMemoryLocal() const override;
+ virtual ImageTypeT getType() const
+ { return ImageType::Image; }
+
SDL_Rect mBounds;
float mAlpha;
diff --git a/src/resources/subimage.h b/src/resources/subimage.h
index fc9ed5826..1fa0eb3ed 100644
--- a/src/resources/subimage.h
+++ b/src/resources/subimage.h
@@ -78,6 +78,9 @@ class SubImage final : public Image
const int width,
const int height) override final A_WARN_UNUSED;
+ ImageTypeT getType() const override final
+ { return ImageType::SubImage; }
+
int calcMemoryLocal() const override;
#ifdef USE_OPENGL