本文整理汇总了C++中SDL_DFB_DEVICEDATA函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_DFB_DEVICEDATA函数的具体用法?C++ SDL_DFB_DEVICEDATA怎么用?C++ SDL_DFB_DEVICEDATA使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_DFB_DEVICEDATA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DirectFB_GetDisplayModes
void
DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
{
SDL_DFB_DEVICEDATA(_this);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
SDL_DisplayMode mode;
struct modes_callback_t data;
int i;
data.nummodes = 0;
/* Enumerate the available fullscreen modes */
SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode));
SDL_DFB_CHECKERR(devdata->dfb->EnumVideoModes(devdata->dfb,
EnumModesCallback, &data));
for (i = 0; i < data.nummodes; ++i) {
mode = data.modelist[i];
mode.format = SDL_PIXELFORMAT_ARGB8888;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_RGB888;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_RGB24;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_RGB565;
CheckSetDisplayMode(_this, display, dispdata, &mode);
mode.format = SDL_PIXELFORMAT_INDEX8;
CheckSetDisplayMode(_this, display, dispdata, &mode);
}
SDL_DFB_FREE(data.modelist);
error:
return;
}
示例2: DirectFB_TranslateKeyInputEvent
static SDL_keysym *
DirectFB_TranslateKeyInputEvent(_THIS, int index, DFBInputEvent * evt,
SDL_keysym * keysym)
{
SDL_DFB_DEVICEDATA(_this);
if (evt->key_code >= 0 &&
evt->key_code < SDL_arraysize(linux_scancode_table))
keysym->scancode = linux_scancode_table[evt->key_code];
else
keysym->scancode = SDL_SCANCODE_UNKNOWN;
if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
devdata->keyboard[index].is_generic) {
if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
else
keysym->scancode = SDL_SCANCODE_UNKNOWN;
}
keysym->unicode =
(DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
if (keysym->unicode == 0 &&
(evt->key_symbol > 0 && evt->key_symbol < 255))
keysym->unicode = evt->key_symbol;
return keysym;
}
示例3: DirectFB_GL_SwapWindow
void
DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
int ret;
DFBRegion region;
region.x1 = 0;
region.y1 = 0;
region.x2 = window->w;
region.y2 = window->h;
if (devdata->glFinish)
devdata->glFinish();
else if (devdata->glFlush)
devdata->glFlush();
if (1 || windata->gl_context) {
/* SDL_DFB_CHECKERR(windata->gl_context->context->Unlock(windata->gl_context->context)); */
SDL_DFB_CHECKERR(windata->surface->Flip(windata->surface, ®ion,
DSFLIP_ONSYNC));
/* SDL_DFB_CHECKERR(windata->gl_context->context->Lock(windata->gl_context->context)); */
}
return;
error:
return;
}
示例4: DirectFB_DestroyWindow
void
DirectFB_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
DFB_WindowData *p;
SDL_DFB_DEBUG("Trace\n");
/* Some cleanups */
windata->window->UngrabPointer(windata->window);
windata->window->UngrabKeyboard(windata->window);
windata->window_surface->SetFont(windata->window_surface, NULL);
SDL_DFB_RELEASE(windata->icon);
SDL_DFB_RELEASE(windata->eventbuffer);
SDL_DFB_RELEASE(windata->surface);
SDL_DFB_RELEASE(windata->window_surface);
SDL_DFB_RELEASE(windata->window);
/* Remove from list ... */
p = devdata->firstwin;
while (p && p->next != windata)
p = p->next;
if (p)
p->next = windata->next;
else
devdata->firstwin = windata->next;
SDL_free(windata);
return;
}
示例5: LoadFont
static void
LoadFont(_THIS, SDL_Window * window)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
if (windata->font != NULL) {
SDL_DFB_RELEASE(windata->font);
windata->font = NULL;
SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
}
if (windata->theme.font != NULL)
{
DFBFontDescription fdesc;
SDL_zero(fdesc);
fdesc.flags = DFDESC_HEIGHT;
fdesc.height = windata->theme.font_size;
SDL_DFB_CHECK(devdata->
dfb->CreateFont(devdata->dfb, windata->theme.font,
&fdesc, &windata->font));
SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
}
}
示例6: DirectFB_InitMouse
void
DirectFB_InitMouse(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
devdata->num_mice = 0;
if (devdata->use_linux_input) {
/* try non-core devices first */
id_mask = 0xF0;
devdata->dfb->EnumInputDevices(devdata->dfb, EnumMice, devdata);
if (devdata->num_mice == 0) {
/* try core devices */
id_mask = 0x0F;
devdata->dfb->EnumInputDevices(devdata->dfb, EnumMice, devdata);
}
}
if (devdata->num_mice == 0) {
SDL_Mouse mouse;
SDL_zero(mouse);
mouse.CreateCursor = DirectFB_CreateCursor;
mouse.ShowCursor = DirectFB_ShowCursor;
mouse.MoveCursor = DirectFB_MoveCursor;
mouse.FreeCursor = DirectFB_FreeCursor;
mouse.WarpMouse = DirectFB_WarpMouse;
mouse.FreeMouse = DirectFB_FreeMouse;
mouse.cursor_shown = 1;
SDL_AddMouse(&mouse, "Mouse", 0, 0, 1);
devdata->num_mice = 1;
}
}
示例7: DirectFB_InitKeyboard
void
DirectFB_InitKeyboard(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
cb_data cb;
DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap));
devdata->num_keyboard = 0;
cb.devdata = devdata;
if (devdata->use_linux_input) {
cb.sys_kbd = 0;
cb.sys_ids = 0;
SDL_DFB_CHECK(devdata->dfb->
EnumInputDevices(devdata->dfb, EnumKeyboards, &cb));
if (devdata->num_keyboard == 0) {
cb.sys_ids = 1;
SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
EnumKeyboards,
&cb));
}
} else {
cb.sys_kbd = 1;
SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
EnumKeyboards,
&cb));
}
}
示例8: CheckSetDisplayMode
static void
CheckSetDisplayMode(_THIS, SDL_VideoDisplay * display, DFB_DisplayData * data, SDL_DisplayMode * mode)
{
SDL_DFB_DEVICEDATA(_this);
DFBDisplayLayerConfig config;
DFBDisplayLayerConfigFlags failed;
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
DLSCL_ADMINISTRATIVE));
config.width = mode->w;
config.height = mode->h;
config.pixelformat = DirectFB_SDLToDFBPixelFormat(mode->format);
config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
if (devdata->use_yuv_underlays) {
config.flags |= DLCONF_OPTIONS;
config.options = DLOP_ALPHACHANNEL;
}
failed = 0;
data->layer->TestConfiguration(data->layer, &config, &failed);
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
DLSCL_SHARED));
if (failed == 0)
{
SDL_AddDisplayMode(display, mode);
SDL_DFB_LOG("Mode %d x %d Added\n", mode->w, mode->h);
}
else
SDL_DFB_ERR("Mode %d x %d not available: %x\n", mode->w,
mode->h, failed);
return;
error:
return;
}
示例9: DirectFB_AcquireVidLayer
static int
DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
{
//SDL_DFB_RENDERERDATA(renderer);
SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DFB_DEVICEDATA(display->device);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
DirectFB_TextureData *data = texture->driverdata;
DFBDisplayLayerConfig layconf;
DFBResult ret;
if (devdata->use_yuv_direct && (dispdata->vidID >= 0)
&& (!dispdata->vidIDinuse)
&& SDL_ISPIXELFORMAT_FOURCC(data->format)) {
layconf.flags =
DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
DLCONF_SURFACE_CAPS;
layconf.width = texture->w;
layconf.height = texture->h;
layconf.pixelformat = DirectFB_SDLToDFBPixelFormat(data->format);
layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE;
SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
dispdata->vidID,
&dispdata->vidlayer));
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetCooperativeLevel(dispdata->vidlayer,
DLSCL_EXCLUSIVE));
if (devdata->use_yuv_underlays) {
ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1);
if (ret != DFB_OK)
SDL_DFB_DEBUG("Underlay Setlevel not supported\n");
}
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetConfiguration(dispdata->vidlayer,
&layconf));
SDL_DFB_CHECKERR(dispdata->
vidlayer->GetSurface(dispdata->vidlayer,
&data->surface));
dispdata->vidIDinuse = 1;
data->display = display;
return 0;
}
return 1;
error:
if (dispdata->vidlayer) {
SDL_DFB_RELEASE(data->surface);
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetCooperativeLevel(dispdata->vidlayer,
DLSCL_ADMINISTRATIVE));
SDL_DFB_RELEASE(dispdata->vidlayer);
}
return 1;
}
示例10: DirectFB_QuitMouse
void
DirectFB_QuitMouse(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
if (devdata->use_linux_input) {
SDL_MouseQuit();
} else {
SDL_DelMouse(0);
}
}
示例11: KbdIndex
static int
KbdIndex(_THIS, int id)
{
SDL_DFB_DEVICEDATA(_this);
int index;
for (index = 0; index < devdata->num_keyboard; index++) {
if (devdata->keyboard[index].id == id)
return index;
}
return -1;
}
示例12: DirectFB_CreateDefaultCursor
static SDL_Cursor *
DirectFB_CreateDefaultCursor(void)
{
SDL_VideoDevice *dev = SDL_GetVideoDevice();
SDL_DFB_DEVICEDATA(dev);
DFB_CursorData *curdata;
DFBResult ret;
DFBSurfaceDescription dsc;
SDL_Cursor *cursor;
Uint32 *dest;
Uint32 *p;
int pitch, i, j;
SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor));
SDL_DFB_ALLOC_CLEAR(curdata, sizeof(*curdata));
dsc.flags =
DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
dsc.caps = DSCAPS_VIDEOONLY;
dsc.width = 32;
dsc.height = 32;
dsc.pixelformat = DSPF_ARGB;
SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
&curdata->surf));
curdata->hotx = 0;
curdata->hoty = 0;
cursor->driverdata = curdata;
SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
(void *) &dest, &pitch));
/* Relies on the fact that this is only called with ARGB surface. */
for (i = 0; i < 32; i++)
{
for (j = 0; j < 32; j++)
{
switch (arrow[i][j])
{
case ' ': dest[j] = 0x00000000; break;
case '.': dest[j] = 0xffffffff; break;
case 'X': dest[j] = 0xff000000; break;
}
}
dest += (pitch >> 2);
}
curdata->surf->Unlock(curdata->surf);
return cursor;
error:
return NULL;
}
示例13: DirectFB_SetWindowIcon
void
DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
SDL_Surface *surface = NULL;
DFBResult ret;
if (icon) {
SDL_PixelFormat format;
DFBSurfaceDescription dsc;
Uint32 *dest;
Uint32 *p;
int pitch, i;
/* Convert the icon to ARGB for modern window managers */
SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
0xFF000000);
surface = SDL_ConvertSurface(icon, &format, 0);
if (!surface) {
return;
}
dsc.flags =
DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
dsc.caps = DSCAPS_VIDEOONLY;
dsc.width = surface->w;
dsc.height = surface->h;
dsc.pixelformat = DSPF_ARGB;
SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
&windata->icon));
SDL_DFB_CHECKERR(windata->icon->Lock(windata->icon, DSLF_WRITE,
(void *) &dest, &pitch));
p = surface->pixels;
for (i = 0; i < surface->h; i++)
memcpy((char *) dest + i * pitch,
(char *) p + i * surface->pitch, 4 * surface->w);
windata->icon->Unlock(windata->icon);
SDL_FreeSurface(surface);
} else {
SDL_DFB_RELEASE(windata->icon);
}
return;
error:
if (surface)
SDL_FreeSurface(surface);
SDL_DFB_RELEASE(windata->icon);
return;
}
示例14: FocusAllKeyboards
static void
FocusAllKeyboards(_THIS, SDL_Window *window)
{
#if USE_MULTI_API
SDL_DFB_DEVICEDATA(_this);
int index;
for (index = 0; index < devdata->num_keyboard; index++)
SDL_SetKeyboardFocus(index, id);
#else
SDL_SetKeyboardFocus(window);
#endif
}
示例15: FocusAllMice
static void
FocusAllMice(_THIS, SDL_Window *window)
{
#if USE_MULTI_API
SDL_DFB_DEVICEDATA(_this);
int index;
for (index = 0; index < devdata->num_mice; index++)
SDL_SetMouseFocus(devdata->mouse_id[index], id);
#else
SDL_SetMouseFocus(window);
#endif
}