本文整理汇总了C++中ALLEGRO_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ ALLEGRO_ERROR函数的具体用法?C++ ALLEGRO_ERROR怎么用?C++ ALLEGRO_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ALLEGRO_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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];
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
}
}
示例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;
}
示例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;
}