⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameswf_log.cpp

📁 一个开源的Flash 播放器,可以在Windows/Linux 上运行
💻 CPP
字号:
// gameswf_log.h	-- Thatcher Ulrich <tu@tulrich.com> 2003// This source code has been donated to the Public Domain.  Do// whatever you want with it.// Helpers for logging messages & errors.#include "gameswf_log.h"#include "gameswf.h"#include <stdio.h>#include <stdarg.h>namespace gameswf{	// Function pointer to log callback.	static void (*s_log_callback)(bool error, const char* message) = NULL;	// Workspace for vsnprintf formatting.	static const int	BUFFER_SIZE = 500;	static char	s_buffer[BUFFER_SIZE];	void	register_log_callback(void (*callback)(bool error, const char* message))	// The host app can use this to install a function to receive log	// & error messages from gameswf.	//	// Pass in NULL to inhibit logging of messages & errors.	{		s_log_callback = callback;	}#ifdef _WIN32#define vsnprintf	_vsnprintf#endif // _WIN32#define FORMAT_INTO_BUFFER(fmt)				\		va_list ap;				\		va_start(ap, fmt);			\		vsnprintf(s_buffer, BUFFER_SIZE, fmt, ap);	\		va_end(ap);	void	log_msg(const char* fmt, ...)	// Printf-style informational log.	{		if (s_log_callback == NULL)		{			return;		}		FORMAT_INTO_BUFFER(fmt);		s_log_callback(false, s_buffer);	}	void	log_error(const char* fmt, ...)	// Printf-style error log.	{		if (s_log_callback == NULL)		{			return;		}		FORMAT_INTO_BUFFER(fmt);		s_log_callback(true, s_buffer);	}}// Local Variables:// mode: C++// c-basic-offset: 8 // tab-width: 8// indent-tabs-mode: t// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -