summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-01 20:08:13 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-01 21:33:37 +0300
commite9ddc70c0202c04535c83753bad2d01a92527b15 (patch)
treea947fbd72c685de8123a8ba0c9c6596a09f161b6 /src
parent93c9e4f6c0a4f4a4ecc78a6b540984937bbb195f (diff)
downloadmv-e9ddc70c0202c04535c83753bad2d01a92527b15.tar.gz
mv-e9ddc70c0202c04535c83753bad2d01a92527b15.tar.bz2
mv-e9ddc70c0202c04535c83753bad2d01a92527b15.tar.xz
mv-e9ddc70c0202c04535c83753bad2d01a92527b15.zip
add dyecmd tool into automake.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am92
-rw-r--r--src/client.cpp5
-rw-r--r--src/configuration.cpp6
-rw-r--r--src/dyetool/dyemain.cpp70
-rw-r--r--src/resources/image.h3
5 files changed, 169 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a6e2b73c3..ff50b51e1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = manaplus
+bin_PROGRAMS = manaplus dyecmd
manaplus_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\" \
@@ -25,6 +25,94 @@ else
manaplus_SOURCES =
endif
+if USE_INTERNALGUICHAN
+dyecmd_CXXFLAGS = -I$(srcdir)/guichan/include -DUSE_INTERNALGUICHAN
+dyecmd_SOURCES = guichan/actionevent.cpp \
+ guichan/cliprectangle.cpp \
+ guichan/color.cpp \
+ guichan/event.cpp \
+ guichan/exception.cpp \
+ guichan/font.cpp \
+ guichan/graphics.cpp \
+ guichan/rectangle.cpp \
+ guichan/widget.cpp \
+ guichan/include/guichan/actionevent.hpp \
+ guichan/include/guichan/cliprectangle.hpp \
+ guichan/include/guichan/color.hpp \
+ guichan/include/guichan/event.hpp \
+ guichan/include/guichan/exception.hpp \
+ guichan/include/guichan/font.hpp \
+ guichan/include/guichan/graphics.hpp \
+ guichan/include/guichan/rectangle.hpp \
+ guichan/include/guichan/widget.hpp
+else
+dyecmd_SOURCES =
+endif
+
+dyecmd_SOURCES += dyetool/dyemain.cpp \
+ animatedsprite.cpp \
+ animatedsprite.h \
+ animationdelayload.cpp \
+ animationdelayload.h \
+ configuration.cpp \
+ configuration.h \
+ logger.cpp \
+ logger.h \
+ navigationmanager.cpp \
+ navigationmanager.h \
+ walklayer.cpp \
+ walklayer.h \
+ render/graphics.cpp \
+ render/graphics.h \
+ resources/action.cpp \
+ resources/action.h \
+ resources/animation.cpp \
+ resources/animation.h \
+ resources/db/palettedb.cpp \
+ resources/db/palettedb.h \
+ resources/dye.cpp \
+ resources/dye.h \
+ resources/image.cpp \
+ resources/image.h \
+ resources/imagehelper.cpp \
+ resources/imagehelper.h \
+ resources/imageset.cpp \
+ resources/imageset.h \
+ resources/imagewriter.cpp \
+ resources/imagewriter.h \
+ resources/resource.cpp \
+ resources/resource.h \
+ resources/resourcemanager.cpp \
+ resources/resourcemanager.h \
+ resources/sdlimagehelper.cpp \
+ resources/sdlimagehelper.h \
+ resources/sdlmusic.cpp \
+ resources/sdlmusic.h \
+ resources/soundeffect.cpp \
+ resources/soundeffect.h \
+ resources/subimage.cpp \
+ resources/subimage.h \
+ resources/surfaceimagehelper.cpp \
+ resources/surfaceimagehelper.h \
+ resources/spritedef.cpp \
+ resources/spritedef.h \
+ utils/mkdir.cpp \
+ utils/mkdir.h \
+ utils/paths.cpp \
+ utils/paths.h \
+ utils/physfsrwops.cpp \
+ utils/physfsrwops.h \
+ utils/physfstools.cpp \
+ utils/physfstools.h \
+ utils/stringutils.cpp \
+ utils/stringutils.h \
+ utils/timer.cpp \
+ utils/timer.h \
+ utils/xml.cpp \
+ utils/xml.h \
+ utils/translation/podict.cpp \
+ utils/translation/podict.h
+
if USE_MUMBLE
manaplus_CXXFLAGS += -DUSE_MUMBLE
endif
@@ -477,8 +565,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
resources/image.h \
resources/imagehelper.cpp \
resources/imagehelper.h \
- resources/imageset.h \
resources/imageset.cpp \
+ resources/imageset.h \
resources/imagewriter.cpp \
resources/imagewriter.h \
resources/db/itemdb.cpp \
diff --git a/src/client.cpp b/src/client.cpp
index 4bff155e8..5c542f6c5 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -156,11 +156,6 @@ std::string errorMessage;
ErrorListener errorListener;
LoginData loginData;
-Configuration config; // XML file configuration reader
-Configuration serverConfig; // XML file server configuration reader
-Configuration features; // XML file features
-Configuration branding; // XML branding information reader
-Configuration paths; // XML default paths information reader
Client *client = nullptr;
ChatLogger *chatLogger = nullptr; // Chat log object
KeyboardConfig keyboard;
diff --git a/src/configuration.cpp b/src/configuration.cpp
index d9a9df3ab..55ad392f3 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -37,6 +37,12 @@ std::map<std::string, int> optionsCount;
#define GETLOG()
#endif
+Configuration config; // XML file configuration reader
+Configuration serverConfig; // XML file server configuration reader
+Configuration features; // XML file features
+Configuration branding; // XML branding information reader
+Configuration paths; // XML default paths information reader
+
const std::string unusedKeys[] =
{
"AttackRange",
diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp
new file mode 100644
index 000000000..9bab265e8
--- /dev/null
+++ b/src/dyetool/dyemain.cpp
@@ -0,0 +1,70 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2013 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/>.
+ */
+
+#include "logger.h"
+
+#include "resources/image.h"
+#include "resources/imagehelper.h"
+#include "resources/imagewriter.h"
+#include "resources/resourcemanager.h"
+#include "resources/sdlimagehelper.h"
+
+#ifdef USE_SDL2
+#include "resources/surfaceimagehelper.h"
+#endif
+
+#include "utils/gettext.h"
+
+#include <iostream>
+
+#include "debug.h"
+
+int serverVersion = 0;
+
+static void printHelp()
+{
+ std::cout << _("dyecmd srcfile dyestring dstfile")
+ << std::endl << std::endl;
+}
+
+int main(int argc, char **argv)
+{
+ if (argc != 4)
+ printHelp();
+
+ logger = new Logger;
+
+#ifdef USE_SDL2
+ imageHelper = new SurfaceImageHelper;
+#else
+ imageHelper = new SDLImageHelper;
+#endif
+
+ ResourceManager *resman = new ResourceManager;
+ Image *image = resman->getImage(std::string(
+ argv[1]).append("|").append(argv[2]));
+ if (!image)
+ {
+ printf("Error loading image\n");
+ return 1;
+ }
+ ImageWriter::writePNG(image->getSDLSurface(), argv[3]);
+ return 0;
+}
diff --git a/src/resources/image.h b/src/resources/image.h
index e4e41b914..ee7191728 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -186,6 +186,9 @@ class Image : public Resource
void setAlphaCalculated(const bool b)
{ mIsAlphaCalculated = b; }
+ SDL_Surface* getSDLSurface()
+ { return mSDLSurface; }
+
SDL_Rect mBounds;
protected: