本文整理汇总了C++中ALLEGRO_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ ALLEGRO_ERROR函数的具体用法?C++ ALLEGRO_ERROR怎么用?C++ ALLEGRO_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ALLEGRO_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: al_init_native_dialog_addon
/* Function: al_init_native_dialog_addon
*/
bool al_init_native_dialog_addon(void)
{
if (!inited_addon) {
if (!_al_init_native_dialog_addon()) {
ALLEGRO_ERROR("_al_init_native_dialog_addon failed.\n");
return false;
}
inited_addon = true;
_al_add_exit_func(al_shutdown_native_dialog_addon,
"al_shutdown_native_dialog_addon");
}
return true;
}
开发者ID:Frozenhorns,项目名称:project,代码行数:15,代码来源:dialog.c
示例2: do_play_sample
static bool do_play_sample(ALLEGRO_SAMPLE_INSTANCE *splinst,
ALLEGRO_SAMPLE *spl, float gain, float pan, float speed, ALLEGRO_PLAYMODE loop)
{
if (!al_set_sample(splinst, spl)) {
ALLEGRO_ERROR("al_set_sample failed\n");
return false;
}
if (!al_set_sample_instance_gain(splinst, gain) ||
!al_set_sample_instance_pan(splinst, pan) ||
!al_set_sample_instance_speed(splinst, speed) ||
!al_set_sample_instance_playmode(splinst, loop)) {
return false;
}
if (!al_play_sample_instance(splinst)) {
ALLEGRO_ERROR("al_play_sample_instance failed\n");
return false;
}
return true;
}
开发者ID:EricMayberryIV,项目名称:COP3330-Introduction-to-OOP,代码行数:22,代码来源:kcm_sample.c
示例3: get_pixel_formats_count_old
static int get_pixel_formats_count_old(HDC dc)
{
PIXELFORMATDESCRIPTOR pfd;
int ret;
ret = DescribePixelFormat(dc, 1, sizeof(pfd), &pfd);
if (!ret) {
ALLEGRO_ERROR("DescribePixelFormat failed! %s\n",
get_error_desc(GetLastError()));
}
return ret;
}
开发者ID:Frozenhorns,项目名称:project,代码行数:13,代码来源:wgl_disp.c
示例4: _dsound_open
/* The open method starts up the driver and should lock the device, using the
previously set parameters, or defaults. It shouldn't need to start sending
audio data to the device yet, however. */
static int _dsound_open()
{
HRESULT hr;
ALLEGRO_INFO("Starting DirectSound...\n");
/* FIXME: Use default device until we have device enumeration */
hr = DirectSoundCreate8(NULL, &device, NULL);
if (FAILED(hr)) {
ALLEGRO_ERROR("DirectSoundCreate8 failed: %s\n", ds_get_error(hr));
return 1;
}
ALLEGRO_DEBUG("DirectSoundCreate8 succeeded\n");
hr = device->SetCooperativeLevel(get_window(), DSSCL_PRIORITY);
if (FAILED(hr)) {
ALLEGRO_ERROR("SetCooperativeLevel failed: %s\n", ds_get_error(hr));
return 1;
}
return 0;
}
开发者ID:allefant,项目名称:allegro5,代码行数:25,代码来源:dsound.cpp
示例5: ALLEGRO_WARN
/* Create a new X11 display, which maps directly to a GLX window. */
static ALLEGRO_DISPLAY *xdpy_create_display(int w, int h)
{
ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver();
ALLEGRO_DISPLAY_XGLX *display;
int flags;
int adapter;
if (system->x11display == NULL) {
ALLEGRO_WARN("Not connected to X server.\n");
return NULL;
}
if (w <= 0 || h <= 0) {
ALLEGRO_ERROR("Invalid window size %dx%d\n", w, h);
return NULL;
}
flags = al_get_new_display_flags();
if (flags & ALLEGRO_GTK_TOPLEVEL_INTERNAL) {
if (gtk_override_vt == NULL) {
ALLEGRO_ERROR("GTK requested but unavailable\n");
return NULL;
}
if (flags & ALLEGRO_FULLSCREEN) {
ALLEGRO_ERROR("GTK incompatible with fullscreen\n");
return NULL;
}
}
_al_mutex_lock(&system->lock);
adapter = al_get_new_display_adapter();
display = xdpy_create_display_locked(system, flags, w, h, adapter);
_al_mutex_unlock(&system->lock);
return (ALLEGRO_DISPLAY *)display;
}
开发者ID:billyquith,项目名称:allegro5,代码行数:39,代码来源:xdisplay.c
示例6: voice
/* The get_voice_position method should return the current sample position of
the voice (sample_pos = byte_pos / (depth/8) / channels). This should never
be called on a streaming voice. */
static unsigned int _dsound_get_voice_position(const ALLEGRO_VOICE *voice)
{
ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra;
DWORD play_pos;
HRESULT hr;
hr = ex_data->ds8_buffer->GetCurrentPosition(&play_pos, NULL);
if (FAILED(hr)) {
ALLEGRO_ERROR("GetCurrentPosition failed\n");
return 0;
}
return play_pos / (ex_data->channels / (ex_data->bits_per_sample/8));
}
开发者ID:EricMayberryIV,项目名称:COP3330-Introduction-to-OOP,代码行数:17,代码来源:dsound.cpp
示例7: get_pixel_formats_count_ext
static int get_pixel_formats_count_ext(HDC dc)
{
int attrib[1];
int value[1];
attrib[0] = WGL_NUMBER_PIXEL_FORMATS_ARB;
if ((_wglGetPixelFormatAttribivARB(dc, 0, 0, 1, attrib, value) == GL_FALSE)
&& (_wglGetPixelFormatAttribivEXT(dc, 0, 0, 1, attrib, value) == GL_FALSE)) {
ALLEGRO_ERROR("WGL_ARB/EXT_pixel_format use failed! %s\n",
get_error_desc(GetLastError()));
}
return value[0];
}
开发者ID:dradtke,项目名称:battlechess,代码行数:14,代码来源:wgl_disp.c
示例8: xdpy_flip_display
/* Dummy implementation of flip. */
static void xdpy_flip_display(ALLEGRO_DISPLAY *d)
{
int e = glGetError();
if (e) {
ALLEGRO_ERROR("OpenGL error was not 0: %d\n", e);
}
ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver();
ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d;
if (d->extra_settings.settings[ALLEGRO_SINGLE_BUFFER])
glFlush();
else
glXSwapBuffers(system->gfxdisplay, glx->glxwindow);
}
开发者ID:Frozenhorns,项目名称:project,代码行数:15,代码来源:xdisplay.c
示例9: al_init_native_dialog_addon
/* Function: al_init_native_dialog_addon
*/
bool al_init_native_dialog_addon(void)
{
if (!inited_addon) {
if (!_al_init_native_dialog_addon()) {
ALLEGRO_ERROR("_al_init_native_dialog_addon failed.\n");
return false;
}
inited_addon = true;
al_init_user_event_source(al_get_default_menu_event_source());
_al_add_exit_func(al_shutdown_native_dialog_addon,
"al_shutdown_native_dialog_addon");
}
return true;
}
开发者ID:georgp24,项目名称:microwindows-android-bin,代码行数:16,代码来源:dialog.c
示例10: oss_open
static int oss_open(void)
{
bool force_oss3 = false;
ALLEGRO_CONFIG *config = al_get_system_config();
if (config) {
const char *force_oss3_cfg;
force_oss3_cfg = al_get_config_value(config, "oss", "force_ver3");
if (force_oss3_cfg && force_oss3_cfg[0] != '\0')
force_oss3 = strcmp(force_oss3_cfg, "yes") ? false : true;
}
if (force_oss3) {
ALLEGRO_WARN("Skipping OSS4 probe.\n");
}
#ifdef OSS_VER_4
bool inited = false;
if (!force_oss3) {
if (oss_open_ver4())
ALLEGRO_WARN("OSS ver. 4 init failed, trying ver. 3...\n");
else
inited = true;
}
if (!inited && oss_open_ver3()) {
ALLEGRO_ERROR("Failed to init OSS.\n");
return 1;
}
#else
ALLEGRO_INFO("OSS4 support not compiled in. Skipping OSS4 probe.\n");
if (oss_open_ver3()) {
ALLEGRO_ERROR("Failed to init OSS.\n");
return 1;
}
#endif
return 0;
}
开发者ID:sesc4mt,项目名称:mvcdecoder,代码行数:37,代码来源:oss.c
示例11: al_set_default_mixer
/* Function: al_set_default_mixer
*/
bool al_set_default_mixer(ALLEGRO_MIXER *mixer)
{
ASSERT(mixer != NULL);
if (mixer != default_mixer) {
int i;
default_mixer = mixer;
/* Destroy all current sample instances, recreate them, and
* attach them to the new mixer */
for (i = 0; i < (int) _al_vector_size(&auto_samples); i++) {
ALLEGRO_SAMPLE_INSTANCE **slot = _al_vector_ref(&auto_samples, i);
int *id = _al_vector_ref(&auto_sample_ids, i);
*id = 0;
al_destroy_sample_instance(*slot);
*slot = al_create_sample_instance(NULL);
if (!*slot) {
ALLEGRO_ERROR("al_create_sample failed\n");
goto Error;
}
if (!al_attach_sample_instance_to_mixer(*slot, default_mixer)) {
ALLEGRO_ERROR("al_attach_mixer_to_sample failed\n");
goto Error;
}
}
}
return true;
Error:
free_sample_vector();
default_mixer = NULL;
return false;
}
开发者ID:tsteinholz,项目名称:SR-Gaming,代码行数:39,代码来源:kcm_sample.c
示例12: _dsound_set_voice_position
/* The set_voice_position method should set the voice's playback position,
given the value in samples. This should never be called on a streaming
voice. */
static int _dsound_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val)
{
ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra;
HRESULT hr;
val *= ex_data->channels * (ex_data->bits_per_sample/8);
hr = ex_data->ds8_buffer->SetCurrentPosition(val);
if (FAILED(hr)) {
ALLEGRO_ERROR("SetCurrentPosition failed\n");
return 1;
}
return 0;
}
开发者ID:EricMayberryIV,项目名称:COP3330-Introduction-to-OOP,代码行数:18,代码来源:dsound.cpp
示例13: joystick_dinput_acquire
/* _al_win_joystick_dinput_acquire: [window thread]
* Acquires the joystick devices.
*/
static void joystick_dinput_acquire(void)
{
HRESULT hr;
int i;
if (!joystick_dinput)
return;
for (i=0; i < MAX_JOYSTICKS; i++) {
if (joydx_joystick[i].device) {
hr = IDirectInputDevice8_Acquire(joydx_joystick[i].device);
if (FAILED(hr))
ALLEGRO_ERROR("acquire joystick %d failed: %s\n", i, dinput_err_str(hr));
}
}
}
开发者ID:EricMayberryIV,项目名称:COP3330-Introduction-to-OOP,代码行数:20,代码来源:wjoydxnu.c
示例14: glsl_build_shader
static bool glsl_build_shader(ALLEGRO_SHADER *shader)
{
GLint status;
ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader;
GLchar error_buf[4096];
if (gl_shader->vertex_shader == 0 && gl_shader->pixel_shader == 0)
return false;
if (gl_shader->program_object != 0) {
glDeleteProgram(gl_shader->program_object);
}
gl_shader->program_object = glCreateProgram();
if (gl_shader->program_object == 0)
return false;
if (gl_shader->vertex_shader)
glAttachShader(gl_shader->program_object, gl_shader->vertex_shader);
if (gl_shader->pixel_shader)
glAttachShader(gl_shader->program_object, gl_shader->pixel_shader);
glLinkProgram(gl_shader->program_object);
glGetProgramiv(gl_shader->program_object, GL_LINK_STATUS, &status);
if (status == 0) {
glGetProgramInfoLog(gl_shader->program_object, sizeof(error_buf), NULL,
error_buf);
if (shader->log) {
al_ustr_truncate(shader->log, 0);
al_ustr_append_cstr(shader->log, error_buf);
}
else {
shader->log = al_ustr_new(error_buf);
}
ALLEGRO_ERROR("Link error: %s\n", error_buf);
glDeleteProgram(gl_shader->program_object);
return false;
}
/* Look up variable locations. */
lookup_varlocs(&gl_shader->varlocs, gl_shader->program_object);
return true;
}
开发者ID:BorisCarvajal,项目名称:allegro5,代码行数:46,代码来源:ogl_shader.c
示例15: init_pixel_format_extensions
static bool init_pixel_format_extensions(void)
{
/* Load the ARB_p_f symbol - Note, we shouldn't use the extension
* mechanism here, because it hasn't been initialized yet!
*/
_wglGetPixelFormatAttribivARB =
(_ALLEGRO_wglGetPixelFormatAttribivARB_t)wglGetProcAddress("wglGetPixelFormatAttribivARB");
_wglGetPixelFormatAttribivEXT =
(_ALLEGRO_wglGetPixelFormatAttribivEXT_t)wglGetProcAddress("wglGetPixelFormatAttribivEXT");
if (!_wglGetPixelFormatAttribivARB && !_wglGetPixelFormatAttribivEXT) {
ALLEGRO_ERROR("WGL_ARB/EXT_pf not supported.\n");
return false;
}
return true;
}
开发者ID:dradtke,项目名称:battlechess,代码行数:17,代码来源:wgl_disp.c
示例16: _dsound_stop_voice
/* The stop_voice method should stop playback. For non-streaming voices, it
should leave the data loaded, and reset the voice position to 0. */
static int _dsound_stop_voice(ALLEGRO_VOICE* voice)
{
ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra;
ALLEGRO_DEBUG("Stopping voice\n");
if (!ex_data->ds8_buffer) {
ALLEGRO_ERROR("Trying to stop empty voice buffer\n");
return 1;
}
/* if playing a sample */
if (!voice->is_streaming) {
ALLEGRO_DEBUG("Stopping non-streaming voice\n");
ex_data->ds8_buffer->Stop();
ex_data->ds8_buffer->SetCurrentPosition(0);
ALLEGRO_INFO("Non-streaming voice stopped\n");
return 0;
}
if (ex_data->stop_voice == 0) {
ALLEGRO_DEBUG("Joining thread\n");
ex_data->stop_voice = 1;
while (ex_data->stop_voice == 1) {
al_wait_cond(voice->cond, voice->mutex);
}
al_join_thread(ex_data->thread, NULL);
ALLEGRO_DEBUG("Joined thread\n");
ALLEGRO_DEBUG("Destroying thread\n");
al_destroy_thread(ex_data->thread);
ALLEGRO_DEBUG("Thread destroyed\n");
/* This is required to restart the background thread when the voice
* restarts.
*/
ex_data->stop_voice = 1;
}
ALLEGRO_DEBUG("Releasing buffer\n");
ex_data->ds8_buffer->Release();
ex_data->ds8_buffer = NULL;
ALLEGRO_INFO("Voice stopped\n");
return 0;
}
开发者ID:allefant,项目名称:allegro5,代码行数:47,代码来源:dsound.cpp
示例17: _al_gtk_ensure_thread
bool _al_gtk_ensure_thread(void)
{
bool ok = true;
#if !NEWER_GLIB
if (!g_thread_supported())
g_thread_init(NULL);
#endif
/* al_init_native_dialog_addon() didn't always exist so GTK might not have
* been initialised. gtk_init_check knows if it's been initialised already
* so we can just call it again.
*/
{
int argc = 0;
char **argv = NULL;
if (!gtk_init_check(&argc, &argv)) {
ALLEGRO_ERROR("gtk_init_check failed\n");
return false;
}
}
nd_gtk_lock();
if (!nd_gtk_thread) {
GAsyncQueue *queue = g_async_queue_new();
#if NEWER_GLIB
nd_gtk_thread = g_thread_new("gtk thread", nd_gtk_thread_func, queue);
#else
bool joinable = FALSE;
nd_gtk_thread = g_thread_create(nd_gtk_thread_func, queue, joinable, NULL);
#endif
if (!nd_gtk_thread) {
ok = false;
}
else {
ok = (g_async_queue_pop(queue) == ACK_OK);
}
g_async_queue_unref(queue);
}
nd_gtk_unlock();
return ok;
}
开发者ID:BorisCarvajal,项目名称:allegro5,代码行数:45,代码来源:gtk_thread.c
示例18: d3d_do_upload
static void d3d_do_upload(ALLEGRO_BITMAP_D3D *d3d_bmp, int x, int y, int width,
int height, bool sync_from_memory)
{
ALLEGRO_BITMAP *bmp = (ALLEGRO_BITMAP *)d3d_bmp;
if (sync_from_memory) {
d3d_sync_bitmap_texture(bmp, x, y, width, height);
}
if (_al_d3d_render_to_texture_supported()) {
if (d3d_bmp->display->device->UpdateTexture(
(IDirect3DBaseTexture9 *)d3d_bmp->system_texture,
(IDirect3DBaseTexture9 *)d3d_bmp->video_texture) != D3D_OK) {
ALLEGRO_ERROR("d3d_do_upload: Couldn't update texture.\n");
return;
}
}
}
开发者ID:dradtke,项目名称:battlechess,代码行数:18,代码来源:d3d_bmp.cpp
示例19: al_malloc
static void *pulse_audio_update_recorder(ALLEGRO_THREAD *t, void *data)
{
ALLEGRO_AUDIO_RECORDER *r = (ALLEGRO_AUDIO_RECORDER *) data;
PULSEAUDIO_RECORDER *pa = (PULSEAUDIO_RECORDER *) r->extra;
ALLEGRO_EVENT user_event;
uint8_t *null_buffer;
unsigned int fragment_i = 0;
null_buffer = al_malloc(1024);
if (!null_buffer) {
ALLEGRO_ERROR("Unable to create buffer for draining PulseAudio.\n");
return NULL;
}
while (!al_get_thread_should_stop(t))
{
al_lock_mutex(r->mutex);
if (!r->is_recording) {
/* Even if not recording, we still want to read from the PA server.
Otherwise it will buffer everything and spit it all out whenever
the recording resumes. */
al_unlock_mutex(r->mutex);
pa_simple_read(pa->s, null_buffer, 1024, NULL);
}
else {
ALLEGRO_AUDIO_RECORDER_EVENT *e;
al_unlock_mutex(r->mutex);
if (pa_simple_read(pa->s, r->fragments[fragment_i], r->fragment_size, NULL) >= 0) {
user_event.user.type = ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT;
e = al_get_audio_recorder_event(&user_event);
e->buffer = r->fragments[fragment_i];
e->samples = r->samples;
al_emit_user_event(&r->source, &user_event, NULL);
if (++fragment_i == r->fragment_count) {
fragment_i = 0;
}
}
}
}
al_free(null_buffer);
return NULL;
};
开发者ID:BorisCarvajal,项目名称:allegro5,代码行数:44,代码来源:pulseaudio.c
示例20: ogl_lock_region_nonbb_readwrite_nonfbo
static bool ogl_lock_region_nonbb_readwrite_nonfbo(
ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap,
int x, int gl_y, int w, int h, int format)
{
/* No FBO - fallback to reading the entire texture */
const int pixel_size = al_get_pixel_size(format);
const int pitch = ogl_pitch(ogl_bitmap->true_w, pixel_size);
GLenum e;
bool ok;
(void) w;
ogl_bitmap->lock_buffer = al_malloc(pitch * ogl_bitmap->true_h);
if (ogl_bitmap->lock_buffer == NULL) {
return false;
}
ok = true;
glBindTexture(GL_TEXTURE_2D, ogl_bitmap->texture);
glGetTexImage(GL_TEXTURE_2D, 0,
get_glformat(format, 2),
get_glformat(format, 1),
ogl_bitmap->lock_buffer);
e = glGetError();
if (e) {
ALLEGRO_ERROR("glGetTexImage for format %s failed (%s).\n",
_al_pixel_format_name(format), _al_gl_error_string(e));
al_free(ogl_bitmap->lock_buffer);
ogl_bitmap->lock_buffer = NULL;
ok = false;
}
if (ok) {
bitmap->locked_region.data = ogl_bitmap->lock_buffer +
pitch * (gl_y + h - 1) + pixel_size * x;
bitmap->locked_region.format = format;
bitmap->locked_region.pitch = -pitch;
bitmap->locked_region.pixel_size = pixel_size;
}
return ok;
}
开发者ID:liballeg,项目名称:allegro5,代码行数:43,代码来源:ogl_lock.c
注:本文中的ALLEGRO_ERROR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论