本文整理汇总了C++中ALLEGRO_WARN函数的典型用法代码示例。如果您正苦于以下问题:C++ ALLEGRO_WARN函数的具体用法?C++ ALLEGRO_WARN怎么用?C++ ALLEGRO_WARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ALLEGRO_WARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xdpy_swap_control
static int xdpy_swap_control(ALLEGRO_DISPLAY *display, int vsync_setting)
{
/* We set the swap interval to 0 if vsync is forced off, and to 1
* if it is forced on.
* http://www.opengl.org/registry/specs/SGI/swap_control.txt
* If the option is set to 0, we simply use the system default. The
* above extension specifies vsync on as default though, so in the
* end with GLX we can't force vsync on, just off.
*/
ALLEGRO_DEBUG("requested vsync=%d.\n", vsync_setting);
if (vsync_setting) {
if (display->ogl_extras->extension_list->ALLEGRO_GLX_SGI_swap_control) {
int x = (vsync_setting == 2) ? 0 : 1;
if (glXSwapIntervalSGI(x)) {
ALLEGRO_WARN("glXSwapIntervalSGI(%d) failed.\n", x);
}
}
else {
ALLEGRO_WARN("no vsync, GLX_SGI_swap_control missing.\n");
/* According to the specification that means it's on, but
* the driver might have disabled it. So we do not know.
*/
vsync_setting = 0;
}
}
return vsync_setting;
}
示例2: d3d_destroy_bitmap
static void d3d_destroy_bitmap(ALLEGRO_BITMAP *bitmap)
{
ALLEGRO_BITMAP_D3D *d3d_bmp = (ALLEGRO_BITMAP_D3D *)bitmap;
if (!al_is_sub_bitmap(bitmap)) {
if (d3d_bmp->video_texture) {
if (d3d_bmp->video_texture->Release() != 0) {
ALLEGRO_WARN("d3d_destroy_bitmap: Release video texture failed.\n");
}
}
if (d3d_bmp->system_texture) {
if (d3d_bmp->system_texture->Release() != 0) {
ALLEGRO_WARN("d3d_destroy_bitmap: Release system texture failed.\n");
}
}
if (d3d_bmp->render_target) {
if (d3d_bmp->render_target->Release() != 0) {
ALLEGRO_WARN("d3d_destroy_bitmap: Release render target failed.\n");
}
}
}
_al_vector_find_and_delete(&created_bitmaps, &d3d_bmp);
}
示例3: glsl_set_shader_sampler
static bool glsl_set_shader_sampler(ALLEGRO_SHADER *shader,
const char *name, ALLEGRO_BITMAP *bitmap, int unit)
{
ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader;
GLint handle;
GLuint texture;
if (bitmap && al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) {
ALLEGRO_WARN("Cannot use memory bitmap for sampler\n");
return false;
}
handle = glGetUniformLocation(gl_shader->program_object, name);
if (handle < 0) {
ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name);
return false;
}
glActiveTexture(GL_TEXTURE0 + unit);
texture = bitmap ? al_get_opengl_texture(bitmap) : 0;
glBindTexture(GL_TEXTURE_2D, texture);
glUniform1i(handle, unit);
return check_gl_error(name);
}
示例4: _al_xsys_xinerama_init
static void _al_xsys_xinerama_init(ALLEGRO_SYSTEM_XGLX *s)
{
int event_base = 0;
int error_base = 0;
/* init xinerama info to defaults */
s->xinerama_available = 0;
s->xinerama_screen_count = 0;
s->xinerama_screen_info = NULL;
_al_mutex_lock(&s->lock);
if (XineramaQueryExtension(s->x11display, &event_base, &error_base)) {
int minor_version = 0, major_version = 0;
int status = XineramaQueryVersion(s->x11display, &major_version, &minor_version);
ALLEGRO_INFO("Xinerama version: %i.%i\n", major_version, minor_version);
if (status && !XineramaIsActive(s->x11display)) {
ALLEGRO_WARN("Xinerama is not active\n");
}
else {
ALLEGRO_INFO("Xinerama is active\n");
s->xinerama_available = 1;
}
}
else {
ALLEGRO_WARN("Xinerama extension is not available.\n");
}
_al_mutex_unlock(&s->lock);
}
示例5: _al_win_thread_init
/* _al_win_thread_init:
* Initializes COM interface for the calling thread.
* Attempts to use Distributed COM if available (installed by default
* on every 32-bit Windows starting with Win98 and Win NT4).
*/
void _al_win_thread_init(void)
{
HMODULE ole32 = NULL;
if (first_call) {
first_call = 0;
ole32 = GetModuleHandle(TEXT("OLE32.DLL"));
if (ole32 != NULL) {
_CoInitializeEx = (_CoInitializeEx_ptr) GetProcAddress(
ole32, "CoInitializeEx");
}
else {
ALLEGRO_WARN("OLE32.DLL can't be loaded.\n");
}
if (_CoInitializeEx == NULL) {
ALLEGRO_WARN("Microsoft Distributed COM is not installed on this system. If you have problems ");
ALLEGRO_WARN("with this application, please install the DCOM update. You can find it on the ");
ALLEGRO_WARN("Microsoft homepage\n");
}
}
if (_CoInitializeEx != NULL)
_CoInitializeEx(NULL, _COINIT_MULTITHREADED);
else
CoInitialize(NULL);
}
示例6: hapxi_upload_effect
static bool hapxi_upload_effect(ALLEGRO_HAPTIC *dev,
ALLEGRO_HAPTIC_EFFECT *effect, ALLEGRO_HAPTIC_EFFECT_ID *id)
{
ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_from_al(dev);
ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi = NULL;
ASSERT(dev);
ASSERT(id);
ASSERT(effect);
/* Set id's values to indicate failure beforehand. */
id->_haptic = NULL;
id->_id = -1;
id->_pointer = NULL;
id->_playing = false;
id->_effect_duration = 0.0;
id->_start_time = 0.0;
id->_end_time = 0.0;
if (!al_is_haptic_effect_ok(dev, effect))
return false;
al_lock_mutex(hapxi_mutex);
/* Is a haptic effect slot available? */
effxi = hapxi_get_available_effect(hapxi);
/* No more space for an effect. */
if (!effxi) {
ALLEGRO_WARN("No free effect slot.");
al_unlock_mutex(hapxi_mutex);
return false;
}
if (!hapxi_effect2win(effxi, effect, hapxi)) {
ALLEGRO_WARN("Cannot convert haptic effect to XINPUT effect.\n");
al_unlock_mutex(hapxi_mutex);
return false;
}
effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY;
effxi->effect = (*effect);
/* set ID handle to signify success */
id->_haptic = dev;
id->_pointer = effxi;
id->_id = effxi->id;
id->_effect_duration = al_get_haptic_effect_duration(effect);
al_unlock_mutex(hapxi_mutex);
return true;
}
示例7: glsl_set_shader_float_vector
static bool glsl_set_shader_float_vector(ALLEGRO_SHADER *shader,
const char *name, int num_components, float *f, int num_elems)
{
ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader;
GLint handle;
handle = glGetUniformLocation(gl_shader->program_object, name);
if (handle < 0) {
ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name);
return false;
}
switch (num_components) {
case 1:
glUniform1fv(handle, num_elems, f);
break;
case 2:
glUniform2fv(handle, num_elems, f);
break;
case 3:
glUniform3fv(handle, num_elems, f);
break;
case 4:
glUniform4fv(handle, num_elems, f);
break;
default:
ASSERT(false);
break;
}
return check_gl_error(name);
}
示例8: al_get_config_value
static ALLEGRO_DISPLAY_INTERFACE *xglx_get_display_driver(void)
{
ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver();
/* Look up the toggle_mouse_grab_key binding. This isn't such a great place
* to do it, but the config file is not available until after the system driver
* is initialised.
*/
if (!system->toggle_mouse_grab_keycode) {
const char *binding = al_get_config_value(al_get_system_config(),
"keyboard", "toggle_mouse_grab_key");
if (binding) {
system->toggle_mouse_grab_keycode = _al_parse_key_binding(binding,
&system->toggle_mouse_grab_modifiers);
if (system->toggle_mouse_grab_keycode) {
ALLEGRO_DEBUG("Toggle mouse grab key: '%s'\n", binding);
}
else {
ALLEGRO_WARN("Cannot parse key binding '%s'\n", binding);
}
}
}
return _al_display_xglx_driver();
}
示例9: _ogl_is_extension_with_version_supported
static bool _ogl_is_extension_with_version_supported(
const char *extension, ALLEGRO_DISPLAY *disp, uint32_t ver)
{
ALLEGRO_CONFIG *cfg;
char const *value;
/* For testing purposes, any OpenGL extension can be disable in
* the config by using something like:
*
* [opengl_disabled_extensions]
* GL_ARB_texture_non_power_of_two=0
* GL_EXT_framebuffer_object=0
*
*/
cfg = al_get_system_config();
if (cfg) {
value = al_get_config_value(cfg,
"opengl_disabled_extensions", extension);
if (value) {
ALLEGRO_WARN("%s found in [opengl_disabled_extensions].\n",
extension);
return false;
}
}
/* If the extension is included in the OpenGL version, there is no
* need to check the extensions list.
*/
if (ver > 0 && disp->ogl_extras->ogl_info.version >= ver) {
return true;
}
return _ogl_is_extension_supported(extension, disp);
}
示例10: xgtk_create_display_hook
/* [user thread] */
static bool xgtk_create_display_hook(ALLEGRO_DISPLAY *display, int w, int h)
{
ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display;
ARGS_CREATE args;
d->gtk = al_calloc(1, sizeof(*(d->gtk)));
if (!d->gtk) {
ALLEGRO_WARN("Out of memory\n");
return false;
}
if (!_al_gtk_ensure_thread()) {
al_free(d->gtk);
d->gtk = NULL;
return false;
}
if (!_al_gtk_init_args(&args, sizeof(args))) {
al_free(d->gtk);
d->gtk = NULL;
return false;
}
args.display = d;
args.w = w;
args.h = h;
args.title = al_get_new_window_title();
return _al_gtk_wait_for_args(do_create_display_hook, &args);
}
示例11: al_set_voice_playing
/* Function: al_set_voice_playing
*/
bool al_set_voice_playing(ALLEGRO_VOICE *voice, bool val)
{
ASSERT(voice);
if (!voice->attached_stream) {
ALLEGRO_DEBUG("Voice has no attachment\n");
return false;
}
if (voice->is_streaming) {
ALLEGRO_WARN("Attempted to change the playing state of a voice "
"with a streaming attachment (mixer or audiostreams)\n");
return false;
}
else {
bool playing = al_get_voice_playing(voice);
if (playing == val) {
if (playing) {
ALLEGRO_DEBUG("Voice is already playing\n");
}
else {
ALLEGRO_DEBUG("Voice is already stopped\n");
}
return true;
}
return _al_kcm_set_voice_playing(voice, voice->mutex, val);
}
}
示例12: load_library_at_path
static HMODULE load_library_at_path(const char *path_str)
{
HMODULE lib;
/*
* XXX LoadLibrary will search the current directory for any dependencies of
* the library we are loading. Using LoadLibraryEx with the appropriate
* flags would fix that, but when I tried it I was unable to load dsound.dll
* on Vista.
*/
ALLEGRO_DEBUG("Calling LoadLibrary %s\n", path_str);
lib = LoadLibraryA(path_str);
if (lib) {
ALLEGRO_INFO("Loaded %s\n", path_str);
}
else {
DWORD error = GetLastError();
HRESULT hr = HRESULT_FROM_WIN32(error);
/* XXX do something with it */
(void)hr;
ALLEGRO_WARN("Failed to load %s (error: %ld)\n", path_str, error);
}
return lib;
}
示例13: check_gl_error
static bool check_gl_error(const char* name)
{
GLenum err = glGetError();
if (err != 0) {
ALLEGRO_WARN("%s (%s)\n", name, _al_gl_error_string(err));
return false;
}
return true;
}
示例14: init_dynlib
static bool init_dynlib(void)
{
#ifdef ALLEGRO_CFG_ACODEC_VORBISFILE_DLL
if (ov_dll) {
return true;
}
if (!ov_virgin) {
return false;
}
ov_virgin = false;
ov_dll = _al_open_library(ALLEGRO_CFG_ACODEC_VORBISFILE_DLL);
if (!ov_dll) {
ALLEGRO_WARN("Could not load " ALLEGRO_CFG_ACODEC_VORBISFILE_DLL "\n");
return false;
}
_al_add_exit_func(shutdown_dynlib, "shutdown_dynlib");
#define INITSYM(x) \
do \
{ \
lib.x = _al_import_symbol(ov_dll, #x); \
if (lib.x == 0) { \
ALLEGRO_ERROR("undefined symbol in lib structure: " #x "\n"); \
return false; \
} \
} while(0)
#else
#define INITSYM(x) (lib.x = (x))
#endif
memset(&lib, 0, sizeof(lib));
INITSYM(ov_clear);
INITSYM(ov_open_callbacks);
INITSYM(ov_pcm_total);
INITSYM(ov_info);
#ifndef TREMOR
INITSYM(ov_time_total);
INITSYM(ov_time_seek_lap);
INITSYM(ov_time_tell);
INITSYM(ov_read);
#else
INITSYM(ov_time_total);
INITSYM(ov_time_seek);
INITSYM(ov_time_tell);
INITSYM(ov_read);
#endif
return true;
#undef INITSYM
}
示例15: ALLEGRO_WARN
GtkWidget *_al_gtk_get_window(ALLEGRO_DISPLAY *display)
{
ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display;
if (d->overridable_vt == &xgtk_override_vt) {
return d->gtk->gtkwindow;
}
ALLEGRO_WARN("Not display created with GTK.\n");
return NULL;
}