handmade/include/debug.h
Bubblegumdrop 6a8f90500f Fixed SDL_SwapBE16 issue on client side.
< Bubblegumdrop> SDLNet_UDP_Open seems to call SDLNet_Read16 (which is just SDL_SwapBE16)
< Bubblegumdrop> But on the server side I don't use SDLNet_UDP_Open to host the port
< whitt> probably the sender was flipping it but the receiver wasn't and so they were incompatible
< Bubblegumdrop> removing the SDL_SwapBE16 on the client side fixed it
2022-01-03 14:48:50 -05:00

24 lines
556 B
C

#pragma once
#ifdef DEBUG
#include <SDL_log.h>
#include <stdarg.h>
#define DEBUG_LOG(...) debug_log (__FILE__, __LINE__, __func__, __VA_ARGS__)
static void debug_log (const char* filename, const int lineno, const char* func, const char* fmt, ...)
{
char buf[8192];
va_list ap;
SDL_memset (buf, 0, sizeof buf);
va_start (ap, fmt);
vsnprintf (buf, (sizeof buf) - 1, fmt, ap);
va_end (ap);
SDL_LogMessage (SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "%s:%d: %s(): %s", filename, lineno, func, buf);
}
#else
#define DEBUG_LOG(...)
#endif