2019-09-18 12:04:02 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-11-19 11:29:53 +01:00
|
|
|
// Copyright (c) 2019 Lawnjelly
|
|
|
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
// The above copyright notice and this permission notice shall be included in all
|
|
|
|
// copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
// SOFTWARE.
|
|
|
|
|
2019-10-22 21:44:17 +02:00
|
|
|
// most of the performance sensitive debug output will be compiled out in release builds
|
|
|
|
// you won't be able to get frame debugging of the visibility tree though.
|
|
|
|
#ifdef DEBUG_ENABLED
|
2019-11-19 11:29:53 +01:00
|
|
|
|
2020-01-07 19:16:54 +01:00
|
|
|
#pragma message ("LPortal DEBUG_ENABLED")
|
2020-01-14 12:17:59 +01:00
|
|
|
#define LPRINT_RUN(a, b) {if (!Lawn::LDebug::m_bRunning) {String sz;\
|
2019-10-22 21:44:17 +02:00
|
|
|
for (int n=0; n<Lawn::LDebug::m_iTabDepth; n++)\
|
|
|
|
sz += "\t";\
|
2020-01-14 12:17:59 +01:00
|
|
|
LPRINT(a, sz + b);}}
|
2019-11-19 11:29:53 +01:00
|
|
|
|
|
|
|
//#define LPRINT_RUN(a, b) ;
|
|
|
|
|
2019-10-22 21:44:17 +02:00
|
|
|
#else
|
2019-10-09 12:33:19 +02:00
|
|
|
#define LPRINT_RUN(a, b) ;
|
2019-10-22 21:44:17 +02:00
|
|
|
#endif
|
2019-09-18 12:04:02 +02:00
|
|
|
|
2020-01-14 12:17:59 +01:00
|
|
|
#ifdef LDEBUG_VERBOSE
|
|
|
|
#define LPRINT(a, b) {LPRINT_IMPL(a, b);}
|
|
|
|
#else
|
|
|
|
#define LPRINT(a, b) {if (!Lawn::LDebug::m_bRunning) {LPRINT_IMPL(a, b);}}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define LPRINT_IMPL(a, b) {\
|
2019-09-18 12:04:02 +02:00
|
|
|
if (a >= Lawn::LDebug::m_iLoggingLevel)\
|
|
|
|
{\
|
|
|
|
Lawn::LDebug::print(b);\
|
|
|
|
}\
|
|
|
|
}
|
|
|
|
|
2020-01-14 12:17:59 +01:00
|
|
|
|
2019-09-18 12:04:02 +02:00
|
|
|
#define LWARN(a, b) if (a >= Lawn::LDebug::m_iWarningLevel)\
|
|
|
|
{\
|
|
|
|
Lawn::LDebug::print(String("\tWARNING : ") + b);\
|
|
|
|
}
|
|
|
|
|
2019-11-19 11:29:53 +01:00
|
|
|
String ftos(float f) {return String(Variant(f));}
|
|
|
|
|
2019-09-18 12:04:02 +02:00
|
|
|
|
|
|
|
namespace Lawn
|
|
|
|
{
|
|
|
|
|
|
|
|
class LDebug
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void print(String sz);
|
|
|
|
static int m_iLoggingLevel;
|
|
|
|
static int m_iWarningLevel;
|
|
|
|
static bool m_bRunning;
|
|
|
|
|
|
|
|
static int m_iTabDepth;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
2019-09-23 12:14:41 +02:00
|
|
|
|