2014-04-20 09:14:15 +00:00
|
|
|
// This file is part of libAthena.
|
|
|
|
//
|
|
|
|
// libAthena 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 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// libAthena 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 libAthena. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
|
|
|
|
#ifndef GLOBAL_HPP
|
|
|
|
#define GLOBAL_HPP
|
|
|
|
|
|
|
|
#include "Athena/Types.hpp"
|
|
|
|
#include "Athena/Utility.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
|
2014-12-29 04:46:43 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable : 4996)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AT_PRETTY_FUNCTION
|
|
|
|
# ifdef __PRETTY_FUNCTION__
|
|
|
|
# define AT_PRETTY_FUNCTION __PRETTY_FUNCTION__
|
|
|
|
# elif defined(__FUNCSIG__)
|
|
|
|
# define AT_PRETTY_FUNCTION __FUNCSIG__
|
2014-06-03 03:09:40 +00:00
|
|
|
# elif defined(__FUNCTION__)
|
2014-12-29 04:46:43 +00:00
|
|
|
# define AT_PRETTY_FUNCTION __FUNCTION__
|
2014-06-03 03:09:40 +00:00
|
|
|
# elif defined(__FUNC__)
|
2014-12-29 04:46:43 +00:00
|
|
|
# define AT_PRETTY_FUNCTION __FUNC__
|
2014-06-03 03:09:40 +00:00
|
|
|
# elif defined(__func__)
|
2014-12-29 04:46:43 +00:00
|
|
|
# define AT_PRETTY_FUNCTION __func__
|
2014-06-03 03:09:40 +00:00
|
|
|
# else
|
2014-12-29 04:46:43 +00:00
|
|
|
# define AT_PRETTY_FUNCTION "<unknown>"
|
2014-06-03 03:09:40 +00:00
|
|
|
# endif
|
2014-05-15 05:42:20 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-20 09:14:15 +00:00
|
|
|
#ifndef aDebug
|
|
|
|
#define aDebug() \
|
2014-12-29 04:46:43 +00:00
|
|
|
std::cout << __FILE__ << "(" << __LINE__ << ") " << AT_PRETTY_FUNCTION << ": "
|
2014-04-20 09:14:15 +00:00
|
|
|
#endif
|
|
|
|
#ifndef aError
|
|
|
|
#define aError() \
|
2014-12-29 04:46:43 +00:00
|
|
|
std::cerr << __FILE__ << "(" << __LINE__ << ") " << AT_PRETTY_FUNCTION << ": "
|
2014-04-20 09:14:15 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-29 02:31:32 +00:00
|
|
|
#ifndef aPrint
|
|
|
|
#define aPrint() std::cout
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define aEnd() '\n'
|
|
|
|
|
2014-04-20 09:14:15 +00:00
|
|
|
#ifndef BLOCKSZ
|
|
|
|
#define BLOCKSZ 512
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 00:04:13 +00:00
|
|
|
#define ROUND_UP_32(val) (((val) + 31) & ~31)
|
|
|
|
#define ROUND_UP_16(val) (((val) + 15) & ~15)
|
|
|
|
|
2014-04-20 09:14:15 +00:00
|
|
|
namespace Athena
|
|
|
|
{
|
|
|
|
enum class SeekOrigin
|
|
|
|
{
|
|
|
|
Begin,
|
|
|
|
Current,
|
|
|
|
End
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class Endian
|
|
|
|
{
|
|
|
|
LittleEndian,
|
|
|
|
BigEndian
|
|
|
|
};
|
|
|
|
|
2014-09-29 02:32:31 +00:00
|
|
|
#ifndef ATHENA_NO_SAKURA
|
2014-04-20 09:14:15 +00:00
|
|
|
namespace Sakura
|
|
|
|
{
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
class Vector2D
|
2014-05-15 07:41:54 +00:00
|
|
|
{
|
2014-04-20 09:14:15 +00:00
|
|
|
public:
|
|
|
|
T x;
|
|
|
|
T y;
|
|
|
|
|
|
|
|
Vector2D()
|
|
|
|
: x(0),
|
|
|
|
y(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector2D(T x, T y)
|
|
|
|
: x(x),
|
|
|
|
y(y)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef Vector2D<int> Vector2Di;
|
|
|
|
typedef Vector2D<float> Vector2Df;
|
|
|
|
} // Sakura
|
2014-09-29 02:32:31 +00:00
|
|
|
#endif // ATHENA_NO_SAKURA
|
2014-04-20 09:14:15 +00:00
|
|
|
} // Athena
|
|
|
|
|
|
|
|
std::ostream& operator<<(std::ostream& os, const Athena::SeekOrigin& origin);
|
|
|
|
std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian);
|
|
|
|
#endif // GLOBAL_HPP
|