From 1d563a171844af47aa013519618ad018d2b194ea Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 Jun 2016 17:40:26 +0300 Subject: Add image type for image classes. for detect what kind of class used in image. --- src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/enums/resources/imagetype.h | 33 +++++++++++++++++++++++++++++++++ src/resources/image.h | 5 +++++ src/resources/subimage.h | 3 +++ 5 files changed, 43 insertions(+) create mode 100644 src/enums/resources/imagetype.h (limited to 'src') 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 . + */ + +#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 @@ -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 -- cgit v1.2.3-60-g2f50