From e9ddc70c0202c04535c83753bad2d01a92527b15 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Nov 2013 20:08:13 +0300 Subject: add dyecmd tool into automake. --- src/Makefile.am | 92 +++++++++++++++++++++++++++++++++++++++++++++++-- src/client.cpp | 5 --- src/configuration.cpp | 6 ++++ src/dyetool/dyemain.cpp | 70 +++++++++++++++++++++++++++++++++++++ src/resources/image.h | 3 ++ 5 files changed, 169 insertions(+), 7 deletions(-) create mode 100644 src/dyetool/dyemain.cpp (limited to 'src') 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 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 . + */ + +#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 + +#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: -- cgit v1.2.3-60-g2f50