@@ -5,7 +5,7 @@ liblol_a_SOURCES = \ | |||||
core.h matrix.cpp matrix.h tiler.cpp tiler.h dict.cpp dict.h \ | core.h matrix.cpp matrix.h tiler.cpp tiler.h dict.cpp dict.h \ | ||||
audio.cpp audio.h scene.cpp scene.h font.cpp font.h layer.cpp layer.h \ | audio.cpp audio.h scene.cpp scene.h font.cpp font.h layer.cpp layer.h \ | ||||
map.cpp map.h entity.cpp entity.h ticker.cpp ticker.h lolgl.h \ | map.cpp map.h entity.cpp entity.h ticker.cpp ticker.h lolgl.h \ | ||||
tileset.cpp tileset.h forge.cpp forge.h video.cpp video.h \ | |||||
tileset.cpp tileset.h forge.cpp forge.h video.cpp video.h log.cpp log.h \ | |||||
timer.cpp timer.h bitfield.h profiler.cpp profiler.h input.h input.cpp \ | timer.cpp timer.h bitfield.h profiler.cpp profiler.h input.h input.cpp \ | ||||
world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \ | world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \ | ||||
text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \ | text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \ | ||||
@@ -22,6 +22,7 @@ | |||||
#include "timer.h" | #include "timer.h" | ||||
// Static classes | // Static classes | ||||
#include "log.h" | |||||
#include "video.h" | #include "video.h" | ||||
#include "audio.h" | #include "audio.h" | ||||
#include "scene.h" | #include "scene.h" | ||||
@@ -46,7 +46,7 @@ public: | |||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (nentities) | if (nentities) | ||||
fprintf(stderr, "ERROR: still %i entities in dict\n", nentities); | |||||
Log::Error("still %i entities in dict\n", nentities); | |||||
#endif | #endif | ||||
free(entities); | free(entities); | ||||
} | } | ||||
@@ -57,7 +57,7 @@ EglApp::EglApp(char const *title, vec2i res, float fps) : | |||||
data->dpy = XOpenDisplay(NULL); | data->dpy = XOpenDisplay(NULL); | ||||
if (data->dpy == NULL) | if (data->dpy == NULL) | ||||
{ | { | ||||
fprintf(stderr, "Cannot connect to X server\n"); | |||||
Log::Error("cannot connect to X server\n"); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
@@ -86,13 +86,13 @@ EglApp::EglApp(char const *title, vec2i res, float fps) : | |||||
data->egl_dpy = eglGetDisplay((EGLNativeDisplayType)data->dpy); | data->egl_dpy = eglGetDisplay((EGLNativeDisplayType)data->dpy); | ||||
if (data->egl_dpy == EGL_NO_DISPLAY) | if (data->egl_dpy == EGL_NO_DISPLAY) | ||||
{ | { | ||||
fprintf(stderr, "Cannot get EGL display\n"); | |||||
Log::Error("cannot get EGL display\n"); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
if (!eglInitialize(data->egl_dpy, NULL, NULL)) | if (!eglInitialize(data->egl_dpy, NULL, NULL)) | ||||
{ | { | ||||
fprintf(stderr, "Cannot initialize EGL\n"); | |||||
Log::Error("cannot initialize EGL\n"); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
@@ -112,13 +112,13 @@ EglApp::EglApp(char const *title, vec2i res, float fps) : | |||||
EGLint num_config; | EGLint num_config; | ||||
if (!eglChooseConfig(data->egl_dpy, attr, &ecfg, 1, &num_config)) | if (!eglChooseConfig(data->egl_dpy, attr, &ecfg, 1, &num_config)) | ||||
{ | { | ||||
fprintf(stderr, "Cannot choose EGL config (%i)\n", eglGetError()); | |||||
Log::Error("cannot choose EGL config (%i)\n", eglGetError()); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
if (num_config != 1) | if (num_config != 1) | ||||
{ | { | ||||
fprintf(stderr, "Cannot choose between %i EGL configs\n", num_config); | |||||
Log::Error("cannot choose between %i EGL configs\n", num_config); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
@@ -126,7 +126,7 @@ EglApp::EglApp(char const *title, vec2i res, float fps) : | |||||
data->win, NULL); | data->win, NULL); | ||||
if (data->egl_surf == EGL_NO_SURFACE) | if (data->egl_surf == EGL_NO_SURFACE) | ||||
{ | { | ||||
fprintf(stderr, "Cannot create EGL surface (%i)\n", eglGetError()); | |||||
Log::Error("cannot create EGL surface (%i)\n", eglGetError()); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
@@ -143,7 +143,7 @@ EglApp::EglApp(char const *title, vec2i res, float fps) : | |||||
EGL_NO_CONTEXT, ctxattr); | EGL_NO_CONTEXT, ctxattr); | ||||
if (data->egl_ctx == EGL_NO_CONTEXT) | if (data->egl_ctx == EGL_NO_CONTEXT) | ||||
{ | { | ||||
fprintf(stderr, "Cannot create EGL context (%i)\n", eglGetError()); | |||||
Log::Error("cannot create EGL context (%i)\n", eglGetError()); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
@@ -42,7 +42,7 @@ Entity::~Entity() | |||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (!destroy) | if (!destroy) | ||||
fprintf(stderr, "ERROR: entity destructor called directly\n"); | |||||
Log::Error("entity destructor called directly\n"); | |||||
#endif | #endif | ||||
} | } | ||||
@@ -55,7 +55,7 @@ void Entity::TickGame(float deltams) | |||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (state != STATE_PRETICK_GAME) | if (state != STATE_PRETICK_GAME) | ||||
fprintf(stderr, "ERROR: invalid entity game tick\n"); | |||||
Log::Error("invalid entity game tick\n"); | |||||
state = STATE_POSTTICK_GAME; | state = STATE_POSTTICK_GAME; | ||||
#endif | #endif | ||||
} | } | ||||
@@ -64,7 +64,7 @@ void Entity::TickDraw(float deltams) | |||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (state != STATE_PRETICK_DRAW) | if (state != STATE_PRETICK_DRAW) | ||||
fprintf(stderr, "ERROR: invalid entity draw tick\n"); | |||||
Log::Error("invalid entity draw tick\n"); | |||||
state = STATE_POSTTICK_DRAW; | state = STATE_POSTTICK_DRAW; | ||||
#endif | #endif | ||||
} | } | ||||
@@ -79,7 +79,7 @@ Image::Image(char const *path) | |||||
if (!image) | if (!image) | ||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
fprintf(stderr, "ERROR: could not load %s\n", path); | |||||
Log::Error("could not load %s\n", path); | |||||
#endif | #endif | ||||
exit(1); | exit(1); | ||||
} | } | ||||
@@ -109,7 +109,7 @@ Image::Image(char const *path) | |||||
if (!data->img) | if (!data->img) | ||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
fprintf(stderr, "ERROR: could not load %s\n", path); | |||||
Log::Error("could not load %s\n", path); | |||||
#endif | #endif | ||||
SDL_Quit(); | SDL_Quit(); | ||||
exit(1); | exit(1); | ||||
@@ -0,0 +1,86 @@ | |||||
// | |||||
// 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://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
// | |||||
#if defined HAVE_CONFIG_H | |||||
# include "config.h" | |||||
#endif | |||||
#include <cmath> | |||||
#include <cstdio> | |||||
#if defined ANDROID_NDK | |||||
# include <android/log.h> | |||||
#else | |||||
# include <cstdarg> | |||||
#endif | |||||
#include "core.h" | |||||
namespace lol | |||||
{ | |||||
/* | |||||
* Public Log class | |||||
*/ | |||||
void Log::Debug(char const *fmt, ...) | |||||
{ | |||||
va_list ap; | |||||
va_start(ap, fmt); | |||||
#if defined ANDROID_NDK | |||||
__android_log_vprint(ANDROID_LOG_DEBUG, "LOL", fmt, ap); | |||||
#else | |||||
fprintf(stderr, "DEBUG: "); | |||||
vfprintf(stderr, fmt, ap); | |||||
#endif | |||||
va_end(ap); | |||||
} | |||||
void Log::Info(char const *fmt, ...) | |||||
{ | |||||
va_list ap; | |||||
va_start(ap, fmt); | |||||
#if defined ANDROID_NDK | |||||
__android_log_vprint(ANDROID_LOG_INFO, "LOL", fmt, ap); | |||||
#else | |||||
fprintf(stderr, "INFO: "); | |||||
vfprintf(stderr, fmt, ap); | |||||
#endif | |||||
va_end(ap); | |||||
} | |||||
void Log::Warn(char const *fmt, ...) | |||||
{ | |||||
va_list ap; | |||||
va_start(ap, fmt); | |||||
#if defined ANDROID_NDK | |||||
__android_log_vprint(ANDROID_LOG_WARN, "LOL", fmt, ap); | |||||
#else | |||||
fprintf(stderr, "WARN: "); | |||||
vfprintf(stderr, fmt, ap); | |||||
#endif | |||||
va_end(ap); | |||||
} | |||||
void Log::Error(char const *fmt, ...) | |||||
{ | |||||
va_list ap; | |||||
va_start(ap, fmt); | |||||
#if defined ANDROID_NDK | |||||
__android_log_vprint(ANDROID_LOG_ERROR, "LOL", fmt, ap); | |||||
#else | |||||
fprintf(stderr, "ERROR: "); | |||||
vfprintf(stderr, fmt, ap); | |||||
#endif | |||||
va_end(ap); | |||||
} | |||||
} /* namespace lol */ | |||||
@@ -0,0 +1,41 @@ | |||||
// | |||||
// 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://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
// | |||||
// | |||||
// The Log interface | |||||
// ----------------- | |||||
// The central logging system. | |||||
// | |||||
#if !defined __DH_LOG_H__ | |||||
#define __DH_LOG_H__ | |||||
#include <stdint.h> | |||||
namespace lol | |||||
{ | |||||
class Log | |||||
{ | |||||
public: | |||||
#ifdef __GNUC__ | |||||
# define LOL_FMT_ATTR __attribute__((format(printf, 1, 2))) | |||||
#endif | |||||
static void Debug(char const *format, ...) LOL_FMT_ATTR; | |||||
static void Info(char const *format, ...) LOL_FMT_ATTR; | |||||
static void Warn(char const *format, ...) LOL_FMT_ATTR; | |||||
static void Error(char const *format, ...) LOL_FMT_ATTR; | |||||
#undef LOL_FMT_ATTR | |||||
}; | |||||
} /* namespace lol */ | |||||
#endif // __DH_LOG_H__ | |||||
@@ -119,7 +119,7 @@ Map::Map(char const *path) | |||||
data->layers[data->nlayers] = l; | data->layers[data->nlayers] = l; | ||||
data->nlayers++; | data->nlayers++; | ||||
tiles = NULL; | tiles = NULL; | ||||
//fprintf(stderr, "new layer %ix%i\n", data->width, data->height); | |||||
//Log::Debug("new layer %ix%i\n", data->width, data->height); | |||||
} | } | ||||
} | } | ||||
else if (sscanf(tmp, " <tileset firstgid=\"%i\"", &i) == 1) | else if (sscanf(tmp, " <tileset firstgid=\"%i\"", &i) == 1) | ||||
@@ -133,7 +133,7 @@ Map::Map(char const *path) | |||||
data->tilers[data->ntilers] = Tiler::Register(str, 32, 0, | data->tilers[data->ntilers] = Tiler::Register(str, 32, 0, | ||||
sqrtf(2)); | sqrtf(2)); | ||||
data->ntilers++; | data->ntilers++; | ||||
//fprintf(stderr, "new tiler %s\n", str); | |||||
//Log::Debug("new tiler %s\n", str); | |||||
} | } | ||||
else if (sscanf(tmp, " <layer name=\"%c%i%c%*[^\"]\" " | else if (sscanf(tmp, " <layer name=\"%c%i%c%*[^\"]\" " | ||||
"width=\"%i\" height=\"%i\"", &a, &i, &b, &j, &k) == 5) | "width=\"%i\" height=\"%i\"", &a, &i, &b, &j, &k) == 5) | ||||
@@ -12,10 +12,6 @@ | |||||
# include "config.h" | # include "config.h" | ||||
#endif | #endif | ||||
#ifdef ANDROID_NDK | |||||
# include <android/log.h> | |||||
#endif | |||||
#include <cstdio> | #include <cstdio> | ||||
#include <cstdlib> /* free() */ | #include <cstdlib> /* free() */ | ||||
#include <cstring> /* strdup() */ | #include <cstring> /* strdup() */ | ||||
@@ -73,25 +69,14 @@ template<> void mat4::printf() const | |||||
{ | { | ||||
mat4 const &p = *this; | mat4 const &p = *this; | ||||
#ifdef ANDROID_NDK | |||||
__android_log_print(ANDROID_LOG_INFO, "LOL", | |||||
"[ %6.6f %6.6f %6.6f %6.6f", p[0][0], p[1][0], p[2][0], p[3][0]); | |||||
__android_log_print(ANDROID_LOG_INFO, "LOL", | |||||
" %6.6f %6.6f %6.6f %6.6f", p[0][1], p[1][1], p[2][1], p[3][1]); | |||||
__android_log_print(ANDROID_LOG_INFO, "LOL", | |||||
" %6.6f %6.6f %6.6f %6.6f", p[0][2], p[1][2], p[2][2], p[3][2]); | |||||
__android_log_print(ANDROID_LOG_INFO, "LOL", | |||||
" %6.6f %6.6f %6.6f %6.6f ]", p[0][3], p[1][3], p[2][3], p[3][3]); | |||||
#else | |||||
fprintf(stderr, "[ %6.6f %6.6f %6.6f %6.6f\n", | |||||
p[0][0], p[1][0], p[2][0], p[3][0]); | |||||
fprintf(stderr, " %6.6f %6.6f %6.6f %6.6f\n", | |||||
p[0][1], p[1][1], p[2][1], p[3][1]); | |||||
fprintf(stderr, " %6.6f %6.6f %6.6f %6.6f\n", | |||||
p[0][2], p[1][2], p[2][2], p[3][2]); | |||||
fprintf(stderr, " %6.6f %6.6f %6.6f %6.6f ]\n", | |||||
p[0][3], p[1][3], p[2][3], p[3][3]); | |||||
#endif | |||||
Log::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", | |||||
p[0][1], p[1][1], p[2][1], p[3][1]); | |||||
Log::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", | |||||
p[0][3], p[1][3], p[2][3], p[3][3]); | |||||
} | } | ||||
template<> mat4 mat4::ortho(float left, float right, float bottom, | template<> mat4 mat4::ortho(float left, float right, float bottom, | ||||
@@ -58,7 +58,7 @@ Sample::Sample(char const *path) | |||||
if (!data->chunk) | if (!data->chunk) | ||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
fprintf(stderr, "ERROR: could not load %s\n", path); | |||||
Log::Error("could not load %s\n", path); | |||||
#endif | #endif | ||||
SDL_Quit(); | SDL_Quit(); | ||||
exit(1); | exit(1); | ||||
@@ -45,7 +45,7 @@ SdlApp::SdlApp(char const *title, vec2i res, float fps) : | |||||
/* Initialise SDL */ | /* Initialise SDL */ | ||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) | if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) | ||||
{ | { | ||||
fprintf(stderr, "Cannot initialise SDL: %s\n", SDL_GetError()); | |||||
Log::Error("cannot initialise SDL: %s\n", SDL_GetError()); | |||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
@@ -54,7 +54,7 @@ SdlApp::SdlApp(char const *title, vec2i res, float fps) : | |||||
SDL_Surface *video = SDL_SetVideoMode(res.x, res.y, 0, SDL_OPENGL); | SDL_Surface *video = SDL_SetVideoMode(res.x, res.y, 0, SDL_OPENGL); | ||||
if (!video) | if (!video) | ||||
{ | { | ||||
fprintf(stderr, "Cannot create OpenGL screen: %s\n", SDL_GetError()); | |||||
Log::Error("cannot create OpenGL screen: %s\n", SDL_GetError()); | |||||
SDL_Quit(); | SDL_Quit(); | ||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
@@ -92,7 +92,7 @@ Shader::Shader(char const *vert, char const *frag) | |||||
glGetShaderInfoLog(data->vert_id, sizeof(buf), &len, buf); | glGetShaderInfoLog(data->vert_id, sizeof(buf), &len, buf); | ||||
if (len > 0) | if (len > 0) | ||||
fprintf(stderr, "ERROR: failed to compile vertex shader: %s", buf); | |||||
Log::Error("failed to compile vertex shader: %s", buf); | |||||
#endif | #endif | ||||
data->frag_crc = Hash::Crc32(frag); | data->frag_crc = Hash::Crc32(frag); | ||||
@@ -103,7 +103,7 @@ Shader::Shader(char const *vert, char const *frag) | |||||
glGetShaderInfoLog(data->frag_id, sizeof(buf), &len, buf); | glGetShaderInfoLog(data->frag_id, sizeof(buf), &len, buf); | ||||
if (len > 0) | if (len > 0) | ||||
fprintf(stderr, "ERROR: failed to compile fragment shader: %s", buf); | |||||
Log::Error("failed to compile fragment shader: %s", buf); | |||||
data->prog_id = glCreateProgram(); | data->prog_id = glCreateProgram(); | ||||
glAttachShader(data->prog_id, data->vert_id); | glAttachShader(data->prog_id, data->vert_id); | ||||
@@ -44,15 +44,15 @@ public: | |||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (nentities) | if (nentities) | ||||
fprintf(stderr, "ERROR: still %i entities in ticker\n", nentities); | |||||
Log::Error("still %i entities in ticker\n", nentities); | |||||
if (autolist) | if (autolist) | ||||
{ | { | ||||
int count = 0; | int count = 0; | ||||
for (Entity *e = autolist; e; e = e->autonext, count++) | for (Entity *e = autolist; e; e = e->autonext, count++) | ||||
; | ; | ||||
fprintf(stderr, "ERROR: still %i autoreleased entities\n", count); | |||||
Log::Error("still %i autoreleased entities\n", count); | |||||
} | } | ||||
fprintf(stderr, "INFO: %i frames required to quit\n", | |||||
Log::Debug("%i frames required to quit\n", | |||||
frame - quitframe); | frame - quitframe); | ||||
#endif | #endif | ||||
} | } | ||||
@@ -100,11 +100,11 @@ void Ticker::Ref(Entity *entity) | |||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (!entity) | if (!entity) | ||||
{ | { | ||||
fprintf(stderr, "ERROR: refing NULL entity\n"); | |||||
Log::Error("referencing NULL entity\n"); | |||||
return; | return; | ||||
} | } | ||||
if (entity->destroy) | if (entity->destroy) | ||||
fprintf(stderr, "ERROR: refing entity scheduled for destruction\n"); | |||||
Log::Error("referencing entity scheduled for destruction\n"); | |||||
#endif | #endif | ||||
if (entity->autorelease) | if (entity->autorelease) | ||||
{ | { | ||||
@@ -131,13 +131,13 @@ int Ticker::Unref(Entity *entity) | |||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (!entity) | if (!entity) | ||||
{ | { | ||||
fprintf(stderr, "ERROR: dereferencing NULL entity\n"); | |||||
Log::Error("dereferencing NULL entity\n"); | |||||
return 0; | return 0; | ||||
} | } | ||||
if (entity->ref <= 0) | if (entity->ref <= 0) | ||||
fprintf(stderr, "ERROR: dereferencing unreferenced entity\n"); | |||||
Log::Error("dereferencing unreferenced entity\n"); | |||||
if (entity->autorelease) | if (entity->autorelease) | ||||
fprintf(stderr, "ERROR: dereferencing autoreleased entity\n"); | |||||
Log::Error("dereferencing autoreleased entity\n"); | |||||
#endif | #endif | ||||
return --entity->ref; | return --entity->ref; | ||||
} | } | ||||
@@ -155,15 +155,15 @@ void Ticker::TickGame() | |||||
Profiler::Start(Profiler::STAT_TICK_GAME); | Profiler::Start(Profiler::STAT_TICK_GAME); | ||||
#if 0 | #if 0 | ||||
fprintf(stderr, "-------------------------------------\n"); | |||||
Log::Debug("-------------------------------------\n"); | |||||
for (int i = 0; i < Entity::ALLGROUP_END; i++) | for (int i = 0; i < Entity::ALLGROUP_END; i++) | ||||
{ | { | ||||
fprintf(stderr, "%s Group %i\n", | |||||
(i < Entity::GAMEGROUP_END) ? "Game" : "Draw", i); | |||||
Log::Debug("%s Group %i\n", | |||||
(i < Entity::GAMEGROUP_END) ? "Game" : "Draw", i); | |||||
for (Entity *e = data->list[i]; e; ) | for (Entity *e = data->list[i]; e; ) | ||||
{ | { | ||||
fprintf(stderr, " \\-- %s (ref %i, destroy %i)\n", e->GetName(), e->ref, e->destroy); | |||||
Log::Debug(" \\-- %s (ref %i, destroy %i)\n", e->GetName(), e->ref, e->destroy); | |||||
e = (i < Entity::GAMEGROUP_END) ? e->gamenext : e->drawnext; | e = (i < Entity::GAMEGROUP_END) ? e->gamenext : e->drawnext; | ||||
} | } | ||||
} | } | ||||
@@ -196,7 +196,7 @@ void Ticker::TickGame() | |||||
if (e->ref) | if (e->ref) | ||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
fprintf(stderr, "ERROR: poking %s\n", e->GetName()); | |||||
Log::Error("poking %s\n", e->GetName()); | |||||
#endif | #endif | ||||
e->ref--; | e->ref--; | ||||
n++; | n++; | ||||
@@ -204,8 +204,8 @@ void Ticker::TickGame() | |||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (n) | if (n) | ||||
fprintf(stderr, "ERROR: %i entities stuck after %i frames, " | |||||
"poked %i\n", data->nentities, data->quitdelay, n); | |||||
Log::Error("%i entities stuck after %i frames, poked %i\n", | |||||
data->nentities, data->quitdelay, n); | |||||
#endif | #endif | ||||
data->quitdelay = data->quitdelay > 1 ? data->quitdelay / 2 : 1; | data->quitdelay = data->quitdelay > 1 ? data->quitdelay / 2 : 1; | ||||
@@ -265,13 +265,13 @@ void Ticker::TickGame() | |||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (e->state != Entity::STATE_IDLE) | if (e->state != Entity::STATE_IDLE) | ||||
fprintf(stderr, "ERROR: entity not idle for game tick\n"); | |||||
Log::Error("entity not idle for game tick\n"); | |||||
e->state = Entity::STATE_PRETICK_GAME; | e->state = Entity::STATE_PRETICK_GAME; | ||||
#endif | #endif | ||||
e->TickGame(data->deltams); | e->TickGame(data->deltams); | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (e->state != Entity::STATE_POSTTICK_GAME) | if (e->state != Entity::STATE_POSTTICK_GAME) | ||||
fprintf(stderr, "ERROR: entity missed super game tick\n"); | |||||
Log::Error("entity missed super game tick\n"); | |||||
e->state = Entity::STATE_IDLE; | e->state = Entity::STATE_IDLE; | ||||
#endif | #endif | ||||
} | } | ||||
@@ -306,13 +306,13 @@ void Ticker::TickDraw() | |||||
{ | { | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (e->state != Entity::STATE_IDLE) | if (e->state != Entity::STATE_IDLE) | ||||
fprintf(stderr, "ERROR: entity not idle for draw tick\n"); | |||||
Log::Error("entity not idle for draw tick\n"); | |||||
e->state = Entity::STATE_PRETICK_DRAW; | e->state = Entity::STATE_PRETICK_DRAW; | ||||
#endif | #endif | ||||
e->TickDraw(data->deltams); | e->TickDraw(data->deltams); | ||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (e->state != Entity::STATE_POSTTICK_DRAW) | if (e->state != Entity::STATE_POSTTICK_DRAW) | ||||
fprintf(stderr, "ERROR: entity missed super draw tick\n"); | |||||
Log::Error("entity missed super draw tick\n"); | |||||
e->state = Entity::STATE_IDLE; | e->state = Entity::STATE_IDLE; | ||||
#endif | #endif | ||||
} | } | ||||
@@ -76,7 +76,7 @@ vec2i Tiler::GetSize(int id) | |||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (!tileset) | if (!tileset) | ||||
{ | { | ||||
fprintf(stderr, "ERROR: getting size for null tiler #%i\n", id); | |||||
Log::Error("getting size for null tiler #%i\n", id); | |||||
return 0; | return 0; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -89,7 +89,7 @@ vec2i Tiler::GetCount(int id) | |||||
#if !LOL_RELEASE | #if !LOL_RELEASE | ||||
if (!tileset) | if (!tileset) | ||||
{ | { | ||||
fprintf(stderr, "ERROR: getting count for null tiler #%i\n", id); | |||||
Log::Error("getting count for null tiler #%i\n", id); | |||||
return 0; | return 0; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -105,7 +105,7 @@ void Tiler::Bind(uint32_t code) | |||||
if (!tileset) | if (!tileset) | ||||
{ | { | ||||
if (id != data->lasterror) | if (id != data->lasterror) | ||||
fprintf(stderr, "ERROR: binding null tiler #%i\n", id); | |||||
Log::Error("binding null tiler #%i\n", id); | |||||
data->lasterror = id; | data->lasterror = id; | ||||
return; | return; | ||||
} | } | ||||
@@ -123,7 +123,7 @@ void Tiler::BlitTile(uint32_t code, int x, int y, int z, int o, | |||||
if (!tileset) | if (!tileset) | ||||
{ | { | ||||
if (id != data->lasterror) | if (id != data->lasterror) | ||||
fprintf(stderr, "ERROR: blitting to null tiler #%i\n", id); | |||||
Log::Error("blitting to null tiler #%i\n", id); | |||||
data->lasterror = id; | data->lasterror = id; | ||||
return; | return; | ||||
} | } | ||||