mirror of
https://github.com/ScrelliCopter/tmx2gba.git
synced 2025-02-21 03:29:25 +11:00
tmxlite: further cleanup
This commit is contained in:
@@ -27,9 +27,8 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/detail/Android.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@@ -96,17 +95,8 @@ namespace tmx
|
||||
outPath = outPath.substr(0, result);
|
||||
}
|
||||
}
|
||||
// this does only work on windows
|
||||
#ifndef __ANDROID__
|
||||
|
||||
return outPath + '/' + path;
|
||||
#endif
|
||||
|
||||
// todo: make resolveFilePath work with subfolders on
|
||||
// android - currently only the root folder is working
|
||||
|
||||
#ifdef __ANDROID__
|
||||
return path;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline std::string getFilePath(const std::string& path)
|
||||
|
||||
@@ -27,9 +27,9 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include <tmxlite/Layer.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
#include "tmxlite/Layer.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
|
||||
namespace tmx
|
||||
{
|
||||
|
||||
@@ -27,9 +27,9 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include <tmxlite/Property.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
#include "tmxlite/Property.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
@@ -26,9 +26,9 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include <tmxlite/Layer.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
#include "tmxlite/Layer.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Tileset.hpp>
|
||||
#include <tmxlite/Layer.hpp>
|
||||
#include <tmxlite/Property.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include <tmxlite/Object.hpp>
|
||||
#include "tmxlite/Tileset.hpp"
|
||||
#include "tmxlite/Layer.hpp"
|
||||
#include "tmxlite/Property.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
#include "tmxlite/Object.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -27,9 +27,9 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include <tmxlite/Property.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
#include "tmxlite/Property.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -27,9 +27,9 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include <tmxlite/Layer.hpp>
|
||||
#include <tmxlite/Object.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
#include "tmxlite/Layer.hpp"
|
||||
#include "tmxlite/Object.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Property.hpp>
|
||||
#include "tmxlite/Property.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -27,8 +27,8 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
@@ -27,8 +27,8 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Layer.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include "tmxlite/Layer.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
|
||||
namespace tmx
|
||||
{
|
||||
|
||||
@@ -27,9 +27,9 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include <tmxlite/Property.hpp>
|
||||
#include <tmxlite/ObjectGroup.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
#include "tmxlite/Property.hpp"
|
||||
#include "tmxlite/ObjectGroup.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -27,7 +27,7 @@ source distribution.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tmxlite/Config.hpp>
|
||||
#include "tmxlite/Config.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*********************************************************************
|
||||
Matt Marchant 2016
|
||||
http://trederia.blogspot.com
|
||||
|
||||
tmxlite - Zlib license.
|
||||
|
||||
This software is provided 'as-is', without any express or
|
||||
implied warranty. In no event will the authors be held
|
||||
liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented;
|
||||
you must not claim that you wrote the original software.
|
||||
If you use this software in a product, an acknowledgment
|
||||
in the product documentation would be appreciated but
|
||||
is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such,
|
||||
and must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef ANDROID_INC_HPP_
|
||||
#define ANDROID_INC_HPP_
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <typename T>
|
||||
std::string to_string(T value)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << value;
|
||||
return os.str();
|
||||
}
|
||||
}
|
||||
|
||||
#define STOI(str) std::strtol(str.c_str(), 0, 10)
|
||||
#else
|
||||
#define STOI(str) std::stoi(str)
|
||||
|
||||
#endif // __ANDROID__
|
||||
#endif // ANDROID_INC_HPP_
|
||||
@@ -43,18 +43,6 @@ source distribution.
|
||||
#include <windows.h>
|
||||
#endif //_MSC_VER
|
||||
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
#include <cstring>
|
||||
|
||||
#define LOG_TAG "TMXlite-Debug"
|
||||
//#define ALOG(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
|
||||
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
|
||||
#endif // __ANDROID__
|
||||
|
||||
namespace tmx
|
||||
{
|
||||
/*!
|
||||
@@ -105,23 +93,10 @@ namespace tmx
|
||||
{
|
||||
if (type == Type::Error)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
|
||||
int outstringLength = outstring.length();
|
||||
char outstring_chararray[outstringLength+1];
|
||||
std::strcpy(outstring_chararray, outstring.c_str());
|
||||
LOGE("%s",outstring_chararray);
|
||||
#endif
|
||||
std::cerr << outstring << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
int outstringLength = outstring.length();
|
||||
char outstring_chararray[outstringLength+1];
|
||||
std::strcpy(outstring_chararray, outstring.c_str());
|
||||
LOGI("%s", outstring_chararray);
|
||||
#endif
|
||||
std::cout << outstring << std::endl;
|
||||
}
|
||||
const std::size_t maxBuffer = 30;
|
||||
@@ -140,13 +115,11 @@ namespace tmx
|
||||
std::ofstream file("output.log", std::ios::app);
|
||||
if (file.good())
|
||||
{
|
||||
#ifndef __ANDROID__
|
||||
std::time_t time = std::time(nullptr);
|
||||
auto tm = *std::localtime(&time);
|
||||
//put_time isn't implemented by the ndk versions of the stl
|
||||
file.imbue(std::locale());
|
||||
file << std::put_time(&tm, "%d/%m/%y-%H:%M:%S: ");
|
||||
#endif //__ANDROID__
|
||||
file << outstring << std::endl;
|
||||
file.close();
|
||||
}
|
||||
|
||||
@@ -25,15 +25,14 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/Types.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
#ifndef USE_ZLIB
|
||||
#include "miniz.h"
|
||||
# include "miniz.h"
|
||||
#else
|
||||
#include <zlib.h>
|
||||
# include <zlib.h>
|
||||
#endif
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/Types.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
bool tmx::decompress(const char* source, std::vector<unsigned char>& dest, std::size_t inSize, std::size_t expectedSize)
|
||||
|
||||
@@ -25,10 +25,11 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include "tmxlite/ImageLayer.hpp"
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/ImageLayer.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
|
||||
@@ -25,13 +25,14 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include "tmxlite/LayerGroup.hpp"
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/ObjectGroup.hpp"
|
||||
#include "tmxlite/ImageLayer.hpp"
|
||||
#include "tmxlite/TileLayer.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/LayerGroup.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectGroup.hpp>
|
||||
#include <tmxlite/ImageLayer.hpp>
|
||||
#include <tmxlite/TileLayer.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
|
||||
@@ -25,16 +25,15 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/Map.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectGroup.hpp>
|
||||
#include <tmxlite/ImageLayer.hpp>
|
||||
#include <tmxlite/TileLayer.hpp>
|
||||
#include <tmxlite/LayerGroup.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
#include <tmxlite/detail/Android.hpp>
|
||||
#include "tmxlite/Map.hpp"
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/ObjectGroup.hpp"
|
||||
#include "tmxlite/ImageLayer.hpp"
|
||||
#include "tmxlite/TileLayer.hpp"
|
||||
#include "tmxlite/LayerGroup.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <queue>
|
||||
|
||||
using namespace tmx;
|
||||
@@ -136,8 +135,8 @@ bool Map::parseMapNode(const pugi::xml_node& mapNode)
|
||||
return reset();
|
||||
}
|
||||
|
||||
m_version.upper = STOI(attribString.substr(0, pointPos));
|
||||
m_version.lower = STOI(attribString.substr(pointPos + 1));
|
||||
m_version.upper = std::stoi(attribString.substr(0, pointPos));
|
||||
m_version.lower = std::stoi(attribString.substr(pointPos + 1));
|
||||
|
||||
m_class = mapNode.attribute("class").as_string();
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/Object.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/Map.hpp>
|
||||
#include <tmxlite/Tileset.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
#include "tmxlite/Object.hpp"
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/Map.hpp"
|
||||
#include "tmxlite/Tileset.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <sstream>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
@@ -25,10 +25,11 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/ObjectGroup.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectGroup.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
|
||||
@@ -24,10 +24,11 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/ObjectTypes.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectTypes.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
|
||||
@@ -25,10 +25,11 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include "tmxlite/Property.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/Property.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
|
||||
@@ -25,12 +25,13 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <zstd.h>
|
||||
#include "base64.h"
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/TileLayer.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <zstd.h>
|
||||
#include <sstream>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
@@ -25,11 +25,11 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <tmxlite/Tileset.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
#include "tmxlite/Tileset.hpp"
|
||||
#include "tmxlite/FreeFuncs.hpp"
|
||||
#include "tmxlite/detail/Log.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <ctype.h>
|
||||
|
||||
using namespace tmx;
|
||||
|
||||
Reference in New Issue
Block a user