Using “Array” instead of “array” is now fully deprecated, and I replaced the Log::Debug() etc. functions with msg::debug() etc. because log:: was unavailable due to being a maths function. Added up-to-date copyright notice and BOM to modified files, just in case.undefined
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine - Benchmark program | |||
| // Lol Engine — Benchmark program | |||
| // | |||
| // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2005—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #if HAVE_CONFIG_H | |||
| @@ -110,16 +111,16 @@ void bench_half(int mode) | |||
| for (size_t i = 0; i < sizeof(result) / sizeof(*result); i++) | |||
| result[i] *= 1e9f / (HALF_TABLE_SIZE * HALF_RUNS); | |||
| Log::Info(" ns/elem\n"); | |||
| Log::Info("float = half (array) %7.3f\n", result[0]); | |||
| Log::Info("float = half (fast) %7.3f\n", result[1]); | |||
| Log::Info("float = float %7.3f\n", result[2]); | |||
| Log::Info("float += half %7.3f\n", result[3]); | |||
| Log::Info("half = half %7.3f\n", result[4]); | |||
| Log::Info("half = -half %7.3f\n", result[5]); | |||
| Log::Info("half = float (array) %7.3f\n", result[6]); | |||
| Log::Info("half = float (fast) %7.3f\n", result[7]); | |||
| Log::Info("half = float (accurate) %7.3f\n", result[8]); | |||
| Log::Info("half += float %7.3f\n", result[9]); | |||
| msg::info(" ns/elem\n"); | |||
| msg::info("float = half (array) %7.3f\n", result[0]); | |||
| msg::info("float = half (fast) %7.3f\n", result[1]); | |||
| msg::info("float = float %7.3f\n", result[2]); | |||
| msg::info("float += half %7.3f\n", result[3]); | |||
| msg::info("half = half %7.3f\n", result[4]); | |||
| msg::info("half = -half %7.3f\n", result[5]); | |||
| msg::info("half = float (array) %7.3f\n", result[6]); | |||
| msg::info("half = float (fast) %7.3f\n", result[7]); | |||
| msg::info("half = float (accurate) %7.3f\n", result[8]); | |||
| msg::info("half += float %7.3f\n", result[9]); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine - Benchmark program | |||
| // Lol Engine — Benchmark program | |||
| // | |||
| // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2005—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #if HAVE_CONFIG_H | |||
| @@ -70,11 +71,11 @@ void bench_real(int mode) | |||
| for (size_t i = 0; i < sizeof(result) / sizeof(*result); i++) | |||
| result[i] *= 1e9f / (REAL_TABLE_SIZE * REAL_RUNS); | |||
| Log::Info(" ns/elem\n"); | |||
| Log::Info("real = real + real %7.3f\n", result[0]); | |||
| Log::Info("real = real * real %7.3f\n", result[1]); | |||
| Log::Info("real = real / real %7.3f\n", result[2]); | |||
| Log::Info("real = sin(real) %7.3f\n", result[3]); | |||
| Log::Info("real = exp(real) %7.3f\n", result[4]); | |||
| msg::info(" ns/elem\n"); | |||
| msg::info("real = real + real %7.3f\n", result[0]); | |||
| msg::info("real = real * real %7.3f\n", result[1]); | |||
| msg::info("real = real / real %7.3f\n", result[2]); | |||
| msg::info("real = sin(real) %7.3f\n", result[3]); | |||
| msg::info("real = exp(real) %7.3f\n", result[4]); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine - Benchmark program | |||
| // Lol Engine — Benchmark program | |||
| // | |||
| // Copyright: (c) 2005-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2005—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #if HAVE_CONFIG_H | |||
| @@ -173,18 +174,18 @@ void bench_trig(int mode) | |||
| for (size_t i = 0; i < sizeof(result) / sizeof(*result); i++) | |||
| result[i] *= 1e9f / (TRIG_TABLE_SIZE * TRIG_RUNS); | |||
| Log::Info(" ns/elem\n"); | |||
| Log::Info("float = sinf(float) %7.3f\n", result[0]); | |||
| Log::Info("float = f_sinf(float) %7.3f\n", result[1]); | |||
| Log::Info("float = lol_sin(float) %7.3f\n", result[2]); | |||
| Log::Info("float = cosf(float) %7.3f\n", result[3]); | |||
| Log::Info("float = f_cosf(float) %7.3f\n", result[4]); | |||
| Log::Info("float = lol_cos(float) %7.3f\n", result[5]); | |||
| Log::Info("float = sinf,cosf(float) %7.3f\n", result[6]); | |||
| Log::Info("float = f_sinf,f_cosf(float) %7.3f\n", result[7]); | |||
| Log::Info("float = lol_sincos(float) %7.3f\n", result[8]); | |||
| Log::Info("float = tanf(float) %7.3f\n", result[9]); | |||
| Log::Info("float = f_tanf(float) %7.3f\n", result[10]); | |||
| Log::Info("float = lol_tanf(float) %7.3f\n", result[11]); | |||
| msg::info(" ns/elem\n"); | |||
| msg::info("float = sinf(float) %7.3f\n", result[0]); | |||
| msg::info("float = f_sinf(float) %7.3f\n", result[1]); | |||
| msg::info("float = lol_sin(float) %7.3f\n", result[2]); | |||
| msg::info("float = cosf(float) %7.3f\n", result[3]); | |||
| msg::info("float = f_cosf(float) %7.3f\n", result[4]); | |||
| msg::info("float = lol_cos(float) %7.3f\n", result[5]); | |||
| msg::info("float = sinf,cosf(float) %7.3f\n", result[6]); | |||
| msg::info("float = f_sinf,f_cosf(float) %7.3f\n", result[7]); | |||
| msg::info("float = lol_sincos(float) %7.3f\n", result[8]); | |||
| msg::info("float = tanf(float) %7.3f\n", result[9]); | |||
| msg::info("float = f_tanf(float) %7.3f\n", result[10]); | |||
| msg::info("float = lol_tanf(float) %7.3f\n", result[11]); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine - Benchmark program | |||
| // Lol Engine — Benchmark program | |||
| // | |||
| // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2005—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #if HAVE_CONFIG_H | |||
| @@ -79,11 +80,11 @@ void bench_matrix(int mode) | |||
| for (size_t i = 0; i < sizeof(result) / sizeof(*result); i++) | |||
| result[i] *= 1e9f / (MATRIX_TABLE_SIZE * MATRIX_RUNS); | |||
| Log::Info(" ns/elem\n"); | |||
| Log::Info("mat4 = mat4 %7.3f\n", result[0]); | |||
| Log::Info("float = mat4.det() %7.3f\n", result[1]); | |||
| Log::Info("mat4 *= mat4 %7.3f\n", result[2]); | |||
| Log::Info("mat4 += mat4 %7.3f\n", result[3]); | |||
| Log::Info("mat4 = mat4.invert() %7.3f\n", result[4]); | |||
| msg::info(" ns/elem\n"); | |||
| msg::info("mat4 = mat4 %7.3f\n", result[0]); | |||
| msg::info("float = mat4.det() %7.3f\n", result[1]); | |||
| msg::info("mat4 *= mat4 %7.3f\n", result[2]); | |||
| msg::info("mat4 += mat4 %7.3f\n", result[3]); | |||
| msg::info("mat4 = mat4.invert() %7.3f\n", result[4]); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine - Benchmark program | |||
| // Lol Engine — Benchmark program | |||
| // | |||
| // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2005—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #if HAVE_CONFIG_H | |||
| @@ -27,39 +28,39 @@ int main(int argc, char **argv) | |||
| { | |||
| UNUSED(argc, argv); | |||
| Log::Info("-----------------------\n"); | |||
| Log::Info(" High precision floats\n"); | |||
| Log::Info("-----------------------\n"); | |||
| msg::info("-----------------------\n"); | |||
| msg::info(" High precision floats\n"); | |||
| msg::info("-----------------------\n"); | |||
| bench_real(1); | |||
| Log::Info("--------------------------\n"); | |||
| Log::Info(" Trigonometry [-1e5, 1e5]\n"); | |||
| Log::Info("--------------------------\n"); | |||
| msg::info("--------------------------\n"); | |||
| msg::info(" Trigonometry [-1e5, 1e5]\n"); | |||
| msg::info("--------------------------\n"); | |||
| bench_trig(1); | |||
| Log::Info("------------------------\n"); | |||
| Log::Info(" Trigonometry [-pi, pi]\n"); | |||
| Log::Info("------------------------\n"); | |||
| msg::info("------------------------\n"); | |||
| msg::info(" Trigonometry [-pi, pi]\n"); | |||
| msg::info("------------------------\n"); | |||
| bench_trig(2); | |||
| Log::Info("----------------------------\n"); | |||
| Log::Info(" Trigonometry [-1e-2, 1e-2]\n"); | |||
| Log::Info("----------------------------\n"); | |||
| msg::info("----------------------------\n"); | |||
| msg::info(" Trigonometry [-1e-2, 1e-2]\n"); | |||
| msg::info("----------------------------\n"); | |||
| bench_trig(3); | |||
| Log::Info("----------------------------\n"); | |||
| Log::Info(" Float matrices [-2.0, 2.0]\n"); | |||
| Log::Info("----------------------------\n"); | |||
| msg::info("----------------------------\n"); | |||
| msg::info(" Float matrices [-2.0, 2.0]\n"); | |||
| msg::info("----------------------------\n"); | |||
| bench_matrix(1); | |||
| Log::Info("-------------------------------------\n"); | |||
| Log::Info(" Half precision floats (random bits)\n"); | |||
| Log::Info("-------------------------------------\n"); | |||
| msg::info("-------------------------------------\n"); | |||
| msg::info(" Half precision floats (random bits)\n"); | |||
| msg::info("-------------------------------------\n"); | |||
| bench_half(1); | |||
| Log::Info("-----------------------------------\n"); | |||
| Log::Info(" Half precision floats [-2.0, 2.0]\n"); | |||
| Log::Info("-----------------------------------\n"); | |||
| msg::info("-----------------------------------\n"); | |||
| msg::info(" Half precision floats [-2.0, 2.0]\n"); | |||
| msg::info("-----------------------------------\n"); | |||
| bench_half(2); | |||
| #if defined _WIN32 | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine - Graphing tutorial | |||
| // Lol Engine — Graphing tutorial | |||
| // | |||
| // Copyright: (c) 2012-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2012—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #if HAVE_CONFIG_H | |||
| @@ -170,10 +171,10 @@ public: | |||
| float loluademo_inst_return = demo_loader->GetVar<float>("loluademo_inst_return"); | |||
| DemoObject* loluademo_inst = demo_loader->GetPtr<DemoObject>("loluademo_inst"); | |||
| Log::Info("Lua Vars: \ | |||
| msg::info("Lua Vars: \ | |||
| testvalue_num: %.2f, testvalue_int: %i, testvalue_uint: %i, testvalue_str: %s.\n", | |||
| testvalue_num, testvalue_int, testvalue_uint, testvalue_str.C()); | |||
| Log::Info("Lua Vars: \ | |||
| msg::info("Lua Vars: \ | |||
| function_return: %s, loluademo_return: %i, loluademo_inst_return: %.f, loluademo_getx: %i, loluademo_inst->m_x: %i.\n", | |||
| function_return.C(), loluademo_return, loluademo_inst_return, loluademo_getx, loluademo_inst->m_x); | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -28,7 +29,7 @@ void DumpStack() | |||
| { | |||
| #if EMSCRIPTEN | |||
| /* This would require demangling but we don't care yet. */ | |||
| Log::Debug("%s\n", emscripten_run_script_string("(new Error).stack")); | |||
| msg::debug("%s\n", emscripten_run_script_string("(new Error).stack")); | |||
| #elif HAVE_CXA_DEMANGLE && HAVE_BACKTRACE_SYMBOLS | |||
| /* Get current stack frames */ | |||
| void *stack_ptrs[50]; | |||
| @@ -36,7 +37,7 @@ void DumpStack() | |||
| char **callstack = backtrace_symbols(stack_ptrs, size); | |||
| if (size > 1) | |||
| Log::Debug("%d functions in stack trace:\n", (int)size - 1); | |||
| msg::debug("%d functions in stack trace:\n", (int)size - 1); | |||
| /* Parse stack frames, skipping the first element (because | |||
| * that’s ourselves) and print information. */ | |||
| @@ -67,13 +68,13 @@ void DumpStack() | |||
| if (ret == 0) | |||
| name = realname; | |||
| Log::Debug("#%d %s: %s+%s %s\n", (int)i, | |||
| msg::debug("#%d %s: %s+%s %s\n", (int)i, | |||
| callstack[i], name, offset, address); | |||
| free(realname); | |||
| } | |||
| else | |||
| { | |||
| Log::Debug("#%d %s\n", (int)i, callstack[i]); | |||
| msg::debug("#%d %s\n", (int)i, callstack[i]); | |||
| } | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -28,38 +29,38 @@ namespace lol | |||
| { | |||
| /* | |||
| * Public Log class | |||
| * Public log class | |||
| */ | |||
| void Log::Debug(char const *fmt, ...) | |||
| void msg::debug(char const *fmt, ...) | |||
| { | |||
| va_list ap; | |||
| va_start(ap, fmt); | |||
| Helper(DebugMessage, fmt, ap); | |||
| helper(MessageType::Debug, fmt, ap); | |||
| va_end(ap); | |||
| } | |||
| void Log::Info(char const *fmt, ...) | |||
| void msg::info(char const *fmt, ...) | |||
| { | |||
| va_list ap; | |||
| va_start(ap, fmt); | |||
| Helper(InfoMessage, fmt, ap); | |||
| helper(MessageType::Info, fmt, ap); | |||
| va_end(ap); | |||
| } | |||
| void Log::Warn(char const *fmt, ...) | |||
| void msg::warn(char const *fmt, ...) | |||
| { | |||
| va_list ap; | |||
| va_start(ap, fmt); | |||
| Helper(WarnMessage, fmt, ap); | |||
| helper(MessageType::Warning, fmt, ap); | |||
| va_end(ap); | |||
| } | |||
| void Log::Error(char const *fmt, ...) | |||
| void msg::error(char const *fmt, ...) | |||
| { | |||
| va_list ap; | |||
| va_start(ap, fmt); | |||
| Helper(ErrorMessage, fmt, ap); | |||
| helper(MessageType::Error, fmt, ap); | |||
| va_end(ap); | |||
| } | |||
| @@ -67,10 +68,10 @@ void Log::Error(char const *fmt, ...) | |||
| * Private helper function | |||
| */ | |||
| void Log::Helper(MessageType type, char const *fmt, va_list ap) | |||
| void msg::helper(MessageType type, char const *fmt, va_list ap) | |||
| { | |||
| #if defined __ANDROID__ | |||
| int const prio[] = | |||
| static int const prio[] = | |||
| { | |||
| ANDROID_LOG_DEBUG, | |||
| ANDROID_LOG_INFO, | |||
| @@ -79,10 +80,10 @@ void Log::Helper(MessageType type, char const *fmt, va_list ap) | |||
| }; | |||
| String buf = String::vformat(fmt, ap); | |||
| __android_log_print(prio[type], "LOL", "[%d] %s", (int)gettid(), &buf[0]); | |||
| __android_log_print(prio[(int)type], "LOL", "[%d] %s", (int)gettid(), &buf[0]); | |||
| #else | |||
| char const *prefix[] = | |||
| static char const * const prefix[] = | |||
| { | |||
| "DEBUG", | |||
| "INFO", | |||
| @@ -91,14 +92,14 @@ void Log::Helper(MessageType type, char const *fmt, va_list ap) | |||
| }; | |||
| # if defined _WIN32 | |||
| String buf = String(prefix[type]) + ": " + String::vformat(fmt, ap); | |||
| String buf = String(prefix[(int)type]) + ": " + String::vformat(fmt, ap); | |||
| array<WCHAR> widechar; | |||
| widechar.Resize(buf.count() + 1); | |||
| MultiByteToWideChar(CP_UTF8, 0, buf.C(), buf.count() + 1, widechar.data(), widechar.count()); | |||
| OutputDebugStringW(widechar.data()); | |||
| # else | |||
| fprintf(stderr, "%s: ", prefix[type]); | |||
| fprintf(stderr, "%s: ", prefix[(int)type]); | |||
| vfprintf(stderr, fmt, ap); | |||
| # endif | |||
| #endif | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -39,7 +40,7 @@ public: | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| if (nentities) | |||
| Log::Error("still %i entities in dict\n", nentities); | |||
| msg::error("still %i entities in dict\n", nentities); | |||
| #endif | |||
| } | |||
| @@ -134,7 +135,7 @@ void Dict::RemoveSlot(Entity *entity) | |||
| } | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("removing unregistered entity %p (%s)\n", | |||
| msg::error("removing unregistered entity %p (%s)\n", | |||
| entity, entity->GetName()); | |||
| #endif | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -80,7 +81,7 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
| data->dpy = XOpenDisplay(nullptr); | |||
| if (data->dpy == nullptr) | |||
| { | |||
| Log::Error("cannot connect to X server\n"); | |||
| msg::error("cannot connect to X server\n"); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -110,13 +111,13 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
| # endif | |||
| if (data->egl_dpy == EGL_NO_DISPLAY) | |||
| { | |||
| Log::Error("cannot get EGL display\n"); | |||
| msg::error("cannot get EGL display\n"); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| if (!eglInitialize(data->egl_dpy, nullptr, nullptr)) | |||
| { | |||
| Log::Error("cannot initialize EGL\n"); | |||
| msg::error("cannot initialize EGL\n"); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -138,19 +139,19 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
| EGLint num_config; | |||
| if (!eglChooseConfig(data->egl_dpy, attr, &ecfg, 1, &num_config)) | |||
| { | |||
| Log::Error("cannot choose EGL config (%i)\n", eglGetError()); | |||
| msg::error("cannot choose EGL config (%i)\n", eglGetError()); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| if (num_config != 1) | |||
| { | |||
| Log::Error("cannot choose between %i EGL configs\n", num_config); | |||
| msg::error("cannot choose between %i EGL configs\n", num_config); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| if (!eglBindAPI(EGL_OPENGL_ES_API)) | |||
| { | |||
| Log::Error("cannot bind OpenGL ES API (%i)\n", eglGetError()); | |||
| msg::error("cannot bind OpenGL ES API (%i)\n", eglGetError()); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -197,28 +198,28 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
| switch (eglGetError()) | |||
| { | |||
| case EGL_BAD_DISPLAY: | |||
| Log::Error("missing EGL display connection\n"); | |||
| msg::error("missing EGL display connection\n"); | |||
| break; | |||
| case EGL_NOT_INITIALIZED: | |||
| Log::Error("EGL display not initialized\n"); | |||
| msg::error("EGL display not initialized\n"); | |||
| break; | |||
| case EGL_BAD_CONFIG: | |||
| Log::Error("invalid EGL configuration\n"); | |||
| msg::error("invalid EGL configuration\n"); | |||
| break; | |||
| case EGL_BAD_NATIVE_WINDOW: | |||
| Log::Error("invalid EGL native window\n"); | |||
| msg::error("invalid EGL native window\n"); | |||
| break; | |||
| case EGL_BAD_ATTRIBUTE: | |||
| Log::Error("invalid EGL window attribute\n"); | |||
| msg::error("invalid EGL window attribute\n"); | |||
| break; | |||
| case EGL_BAD_ALLOC: | |||
| Log::Error("cannot allocate EGL surface\n"); | |||
| msg::error("cannot allocate EGL surface\n"); | |||
| break; | |||
| case EGL_BAD_MATCH: | |||
| Log::Error("unsupported EGL window\n"); | |||
| msg::error("unsupported EGL window\n"); | |||
| break; | |||
| default: | |||
| Log::Error("cannot create EGL surface (%i)\n", eglGetError()); | |||
| msg::error("cannot create EGL surface (%i)\n", eglGetError()); | |||
| break; | |||
| } | |||
| @@ -236,7 +237,7 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
| EGL_NO_CONTEXT, ctxattr); | |||
| if (data->egl_ctx == EGL_NO_CONTEXT) | |||
| { | |||
| Log::Error("cannot create EGL context (%i)\n", eglGetError()); | |||
| msg::error("cannot create EGL context (%i)\n", eglGetError()); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -36,7 +37,7 @@ Entity::~Entity() | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| if (!m_destroy) | |||
| Log::Error("entity destructor called directly\n"); | |||
| msg::error("entity destructor called directly\n"); | |||
| #endif | |||
| } | |||
| @@ -58,7 +59,7 @@ void Entity::TickGame(float seconds) | |||
| UNUSED(seconds); | |||
| #if !LOL_BUILD_RELEASE | |||
| if (m_tickstate != STATE_PRETICK_GAME) | |||
| Log::Error("invalid entity game tick\n"); | |||
| msg::error("invalid entity game tick\n"); | |||
| m_tickstate = STATE_POSTTICK_GAME; | |||
| #endif | |||
| } | |||
| @@ -68,7 +69,7 @@ void Entity::TickDraw(float seconds, Scene &scene) | |||
| (void)seconds; | |||
| #if !LOL_BUILD_RELEASE | |||
| if (m_tickstate != STATE_PRETICK_DRAW) | |||
| Log::Error("invalid entity draw tick\n"); | |||
| msg::error("invalid entity draw tick\n"); | |||
| m_tickstate = STATE_POSTTICK_DRAW; | |||
| #endif | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -88,7 +89,7 @@ Renderer::Renderer(ivec2 size) | |||
| m_data->m_d3d_ctx = Direct3DCreate9(D3D_SDK_VERSION); | |||
| if (!m_data->m_d3d_ctx) | |||
| { | |||
| Log::Error("cannot initialise D3D\n"); | |||
| msg::error("cannot initialise D3D\n"); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -119,7 +120,7 @@ Renderer::Renderer(ivec2 size) | |||
| &d3dpp, &m_data->m_d3d_dev); | |||
| if (FAILED(hr)) | |||
| { | |||
| Log::Error("cannot create D3D device\n"); | |||
| msg::error("cannot create D3D device\n"); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -129,7 +130,7 @@ Renderer::Renderer(ivec2 size) | |||
| GLenum glerr = glewInit(); | |||
| if (glerr != GLEW_OK) | |||
| { | |||
| Log::Error("cannot initialise GLEW: %s\n", glewGetErrorString(glerr)); | |||
| msg::error("cannot initialise GLEW: %s\n", glewGetErrorString(glerr)); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| # endif | |||
| @@ -1,9 +1,9 @@ | |||
| // | |||
| // Lol Engine | |||
| // | |||
| // Copyright © 2010-2015 Sam Hocevar <sam@hocevar.net> | |||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software. It comes without any warranty, to | |||
| // This library is free software. It comes without any warranty, to | |||
| // the extent permitted by applicable law. You can redistribute it | |||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||
| @@ -269,9 +269,9 @@ Shader::Shader(String const &name, | |||
| &data->vert_table); | |||
| if (FAILED(hr)) | |||
| { | |||
| Log::Error("failed to compile vertex shader %s: %s\n", name.C(), | |||
| msg::error("failed to compile vertex shader %s: %s\n", name.C(), | |||
| error_msg ? error_msg->GetBufferPointer() : "error"); | |||
| Log::Error("shader source:\n%s\n", vert); | |||
| msg::error("shader source:\n%s\n", vert); | |||
| } | |||
| data->m_dev->CreateVertexShader((DWORD *)shader_code->GetBufferPointer(), | |||
| &data->vert_shader); | |||
| @@ -287,14 +287,14 @@ Shader::Shader(String const &name, | |||
| glGetShaderiv(data->vert_id, GL_COMPILE_STATUS, &status); | |||
| if (status != GL_TRUE) | |||
| { | |||
| Log::Error("failed to compile vertex shader %s: %s\n", | |||
| msg::error("failed to compile vertex shader %s: %s\n", | |||
| name.C(), errbuf); | |||
| Log::Error("shader source:\n%s\n", shader_code.C()); | |||
| msg::error("shader source:\n%s\n", shader_code.C()); | |||
| } | |||
| else if (len > 16) | |||
| { | |||
| Log::Debug("compile log for vertex shader %s: %s\n", name.C(), errbuf); | |||
| Log::Debug("shader source:\n%s\n", shader_code.C()); | |||
| msg::debug("compile log for vertex shader %s: %s\n", name.C(), errbuf); | |||
| msg::debug("shader source:\n%s\n", shader_code.C()); | |||
| } | |||
| #endif | |||
| @@ -306,9 +306,9 @@ Shader::Shader(String const &name, | |||
| &data->frag_table); | |||
| if (FAILED(hr)) | |||
| { | |||
| Log::Error("failed to compile fragment shader %s: %s\n", name.C(), | |||
| msg::error("failed to compile fragment shader %s: %s\n", name.C(), | |||
| error_msg ? error_msg->GetBufferPointer() : "error"); | |||
| Log::Error("shader source:\n%s\n", frag); | |||
| msg::error("shader source:\n%s\n", frag); | |||
| } | |||
| data->m_dev->CreatePixelShader((DWORD *)shader_code->GetBufferPointer(), | |||
| &data->frag_shader); | |||
| @@ -324,15 +324,15 @@ Shader::Shader(String const &name, | |||
| glGetShaderiv(data->frag_id, GL_COMPILE_STATUS, &status); | |||
| if (status != GL_TRUE) | |||
| { | |||
| Log::Error("failed to compile fragment shader %s: %s\n", | |||
| msg::error("failed to compile fragment shader %s: %s\n", | |||
| name.C(), errbuf); | |||
| Log::Error("shader source:\n%s\n", shader_code.C()); | |||
| msg::error("shader source:\n%s\n", shader_code.C()); | |||
| } | |||
| else if (len > 16) | |||
| { | |||
| Log::Debug("compile log for fragment shader %s: %s\n", | |||
| msg::debug("compile log for fragment shader %s: %s\n", | |||
| name.C(), errbuf); | |||
| Log::Debug("shader source:\n%s\n", shader_code.C()); | |||
| msg::debug("shader source:\n%s\n", shader_code.C()); | |||
| } | |||
| #endif | |||
| @@ -366,11 +366,11 @@ Shader::Shader(String const &name, | |||
| glGetProgramiv(data->prog_id, GL_LINK_STATUS, &status); | |||
| if (status != GL_TRUE) | |||
| { | |||
| Log::Error("failed to link program %s: %s\n", name.C(), errbuf); | |||
| msg::error("failed to link program %s: %s\n", name.C(), errbuf); | |||
| } | |||
| else if (len > 16) | |||
| { | |||
| Log::Debug("link log for program %s: %s\n", name.C(), errbuf); | |||
| msg::debug("link log for program %s: %s\n", name.C(), errbuf); | |||
| } | |||
| GLint validated; | |||
| @@ -378,7 +378,7 @@ Shader::Shader(String const &name, | |||
| glGetProgramiv(data->prog_id, GL_VALIDATE_STATUS, &validated); | |||
| if (validated != GL_TRUE) | |||
| { | |||
| Log::Error("failed to validate program %s\n", name.C()); | |||
| msg::error("failed to validate program %s\n", name.C()); | |||
| } | |||
| GLint num_attribs; | |||
| @@ -416,7 +416,7 @@ Shader::Shader(String const &name, | |||
| if (usage == VertexUsage::MAX || index == -1) | |||
| { | |||
| Log::Error("unable to parse attribute semantic from name: %s\n", | |||
| msg::error("unable to parse attribute semantic from name: %s\n", | |||
| name_buffer); | |||
| } | |||
| else | |||
| @@ -428,7 +428,7 @@ Shader::Shader(String const &name, | |||
| #if _DEBUG | |||
| if (data->attrib_locations.has_key(flags)) | |||
| { | |||
| Log::Error("error while parsing attribute semantics in %s\n", | |||
| msg::error("error while parsing attribute semantics in %s\n", | |||
| name.C()); | |||
| } | |||
| #endif | |||
| @@ -459,7 +459,7 @@ ShaderAttrib Shader::GetAttribLocation(VertexUsage usage, int index) const | |||
| /* Only spit an error once, we don’t need to flood the console. */ | |||
| if (!data->attrib_errors.has_key(ret.m_flags)) | |||
| { | |||
| Log::Error("attribute %s not found in shader %s\n", | |||
| msg::error("attribute %s not found in shader %s\n", | |||
| usage.ToString().C(), data->m_name.C()); | |||
| data->attrib_errors[ret.m_flags] = true; | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -370,7 +371,7 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attribs[]) | |||
| if (attr_index == m_count) | |||
| { | |||
| Log::Error("stream #%d with usage %x not found in declaration\n", | |||
| msg::error("stream #%d with usage %x not found in declaration\n", | |||
| index, usage.ToScalar()); | |||
| attr_index = 0; | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -55,14 +56,14 @@ bool AndroidImageCodec::Load(Image *image, char const *path) | |||
| if (res < 0) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("JVM environment not found, trying to attach thread\n"); | |||
| msg::error("JVM environment not found, trying to attach thread\n"); | |||
| #endif | |||
| res = g_activity->vm->AttachCurrentThread(&env, nullptr); | |||
| } | |||
| if (res < 0) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("JVM environment not found, cannot open image %s\n", path); | |||
| msg::error("JVM environment not found, cannot open image %s\n", path); | |||
| #endif | |||
| return false; | |||
| } | |||
| @@ -77,7 +78,7 @@ bool AndroidImageCodec::Load(Image *image, char const *path) | |||
| if (!m_bmp) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("could not load %s\n", path); | |||
| msg::error("could not load %s\n", path); | |||
| #endif | |||
| return false; | |||
| } | |||
| @@ -121,7 +122,7 @@ bool AndroidImageCodec::Close() | |||
| if (res < 0) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("JVM environment not found, cannot close image\n"); | |||
| msg::error("JVM environment not found, cannot close image\n"); | |||
| #endif | |||
| return false; | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #if HAVE_CONFIG_H | |||
| @@ -55,7 +56,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path) | |||
| status = Gdiplus::GdiplusStartup(&token, &input, nullptr); | |||
| if (status != Gdiplus::Ok) | |||
| { | |||
| Log::Error("error %d while initialising GDI+\n", status); | |||
| msg::error("error %d while initialising GDI+\n", status); | |||
| return false; | |||
| } | |||
| @@ -68,7 +69,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path) | |||
| wchar_t *wpath = new wchar_t[len + 1]; | |||
| if (mbstowcs(wpath, fullpath.C(), len + 1) == (size_t)-1) | |||
| { | |||
| Log::Error("invalid image name %s\n", fullpath.C()); | |||
| msg::error("invalid image name %s\n", fullpath.C()); | |||
| delete[] wpath; | |||
| continue; | |||
| } | |||
| @@ -82,7 +83,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path) | |||
| if (status != Gdiplus::Ok) | |||
| { | |||
| if (status != Gdiplus::InvalidParameter) | |||
| Log::Error("error %d loading %s\n", | |||
| msg::error("error %d loading %s\n", | |||
| status, fullpath.C()); | |||
| delete bitmap; | |||
| bitmap = nullptr; | |||
| @@ -96,7 +97,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path) | |||
| if (!bitmap) | |||
| { | |||
| Log::Error("could not load %s\n", path); | |||
| msg::error("could not load %s\n", path); | |||
| return false; | |||
| } | |||
| @@ -106,7 +107,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path) | |||
| if (bitmap->LockBits(&rect, Gdiplus::ImageLockModeRead, | |||
| PixelFormat32bppARGB, &bdata) != Gdiplus::Ok) | |||
| { | |||
| Log::Error("could not lock bits in %s\n", path); | |||
| msg::error("could not lock bits in %s\n", path); | |||
| delete bitmap; | |||
| return false; | |||
| } | |||
| @@ -149,7 +150,7 @@ bool GdiPlusImageCodec::Save(Image *image, char const *path) | |||
| Gdiplus::GetImageEncodersSize(&num, &encoder_size); | |||
| if (num == 0) | |||
| { | |||
| Log::Error("no GDI+ image encoders found\n"); | |||
| msg::error("no GDI+ image encoders found\n"); | |||
| return false; | |||
| } | |||
| Gdiplus::ImageCodecInfo *codecs | |||
| @@ -170,7 +171,7 @@ bool GdiPlusImageCodec::Save(Image *image, char const *path) | |||
| wchar_t *wpath = new wchar_t[len + 1]; | |||
| if (mbstowcs(wpath, path, len + 1) == (size_t)-1) | |||
| { | |||
| Log::Error("could not convert GDI+ filename '%s' to widechar\n", path); | |||
| msg::error("could not convert GDI+ filename '%s' to widechar\n", path); | |||
| delete[] wpath; | |||
| delete[] codecs; | |||
| return false; | |||
| @@ -186,7 +187,7 @@ bool GdiPlusImageCodec::Save(Image *image, char const *path) | |||
| if (b->LockBits(&rect, (unsigned int)Gdiplus::ImageLockModeWrite, | |||
| PixelFormat32bppARGB, &bdata) != Gdiplus::Ok) | |||
| { | |||
| Log::Error("could not lock GDI+ image bits\n"); | |||
| msg::error("could not lock GDI+ image bits\n"); | |||
| delete b; | |||
| delete[] wpath; | |||
| delete[] codecs; | |||
| @@ -204,7 +205,7 @@ bool GdiPlusImageCodec::Save(Image *image, char const *path) | |||
| if (b->Save(wpath, &clsid, nullptr) != Gdiplus::Ok) | |||
| { | |||
| Log::Error("could not save GDI+ image '%s'\n", path); | |||
| msg::error("could not save GDI+ image '%s'\n", path); | |||
| delete[] wpath; | |||
| delete[] codecs; | |||
| delete b; | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -53,7 +54,7 @@ bool Imlib2ImageCodec::Load(Image *image, char const *path) | |||
| if (!im) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("could not load image %s\n", path); | |||
| msg::error("could not load image %s\n", path); | |||
| #endif | |||
| return false; | |||
| } | |||
| @@ -65,7 +66,7 @@ bool Imlib2ImageCodec::Load(Image *image, char const *path) | |||
| { | |||
| imlib_free_image(); | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("could not get image data for %s\n", path); | |||
| msg::error("could not get image data for %s\n", path); | |||
| #endif | |||
| return false; | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -50,7 +51,7 @@ bool IosImageCodec::Load(Image *image, char const *path) | |||
| if (!image) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("could not load %s\n", path); | |||
| msg::error("could not load %s\n", path); | |||
| #endif | |||
| return false; | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -58,7 +59,7 @@ bool SdlImageCodec::Load(Image *image, char const *path) | |||
| if (!surface) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("could not load image %s\n", path); | |||
| msg::error("could not load image %s\n", path); | |||
| #endif | |||
| return false; | |||
| } | |||
| @@ -1,9 +1,9 @@ | |||
| // | |||
| // Lol Engine | |||
| // | |||
| // Copyright © 2010-2015 Sam Hocevar <sam@hocevar.net> | |||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software. It comes without any warranty, to | |||
| // This library is free software. It comes without any warranty, to | |||
| // the extent permitted by applicable law. You can redistribute it | |||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||
| @@ -162,13 +162,13 @@ bool Image::Load(char const *path) | |||
| last_codec = codec; | |||
| if (codec->Load(this, path)) | |||
| { | |||
| Log::Info("Image::Load: Codec %s succesfully loaded %s.\n", codec->GetName(), path); | |||
| msg::info("Image::Load: Codec %s succesfully loaded %s.\n", codec->GetName(), path); | |||
| return true; | |||
| } | |||
| } | |||
| //Log error, because we shouldn't be here | |||
| Log::Error("Image::Load: Last codec %s, Error loading image %s.\n", last_codec->GetName(), path); | |||
| msg::error("Image::Load: Last codec %s, Error loading image %s.\n", last_codec->GetName(), path); | |||
| return false; | |||
| } | |||
| @@ -180,13 +180,13 @@ bool Image::Save(char const *path) | |||
| last_codec = codec; | |||
| if (codec->Save(this, path)) | |||
| { | |||
| Log::Info("Image::Save: Codec %s succesfully saved %s.\n", codec->GetName(), path); | |||
| msg::info("Image::Save: Codec %s succesfully saved %s.\n", codec->GetName(), path); | |||
| return true; | |||
| } | |||
| } | |||
| //Log error, because we shouldn't be here | |||
| Log::Error("Image::Save: Last codec %s, Error saving image %s.\n", last_codec->GetName(), path); | |||
| msg::error("Image::Save: Last codec %s, Error saving image %s.\n", last_codec->GetName(), path); | |||
| return false; | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Benjamin Litzelmann | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Benjamin Litzelmann | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -22,7 +23,7 @@ void KeyBinding::Bind(const String& device_name, const String& key_name) | |||
| if (!device) | |||
| { | |||
| Log::Warn("trying to bind key to nonexistent input device %s\n", | |||
| msg::warn("trying to bind key to nonexistent input device %s\n", | |||
| device_name.C()); | |||
| return; | |||
| } | |||
| @@ -30,7 +31,7 @@ void KeyBinding::Bind(const String& device_name, const String& key_name) | |||
| int keyindex = device->GetKeyIndex(key_name); | |||
| if (keyindex < 0) | |||
| { | |||
| Log::Warn("trying to bind nonexistent key %s.%s\n", | |||
| msg::warn("trying to bind nonexistent key %s.%s\n", | |||
| device_name.C(), key_name.C()); | |||
| return; | |||
| } | |||
| @@ -67,7 +68,7 @@ void AxisBinding::Bind(const String& device_name, const String& axis_name) | |||
| const InputDevice* device = InputDevice::Get(device_name); | |||
| if (!device) | |||
| { | |||
| Log::Warn("trying to bind axis to nonexistent input device %s\n", | |||
| msg::warn("trying to bind axis to nonexistent input device %s\n", | |||
| device_name.C()); | |||
| return; | |||
| } | |||
| @@ -75,7 +76,7 @@ void AxisBinding::Bind(const String& device_name, const String& axis_name) | |||
| int axisindex = device->GetAxisIndex(axis_name); | |||
| if (axisindex < 0) | |||
| { | |||
| Log::Warn("trying to bind nonexistent axis %s.%s\n", | |||
| msg::warn("trying to bind nonexistent axis %s.%s\n", | |||
| device_name.C(), axis_name.C()); | |||
| return; | |||
| } | |||
| @@ -88,7 +89,7 @@ void AxisBinding::BindKey(const String& device_name, const String& key_name) | |||
| const InputDevice* device = InputDevice::Get(device_name); | |||
| if (!device) | |||
| { | |||
| Log::Warn("trying to bind axis key to nonexistent input device %s\n", | |||
| msg::warn("trying to bind axis key to nonexistent input device %s\n", | |||
| device_name.C()); | |||
| return; | |||
| } | |||
| @@ -96,7 +97,7 @@ void AxisBinding::BindKey(const String& device_name, const String& key_name) | |||
| int keyindex = device->GetKeyIndex(key_name); | |||
| if (keyindex < 0) | |||
| { | |||
| Log::Warn("trying to bind nonexistent axis key %s.%s\n", | |||
| msg::warn("trying to bind nonexistent axis key %s.%s\n", | |||
| device_name.C(), key_name.C()); | |||
| return; | |||
| } | |||
| @@ -109,7 +110,7 @@ void AxisBinding::BindKeys(const String& device_name, const String& min_key_name | |||
| const InputDevice* device = InputDevice::Get(device_name); | |||
| if (!device) | |||
| { | |||
| Log::Warn("trying to bind axis keys to nonexistent input device %s\n", | |||
| msg::warn("trying to bind axis keys to nonexistent input device %s\n", | |||
| device_name.C()); | |||
| return; | |||
| } | |||
| @@ -117,7 +118,7 @@ void AxisBinding::BindKeys(const String& device_name, const String& min_key_name | |||
| int minkeyindex = device->GetKeyIndex(min_key_name); | |||
| if (minkeyindex < 0) | |||
| { | |||
| Log::Warn("trying to bind nonexistent axis key %s.%s\n", | |||
| msg::warn("trying to bind nonexistent axis key %s.%s\n", | |||
| device_name.C(), min_key_name.C()); | |||
| return; | |||
| } | |||
| @@ -125,7 +126,7 @@ void AxisBinding::BindKeys(const String& device_name, const String& min_key_name | |||
| int maxkeyindex = device->GetKeyIndex(max_key_name); | |||
| if (maxkeyindex < 0) | |||
| { | |||
| Log::Warn("trying to bind nonexistent axis key %s.%s\n", | |||
| msg::warn("trying to bind nonexistent axis key %s.%s\n", | |||
| device_name.C(), max_key_name.C()); | |||
| return; | |||
| } | |||
| @@ -236,7 +237,7 @@ Controller::Controller(String const &name) | |||
| m_active = false; | |||
| if (Get(name) != nullptr) | |||
| { | |||
| Log::Warn("controller “%s” has already been registered\n", name.C()); | |||
| msg::warn("controller “%s” has already been registered\n", name.C()); | |||
| } | |||
| controllers.push(this); | |||
| } | |||
| @@ -18,8 +18,12 @@ | |||
| namespace lol | |||
| { | |||
| /* | |||
| * Shuffle an array. | |||
| */ | |||
| template<typename T, typename ARRAY> | |||
| void array_base<T, ARRAY>::Shuffle() | |||
| void array_base<T, ARRAY>::shuffle() | |||
| { | |||
| auto n = count(); | |||
| auto ni = n; | |||
| @@ -30,8 +34,16 @@ void array_base<T, ARRAY>::Shuffle() | |||
| } | |||
| } | |||
| /* | |||
| * Sort an array | |||
| */ | |||
| template<typename T, typename ARRAY> | |||
| void array_base<T, ARRAY>::Sort(SortAlgorithm algorithm) | |||
| static void quick_swap_sort(array_base<T, ARRAY> &a, | |||
| ptrdiff_t start, ptrdiff_t stop); | |||
| template<typename T, typename ARRAY> | |||
| void array_base<T, ARRAY>::sort(SortAlgorithm algorithm) | |||
| { | |||
| #if !SORT_WORKS // yeah cause it's shite. | |||
| algorithm = SortAlgorithm::Bubble; | |||
| @@ -55,12 +67,13 @@ void array_base<T, ARRAY>::Sort(SortAlgorithm algorithm) | |||
| // Quick sort with swap | |||
| else if (algorithm == SortAlgorithm::QuickSwap) | |||
| { | |||
| SortQuickSwap(0, count_s()); | |||
| quick_swap_sort(*this, 0, count_s()); | |||
| } | |||
| } | |||
| template<typename T, typename ARRAY> | |||
| void array_base<T, ARRAY>::SortQuickSwap(ptrdiff_t start, ptrdiff_t stop) | |||
| static void quick_swap_sort(array_base<T, ARRAY> &a, | |||
| ptrdiff_t start, ptrdiff_t stop) | |||
| { | |||
| ptrdiff_t m[3] = | |||
| { | |||
| @@ -71,7 +84,7 @@ void array_base<T, ARRAY>::SortQuickSwap(ptrdiff_t start, ptrdiff_t stop) | |||
| for (int i = 0; i < 2; ) | |||
| { | |||
| if (m_data[m[i+1]] < m_data[m[i]]) | |||
| if (a[m[i+1]] < a[m[i]]) | |||
| { | |||
| ptrdiff_t mt = m[i+1]; | |||
| m[i+1] = m[i]; | |||
| @@ -81,34 +94,34 @@ void array_base<T, ARRAY>::SortQuickSwap(ptrdiff_t start, ptrdiff_t stop) | |||
| else | |||
| i++; | |||
| } | |||
| //actual stuff | |||
| T median = m_data[m[1]]; | |||
| ptrdiff_t i0 = start; | |||
| ptrdiff_t i1 = stop - 1; | |||
| // actual stuff | |||
| T median = a[m[1]]; | |||
| ptrdiff_t i0 = start, i1 = stop - 1; | |||
| bool b_swap = false; | |||
| while (i0 < i1) | |||
| { | |||
| if (!(m_data[i0] < median) && m_data[i1] < median) | |||
| if (!(a[i0] < median) && a[i1] < median) | |||
| { | |||
| std::swap(m_data[i0], m_data[i1]); | |||
| std::swap(a[i0], a[i1]); | |||
| i0++; | |||
| i1--; | |||
| b_swap = true; | |||
| } | |||
| else | |||
| { | |||
| if (m_data[i0] < median) | |||
| if (a[i0] < median) | |||
| i0++; | |||
| if (!(m_data[i1] < median)) | |||
| if (!(a[i1] < median)) | |||
| i1--; | |||
| } | |||
| } | |||
| if (stop - start == 1 || !b_swap) | |||
| return; | |||
| if (start < i0) | |||
| SortQuickSwap(start, i0); | |||
| quick_swap_sort(a, start, i0); | |||
| if (i0 < stop) | |||
| SortQuickSwap(i0, stop); | |||
| quick_swap_sort(a, i0, stop); | |||
| } | |||
| } /* namespace lol */ | |||
| @@ -367,20 +367,20 @@ public: | |||
| m_reserved = toreserve; | |||
| } | |||
| void Shuffle(); | |||
| void Sort(SortAlgorithm algorithm); | |||
| void SortQuickSwap(ptrdiff_t start, ptrdiff_t stop); | |||
| void shuffle(); | |||
| void sort(SortAlgorithm algorithm); | |||
| /* Support C++11 range-based for loops */ | |||
| class ConstIterator | |||
| class const_iterator | |||
| { | |||
| public: | |||
| ConstIterator(array_base const *that, ptrdiff_t pos) | |||
| const_iterator(array_base const *that, ptrdiff_t pos) | |||
| : m_pos(pos), | |||
| m_array(that) | |||
| { } | |||
| bool operator !=(const ConstIterator& that) const | |||
| bool operator !=(const const_iterator& that) const | |||
| { | |||
| return m_pos != that.m_pos; | |||
| } | |||
| @@ -390,7 +390,7 @@ public: | |||
| return (*m_array)[m_pos]; | |||
| } | |||
| ConstIterator const & operator ++() | |||
| const_iterator const & operator ++() | |||
| { | |||
| ++m_pos; | |||
| return *this; | |||
| @@ -401,15 +401,15 @@ public: | |||
| array_base const *m_array; | |||
| }; | |||
| class Iterator | |||
| class iterator | |||
| { | |||
| public: | |||
| Iterator(array_base *that, ptrdiff_t pos) | |||
| iterator(array_base *that, ptrdiff_t pos) | |||
| : m_pos(pos), | |||
| m_array(that) | |||
| { } | |||
| bool operator !=(const Iterator& that) const | |||
| bool operator !=(const iterator& that) const | |||
| { | |||
| return m_pos != that.m_pos; | |||
| } | |||
| @@ -419,7 +419,7 @@ public: | |||
| return (*m_array)[m_pos]; | |||
| } | |||
| Iterator const & operator ++() | |||
| iterator const & operator ++() | |||
| { | |||
| ++m_pos; | |||
| return *this; | |||
| @@ -532,38 +532,28 @@ public: | |||
| */ | |||
| template<typename... T> | |||
| typename array<T...>::Iterator begin(array<T...> &a) | |||
| typename array<T...>::iterator begin(array<T...> &a) | |||
| { | |||
| return typename array<T...>::Iterator(&a, 0); | |||
| return typename array<T...>::iterator(&a, 0); | |||
| } | |||
| template<typename... T> | |||
| typename array<T...>::Iterator end(array<T...> &a) | |||
| typename array<T...>::iterator end(array<T...> &a) | |||
| { | |||
| return typename array<T...>::Iterator(&a, a.count()); | |||
| return typename array<T...>::iterator(&a, a.count()); | |||
| } | |||
| template<typename... T> | |||
| typename array<T...>::ConstIterator begin(array<T...> const &a) | |||
| typename array<T...>::const_iterator begin(array<T...> const &a) | |||
| { | |||
| return typename array<T...>::ConstIterator(&a, 0); | |||
| return typename array<T...>::const_iterator(&a, 0); | |||
| } | |||
| template<typename... T> | |||
| typename array<T...>::ConstIterator end(array<T...> const &a) | |||
| typename array<T...>::const_iterator end(array<T...> const &a) | |||
| { | |||
| return typename array<T...>::ConstIterator(&a, a.count()); | |||
| return typename array<T...>::const_iterator(&a, a.count()); | |||
| } | |||
| /* | |||
| * Transitional alias for the deprecated camelcase version of lol::array | |||
| */ | |||
| #if LOL_FEATURE_CXX11_TEMPLATE_ALIASES | |||
| template<typename... T> using Array = array<T...>; | |||
| #else | |||
| # define Array array | |||
| #endif | |||
| } /* namespace lol */ | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #pragma once | |||
| @@ -109,13 +110,13 @@ static inline void DebugAbort() | |||
| */ | |||
| #define LOL_ERROR_1(t) \ | |||
| lol::Log::Error("assertion at %s:%d: %s\n", __FILE__, __LINE__, #t) | |||
| lol::msg::error("assertion at %s:%d: %s\n", __FILE__, __LINE__, #t) | |||
| #define LOL_ERROR_2(t, s) \ | |||
| lol::Log::Error("assertion at %s:%d: %s\n", __FILE__, __LINE__, s) | |||
| lol::msg::error("assertion at %s:%d: %s\n", __FILE__, __LINE__, s) | |||
| #define LOL_ERROR_3(t, s, ...) \ | |||
| lol::Log::Error("assertion at %s:%d: " s "\n", __FILE__, __LINE__, __VA_ARGS__) | |||
| lol::msg::error("assertion at %s:%d: " s "\n", __FILE__, __LINE__, __VA_ARGS__) | |||
| #if LOL_BUILD_RELEASE | |||
| # define ASSERT(...) UNUSED(LOL_CALL(LOL_1ST, (__VA_ARGS__))) | |||
| @@ -1,17 +1,18 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #pragma once | |||
| // | |||
| // The Log interface | |||
| // The msg interface | |||
| // ----------------- | |||
| // The central logging system. | |||
| // | |||
| @@ -22,7 +23,7 @@ | |||
| namespace lol | |||
| { | |||
| class Log | |||
| class msg | |||
| { | |||
| public: | |||
| #ifdef __GNUC__ | |||
| @@ -30,22 +31,22 @@ public: | |||
| #else | |||
| # define LOL_FMT_ATTR(n, p) | |||
| #endif | |||
| static void Debug(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| static void Info(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| static void Warn(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| static void Error(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| static void debug(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| static void info(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| static void warn(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| static void error(char const *format, ...) LOL_FMT_ATTR(1, 2); | |||
| #undef LOL_FMT_ATTR | |||
| private: | |||
| enum MessageType | |||
| enum class MessageType | |||
| { | |||
| DebugMessage, | |||
| InfoMessage, | |||
| WarnMessage, | |||
| ErrorMessage | |||
| Debug, | |||
| Info, | |||
| Warning, | |||
| Error | |||
| }; | |||
| static void Helper(MessageType type, char const *fmt, va_list ap); | |||
| static void helper(MessageType type, char const *fmt, va_list ap); | |||
| }; | |||
| } /* namespace lol */ | |||
| @@ -1,9 +1,9 @@ | |||
| // | |||
| // imGui integration in lolengine | |||
| // | |||
| // Copyright © 2009-2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||
| // Copyright © 2009—2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||
| // | |||
| // This program is free software. It comes without any warranty, to | |||
| // This library is free software. It comes without any warranty, to | |||
| // the extent permitted by applicable law. You can redistribute it | |||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||
| @@ -230,7 +230,7 @@ void LolImGui::TickGame(float seconds) | |||
| cursor.y = 1.f - cursor.y; | |||
| cursor *= video_size; | |||
| io.MousePos = ImVec2(cursor.x, cursor.y); | |||
| Log::Debug("%.2f/%.2f\n", io.MousePos.x, io.MousePos.y); | |||
| msg::debug("%.2f/%.2f\n", io.MousePos.x, io.MousePos.y); | |||
| io.MouseWheel = m_controller->GetAxisValue(LolImGuiAxis::Scroll); | |||
| for (int i = LolImGuiKey::MOUSE_KEY_START; i < LolImGuiKey::MOUSE_KEY_END; ++i) | |||
| @@ -243,11 +243,11 @@ void LolImGui::TickGame(float seconds) | |||
| case LolImGuiKey::Focus: | |||
| if (m_controller->IsKeyReleased(i)) | |||
| { | |||
| Log::Debug("Not focused .....\n"); | |||
| msg::debug("Not focused .....\n"); | |||
| io.MousePos = ImVec2(-1.f, -1.f); | |||
| } | |||
| else | |||
| Log::Debug("Focused !!\n"); | |||
| msg::debug("Focused !!\n"); | |||
| break; | |||
| } | |||
| } | |||
| @@ -1,10 +1,10 @@ | |||
| // | |||
| // Base Lua class for Lua script loading | |||
| // | |||
| // Copyright: (c) 2009-2015 Sam Hocevar <sam@hocevar.net> | |||
| // 2009-2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||
| // Copyright: © 2009—2015 Sam Hocevar <sam@hocevar.net> | |||
| // © 2009—2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||
| // | |||
| // This program is free software. It comes without any warranty, to | |||
| // This library is free software. It comes without any warranty, to | |||
| // the extent permitted by applicable law. You can redistribute it | |||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||
| @@ -29,7 +29,7 @@ class LuaBaseData | |||
| static int LuaPanic(LuaState* l) | |||
| { | |||
| char const *message = lua_tostring(l, -1); | |||
| Log::Error("%s\n", message); | |||
| msg::error("%s\n", message); | |||
| DebugAbort(); | |||
| return 0; | |||
| } | |||
| @@ -59,18 +59,18 @@ class LuaBaseData | |||
| String s = f.ReadString(); | |||
| f.Close(); | |||
| Log::Debug("loading Lua file %s\n", candidate.C()); | |||
| msg::debug("loading Lua file %s\n", candidate.C()); | |||
| status = LuaDoCode(l, s); | |||
| break; | |||
| } | |||
| } | |||
| if (status == LUA_ERRFILE) | |||
| Log::Error("could not find Lua file %s\n", filename); | |||
| msg::error("could not find Lua file %s\n", filename); | |||
| else if (status == 1) | |||
| { | |||
| LuaString error; error.Get(l, -1); | |||
| Log::Error("Lua error %s\n", error().C()); | |||
| msg::error("Lua error %s\n", error().C()); | |||
| lua_pop(l, 1); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -16,7 +17,7 @@ namespace lol | |||
| { | |||
| #define LOL_PRINTF_TOSTRING(type, ...) \ | |||
| template<> void type::printf() const { Log::Debug(__VA_ARGS__); } \ | |||
| template<> void type::printf() const { msg::debug(__VA_ARGS__); } \ | |||
| template<> String type::tostring() const { return String::format(__VA_ARGS__); } | |||
| LOL_PRINTF_TOSTRING(vec2, "[ %6.6f %6.6f ]\n", x, y); | |||
| @@ -32,8 +33,8 @@ template<> void mat2::printf() const | |||
| { | |||
| mat2 const &p = *this; | |||
| Log::Debug("[ %6.6f %6.6f\n", p[0][0], p[1][0]); | |||
| Log::Debug(" %6.6f %6.6f ]\n", p[0][1], p[1][1]); | |||
| msg::debug("[ %6.6f %6.6f\n", p[0][0], p[1][0]); | |||
| msg::debug(" %6.6f %6.6f ]\n", p[0][1], p[1][1]); | |||
| } | |||
| template<> String mat2::tostring() const | |||
| @@ -48,9 +49,9 @@ template<> void mat3::printf() const | |||
| { | |||
| mat3 const &p = *this; | |||
| Log::Debug("[ %6.6f %6.6f %6.6f\n", p[0][0], p[1][0], p[2][0]); | |||
| Log::Debug(" %6.6f %6.6f %6.6f\n", p[0][1], p[1][1], p[2][1]); | |||
| Log::Debug(" %6.6f %6.6f %6.6f ]\n", p[0][2], p[1][2], p[2][2]); | |||
| msg::debug("[ %6.6f %6.6f %6.6f\n", p[0][0], p[1][0], p[2][0]); | |||
| msg::debug(" %6.6f %6.6f %6.6f\n", p[0][1], p[1][1], p[2][1]); | |||
| msg::debug(" %6.6f %6.6f %6.6f ]\n", p[0][2], p[1][2], p[2][2]); | |||
| } | |||
| template<> String mat3::tostring() const | |||
| @@ -66,13 +67,13 @@ template<> void mat4::printf() const | |||
| { | |||
| mat4 const &p = *this; | |||
| Log::Debug("[ %6.6f %6.6f %6.6f %6.6f\n", | |||
| msg::debug("[ %6.6f %6.6f %6.6f %6.6f\n", | |||
| p[0][0], p[1][0], p[2][0], p[3][0]); | |||
| Log::Debug(" %6.6f %6.6f %6.6f %6.6f\n", | |||
| msg::debug(" %6.6f %6.6f %6.6f %6.6f\n", | |||
| p[0][1], p[1][1], p[2][1], p[3][1]); | |||
| Log::Debug(" %6.6f %6.6f %6.6f %6.6f\n", | |||
| msg::debug(" %6.6f %6.6f %6.6f %6.6f\n", | |||
| p[0][2], p[1][2], p[2][2], p[3][2]); | |||
| Log::Debug(" %6.6f %6.6f %6.6f %6.6f ]\n", | |||
| msg::debug(" %6.6f %6.6f %6.6f %6.6f ]\n", | |||
| p[0][3], p[1][3], p[2][3], p[3][3]); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -117,7 +118,7 @@ void SubMesh::Render() | |||
| if (m_vbos[i] == nullptr) | |||
| { | |||
| Log::Error("trying to render a mesh with a null VBO\n"); | |||
| msg::error("trying to render a mesh with a null VBO\n"); | |||
| continue; | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -40,7 +41,7 @@ AAssetManager *g_assets; | |||
| extern "C" jint | |||
| JNI_OnLoad(JavaVM* vm, void* reserved) | |||
| { | |||
| Log::Info("Java layer loading library, vm=0x%08lx", (long)(intptr_t)vm); | |||
| msg::info("Java layer loading library, vm=0x%08lx", (long)(intptr_t)vm); | |||
| return JNI_VERSION_1_4; | |||
| } | |||
| @@ -142,7 +143,7 @@ int lol::AndroidAppData::CreateDisplay() | |||
| if (eglMakeCurrent(m_display, m_surface, m_surface, m_context) == EGL_FALSE) | |||
| { | |||
| Log::Error("unable to eglMakeCurrent"); | |||
| msg::error("unable to eglMakeCurrent"); | |||
| return -1; | |||
| } | |||
| @@ -150,7 +151,7 @@ int lol::AndroidAppData::CreateDisplay() | |||
| eglQuerySurface(m_display, m_surface, EGL_HEIGHT, &h); | |||
| /* Launch our renderer */ | |||
| Log::Info("Java layer initialising renderer (%dx%d)", w, h); | |||
| msg::info("Java layer initialising renderer (%dx%d)", w, h); | |||
| Video::Setup(ivec2(w, h)); | |||
| return 0; | |||
| @@ -265,7 +266,7 @@ AndroidAppData *g_data; | |||
| void android_main(android_app* native_app) | |||
| { | |||
| Log::Info("Java layer calling android_main() for app 0x%08lx", | |||
| msg::info("Java layer calling android_main() for app 0x%08lx", | |||
| (long)native_app); | |||
| /* Register native activity */ | |||
| @@ -276,12 +277,12 @@ void android_main(android_app* native_app) | |||
| jint res = g_activity->vm->GetEnv((void **)&jni_env, JNI_VERSION_1_2); | |||
| if (res < 0) | |||
| { | |||
| Log::Info("JVM environment not found, trying to attach thread\n"); | |||
| msg::info("JVM environment not found, trying to attach thread\n"); | |||
| res = g_activity->vm->AttachCurrentThread(&jni_env, nullptr); | |||
| } | |||
| if (res < 0) | |||
| { | |||
| Log::Error("JVM environment not found, cannot run main()\n"); | |||
| msg::error("JVM environment not found, cannot run main()\n"); | |||
| return; | |||
| } | |||
| @@ -327,7 +328,7 @@ void android_main(android_app* native_app) | |||
| source->process(native_app, source); | |||
| } | |||
| Log::Info("Java layer running real main()\n"); | |||
| msg::info("Java layer running real main()\n"); | |||
| /* Call the user's main() function. One of these will work. */ | |||
| lol_android_main(); | |||
| @@ -339,7 +340,7 @@ lol::AndroidApp::AndroidApp(char const *title, ivec2 res, float fps) | |||
| : m_data(g_data) | |||
| { | |||
| /* Launch our ticker */ | |||
| Log::Info("Java layer initialising ticker at %g fps", fps); | |||
| msg::info("Java layer initialising ticker at %g fps", fps); | |||
| Ticker::Setup(fps); | |||
| m_data->m_wanted_resolution = res; | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -69,7 +70,7 @@ SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res) | |||
| { | |||
| if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) < 0) | |||
| { | |||
| Log::Error("cannot initialise SDL: %s\n", SDL_GetError()); | |||
| msg::error("cannot initialise SDL: %s\n", SDL_GetError()); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| } | |||
| @@ -85,7 +86,7 @@ SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res) | |||
| SDL_WINDOW_OPENGL); | |||
| if (!data->m_window) | |||
| { | |||
| Log::Error("cannot create rendering window: %s\n", SDL_GetError()); | |||
| msg::error("cannot create rendering window: %s\n", SDL_GetError()); | |||
| SDL_Quit(); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -116,7 +117,7 @@ SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res) | |||
| if (!data->m_window) | |||
| { | |||
| Log::Error("cannot create rendering window: %s\n", SDL_GetError()); | |||
| msg::error("cannot create rendering window: %s\n", SDL_GetError()); | |||
| SDL_Quit(); | |||
| exit(EXIT_FAILURE); | |||
| } | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -74,7 +75,7 @@ static int sdl12_to_scancode(int ch, int sc) | |||
| case id: return String(str); | |||
| # include "input/keys.h" | |||
| default: | |||
| Log::Error("ScanCodeToText unknown scancode %0d\n", sc); | |||
| msg::error("ScanCodeToText unknown scancode %0d\n", sc); | |||
| } | |||
| return String(); | |||
| } | |||
| @@ -87,7 +88,7 @@ static int sdl12_to_scancode(int ch, int sc) | |||
| case id: return String(#name); | |||
| # include "input/keys.h" | |||
| default: | |||
| Log::Error("ScanCodeToText unknown scancode %0d\n", sc); | |||
| msg::error("ScanCodeToText unknown scancode %0d\n", sc); | |||
| } | |||
| return String(); | |||
| } | |||
| @@ -290,7 +291,7 @@ void SdlInputData::Tick(float seconds) | |||
| } | |||
| m_keyboard->SetKey(sc2, !m_keyboard->GetKey(sc2)); | |||
| /* DEBUG STUFF | |||
| Log::Info("Repeat: 0x%02x : %s/%s/%s/%i\n", | |||
| msg::info("Repeat: 0x%02x : %s/%s/%s/%i\n", | |||
| (int)m_keyboard, ScanCodeToText(sc2).C(), ScanCodeToName(sc2).C(), | |||
| m_keyboard->GetKey(sc2) ? "up" : "down", event.key.repeat); | |||
| */ | |||
| @@ -317,14 +318,14 @@ void SdlInputData::Tick(float seconds) | |||
| m_keyboard->AddText(str); | |||
| } | |||
| /* DEBUG STUFF | |||
| Log::Info("Repeat: 0x%02x : %s/%s/%s/%i\n", | |||
| msg::info("Repeat: 0x%02x : %s/%s/%s/%i\n", | |||
| (int)m_keyboard, ScanCodeToText(sc).C(), ScanCodeToName(sc).C(), | |||
| event.type == SDL_KEYDOWN ? "up" : "down", event.key.repeat); | |||
| */ | |||
| } | |||
| /* DEBUG STUFF | |||
| else | |||
| Log::Error("unknown keypress (sym 0x%02x, scancode %0d)\n", | |||
| msg::error("unknown keypress (sym 0x%02x, scancode %0d)\n", | |||
| event.key.keysym.sym, event.key.keysym.scancode); | |||
| */ | |||
| # endif | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -64,7 +65,7 @@ Sample::Sample(char const *path) | |||
| } | |||
| if (!data->m_chunk) | |||
| { | |||
| Log::Error("could not load sample %s: %s\n", path, Mix_GetError()); | |||
| msg::error("could not load sample %s: %s\n", path, Mix_GetError()); | |||
| } | |||
| data->m_channel = -1; | |||
| #endif | |||
| @@ -1,11 +1,12 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // Copyright: © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| // http://www.wtfpl.net/ for more details. | |||
| // | |||
| #include <lol/engine-internal.h> | |||
| @@ -42,9 +43,9 @@ void Init(int argc, char *argv[], | |||
| { | |||
| using namespace std; | |||
| Log::Debug("project dir: “%s”\n", projectdir.C()); | |||
| Log::Debug("solution dir: “%s”\n", solutiondir.C()); | |||
| Log::Debug("source subdir: “%s”\n", sourcesubdir.C()); | |||
| msg::debug("project dir: “%s”\n", projectdir.C()); | |||
| msg::debug("solution dir: “%s”\n", solutiondir.C()); | |||
| msg::debug("source subdir: “%s”\n", sourcesubdir.C()); | |||
| /* | |||
| * Retrieve binary directory, defaulting to no directory on Android | |||
| @@ -138,9 +139,9 @@ void Init(int argc, char *argv[], | |||
| got_rootdir = true; | |||
| } | |||
| Log::Debug("binary dir: “%s”\n", binarydir.C()); | |||
| msg::debug("binary dir: “%s”\n", binarydir.C()); | |||
| for (int i = 0; i < data_dir.count(); ++i) | |||
| Log::Debug("data dir %d/%d: “%s”\n", i + 1, data_dir.count(), | |||
| msg::debug("data dir %d/%d: “%s”\n", i + 1, data_dir.count(), | |||
| data_dir[i].C()); | |||
| } | |||
| @@ -1,8 +1,8 @@ | |||
| // | |||
| // Lol Engine | |||
| // | |||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // © 2014—2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // © 2014—2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||
| // | |||
| // This library is free software. It comes without any warranty, to | |||
| // the extent permitted by applicable law. You can redistribute it | |||
| @@ -223,7 +223,7 @@ void AsyncImageLoader::TreatResult(ThreadJob* result) | |||
| } | |||
| else | |||
| { | |||
| Log::Error("AsyncImageJob FAILED. See load image error above.\n"); | |||
| msg::error("AsyncImageJob FAILED. See load image error above.\n"); | |||
| } | |||
| //Delete all that | |||
| delete(result); | |||
| @@ -1,7 +1,7 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine — unit tests | |||
| // | |||
| // Copyright © 2010-2015 Sam Hocevar <sam@hocevar.net> | |||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // | |||
| // This program is free software. It comes without any warranty, to | |||
| // the extent permitted by applicable law. You can redistribute it | |||
| @@ -69,7 +69,7 @@ lolunit_declare_fixture(MapTest) | |||
| } | |||
| for (int i = 0; i < a.count(); i++) | |||
| m[i] = i; | |||
| a.Shuffle(); | |||
| a.shuffle(); | |||
| for (int i = 0; i < a.count(); i++) | |||
| m.remove(a[i]); | |||
| } | |||
| @@ -86,7 +86,7 @@ lolunit_declare_fixture(MapTest) | |||
| } | |||
| for (int i = 0; i < a.count(); i++) | |||
| m[a[i]] = i; | |||
| a.Shuffle(); | |||
| a.shuffle(); | |||
| for (int i = 0; i < a.count(); i++) | |||
| m.remove(a[i]); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| // | |||
| // Lol Engine | |||
| // Lol Engine — unit tests | |||
| // | |||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
| // © 2014—2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||
| @@ -38,9 +38,9 @@ lolunit_declare_fixture(thread_test) | |||
| { | |||
| Timer timer; | |||
| m_done = false; | |||
| Log::Info("%s: STARTED WORK\n", GetName()); | |||
| msg::info("%s: STARTED WORK\n", GetName()); | |||
| timer.Wait(2.f); | |||
| Log::Info("%s: ENDED WORK\n", GetName()); | |||
| msg::info("%s: ENDED WORK\n", GetName()); | |||
| m_done = true; | |||
| return true; | |||
| } | |||
| @@ -81,14 +81,14 @@ lolunit_declare_fixture(thread_test) | |||
| void AddJob(ThreadJob* job) | |||
| { | |||
| Log::Info("%s DISPATCHING JOB %s\n", GetName(), job->GetName()); | |||
| msg::info("%s DISPATCHING JOB %s\n", GetName(), job->GetName()); | |||
| DispatchJob(job); | |||
| } | |||
| bool GetWorkResult(array<ThreadJob*>& results) | |||
| { | |||
| results += m_job_result; | |||
| m_job_result.empty(); | |||
| Log::Info("%s GETWORKRESULT (%i)\n", GetName(), results.count()); | |||
| msg::info("%s GETWORKRESULT (%i)\n", GetName(), results.count()); | |||
| return results.count() > 0; | |||
| } | |||
| @@ -99,7 +99,7 @@ lolunit_declare_fixture(thread_test) | |||
| case UnitTestStatus::NOT_QUEUED: | |||
| if (!!GetDispatchCount()) | |||
| { | |||
| Log::Info("%s TICKGAME %s\n", GetName(), m_status.ToString().C()); | |||
| msg::info("%s TICKGAME %s\n", GetName(), m_status.ToString().C()); | |||
| m_status = UnitTestStatus::QUEUED; | |||
| } | |||
| break; | |||
| @@ -110,14 +110,14 @@ lolunit_declare_fixture(thread_test) | |||
| if (GetDispatchedCount()) | |||
| #endif | |||
| { | |||
| Log::Info("%s TICKGAME %s\n", GetName(), m_status.ToString().C()); | |||
| msg::info("%s TICKGAME %s\n", GetName(), m_status.ToString().C()); | |||
| m_status = UnitTestStatus::RETRIEVED; | |||
| } | |||
| break; | |||
| case UnitTestStatus::RETRIEVED: | |||
| if (m_job_result.count() == 4) | |||
| { | |||
| Log::Info("%s TICKGAME %s\n", GetName(), m_status.ToString().C()); | |||
| msg::info("%s TICKGAME %s\n", GetName(), m_status.ToString().C()); | |||
| m_status = UnitTestStatus::DONE; | |||
| } | |||
| break; | |||
| @@ -151,10 +151,10 @@ lolunit_declare_fixture(thread_test) | |||
| lolunit_declare_test(threads) | |||
| { | |||
| Log::Info("%s START\n", m_manager.GetName()); | |||
| msg::info("%s START\n", m_manager.GetName()); | |||
| //Start threads manager | |||
| m_manager.Start(); | |||
| Log::Info("%s STARTED\n", m_manager.GetName()); | |||
| msg::info("%s STARTED\n", m_manager.GetName()); | |||
| UnitTestJob job[4]; | |||
| lolunit_assert_equal(0, m_manager.Test_GetDispatchCount()); | |||
| @@ -187,10 +187,10 @@ lolunit_declare_fixture(thread_test) | |||
| m_manager.GetWorkResult(results); | |||
| lolunit_assert_equal(4, results.count()); | |||
| Log::Info("%s STOP\n", m_manager.GetName()); | |||
| msg::info("%s STOP\n", m_manager.GetName()); | |||
| //Stop manager | |||
| m_manager.Stop(); | |||
| Log::Info("%s STOPPED\n", m_manager.GetName()); | |||
| msg::info("%s STOPPED\n", m_manager.GetName()); | |||
| } | |||
| lolunit_declare_test(queue_try_push) | |||
| @@ -44,7 +44,7 @@ public: | |||
| "still %d entities in ticker\n", nentities); | |||
| ASSERT(m_autolist.count() == 0, | |||
| "still %d autoreleased entities\n", m_autolist.count()); | |||
| Log::Debug("%d frames required to quit\n", frame - quitframe); | |||
| msg::debug("%d frames required to quit\n", frame - quitframe); | |||
| #if LOL_FEATURE_THREADS | |||
| gametick.push(0); | |||
| @@ -150,7 +150,7 @@ int Ticker::Unref(Entity *entity) | |||
| void TickerData::GameThreadMain() | |||
| { | |||
| #if LOL_BUILD_DEBUG | |||
| Log::Info("ticker game thread initialised\n"); | |||
| msg::info("ticker game thread initialised\n"); | |||
| #endif | |||
| for (;;) | |||
| @@ -167,7 +167,7 @@ void TickerData::GameThreadMain() | |||
| drawtick.push(0); | |||
| #if LOL_BUILD_DEBUG | |||
| Log::Info("ticker game thread terminated\n"); | |||
| msg::info("ticker game thread terminated\n"); | |||
| #endif | |||
| } | |||
| #endif /* LOL_FEATURE_THREADS */ | |||
| @@ -176,7 +176,7 @@ void TickerData::GameThreadMain() | |||
| void TickerData::DrawThreadMain() /* unused */ | |||
| { | |||
| #if LOL_BUILD_DEBUG | |||
| Log::Info("ticker draw thread initialised\n"); | |||
| msg::info("ticker draw thread initialised\n"); | |||
| #endif | |||
| for (;;) | |||
| @@ -191,7 +191,7 @@ void TickerData::DrawThreadMain() /* unused */ | |||
| } | |||
| #if LOL_BUILD_DEBUG | |||
| Log::Info("ticker draw thread terminated\n"); | |||
| msg::info("ticker draw thread terminated\n"); | |||
| #endif | |||
| } | |||
| #endif /* LOL_FEATURE_THREADS */ | |||
| @@ -213,16 +213,16 @@ void TickerData::GameThreadTick() | |||
| Profiler::Start(Profiler::STAT_TICK_GAME); | |||
| #if 0 | |||
| Log::Debug("-------------------------------------\n"); | |||
| msg::debug("-------------------------------------\n"); | |||
| for (int g = 0; g < Entity::ALLGROUP_END; ++g) | |||
| { | |||
| Log::Debug("%s Group %d\n", | |||
| msg::debug("%s Group %d\n", | |||
| (g < Entity::GAMEGROUP_END) ? "Game" : "Draw", g); | |||
| for (int i = 0; i < data->m_list[g].count(); ++i) | |||
| { | |||
| Entity *e = data->m_list[g][i]; | |||
| Log::Debug(" \\-- [%p] %s (m_ref %d, destroy %d)\n", | |||
| msg::debug(" \\-- [%p] %s (m_ref %d, destroy %d)\n", | |||
| e, e->GetName(), e->m_ref, e->m_destroy); | |||
| } | |||
| } | |||
| @@ -255,7 +255,7 @@ void TickerData::GameThreadTick() | |||
| data->keepalive += data->deltatime; | |||
| if (data->keepalive > 10.f) | |||
| { | |||
| Log::Info("ticker keepalive: tick!\n"); | |||
| msg::info("ticker keepalive: tick!\n"); | |||
| data->keepalive = 0.f; | |||
| } | |||
| #endif | |||
| @@ -276,7 +276,7 @@ void TickerData::GameThreadTick() | |||
| if (e->m_ref) | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| Log::Error("poking %s\n", e->GetName()); | |||
| msg::error("poking %s\n", e->GetName()); | |||
| #endif | |||
| e->m_ref--; | |||
| n++; | |||
| @@ -285,7 +285,7 @@ void TickerData::GameThreadTick() | |||
| #if !LOL_BUILD_RELEASE | |||
| if (n) | |||
| Log::Error("%d entities stuck after %d frames, poked %d\n", | |||
| msg::error("%d entities stuck after %d frames, poked %d\n", | |||
| data->nentities, data->quitdelay, n); | |||
| #endif | |||
| @@ -397,14 +397,14 @@ void TickerData::GameThreadTick() | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| if (e->m_tickstate != Entity::STATE_IDLE) | |||
| Log::Error("entity %s [%p] not idle for game tick\n", | |||
| msg::error("entity %s [%p] not idle for game tick\n", | |||
| e->GetName(), e); | |||
| e->m_tickstate = Entity::STATE_PRETICK_GAME; | |||
| #endif | |||
| e->TickGame(data->deltatime); | |||
| #if !LOL_BUILD_RELEASE | |||
| if (e->m_tickstate != Entity::STATE_POSTTICK_GAME) | |||
| Log::Error("entity %s [%p] missed super game tick\n", | |||
| msg::error("entity %s [%p] missed super game tick\n", | |||
| e->GetName(), e); | |||
| e->m_tickstate = Entity::STATE_IDLE; | |||
| #endif | |||
| @@ -446,14 +446,14 @@ void TickerData::DrawThreadTick() | |||
| { | |||
| #if !LOL_BUILD_RELEASE | |||
| if (e->m_tickstate != Entity::STATE_IDLE) | |||
| Log::Error("entity %s [%p] not idle for draw tick\n", | |||
| msg::error("entity %s [%p] not idle for draw tick\n", | |||
| e->GetName(), e); | |||
| e->m_tickstate = Entity::STATE_PRETICK_DRAW; | |||
| #endif | |||
| e->TickDraw(data->deltatime, Scene::GetScene(scene_idx)); | |||
| #if !LOL_BUILD_RELEASE | |||
| if (e->m_tickstate != Entity::STATE_POSTTICK_DRAW) | |||
| Log::Error("entity %s [%p] missed super draw tick\n", | |||
| msg::error("entity %s [%p] missed super draw tick\n", | |||
| e->GetName(), e); | |||
| e->m_tickstate = Entity::STATE_IDLE; | |||
| #endif | |||