本文整理汇总了C++中IDirectFBWindow::CreateEventBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBWindow::CreateEventBuffer方法的具体用法?C++ IDirectFBWindow::CreateEventBuffer怎么用?C++ IDirectFBWindow::CreateEventBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBWindow
的用法示例。
在下文中一共展示了IDirectFBWindow::CreateEventBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DFBCHECK
int
main( int argc, char *argv[] )
{
DFBResult ret;
int i;
int quit = 0;
const int num = 2;
Context contexts[num];
DFBCHECK(DirectFBInit( &argc, &argv ));
/* create the super interface */
DFBCHECK(DirectFBCreate( &dfb ));
DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
/* create the default font */
DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
for (i=0; i<num; i++) {
IDirectFBWindow *window;
IDirectFBSurface *surface;
IDirectFBGL *gl;
DFBWindowDescription desc;
desc.flags = DWDESC_POSX | DWDESC_POSY |
DWDESC_WIDTH | DWDESC_HEIGHT;
desc.posx = (i%3) * 200 + 10;
desc.posy = (i/3) * 200 + 10;
desc.width = 180;
desc.height = 180;
DFBCHECK(layer->CreateWindow( layer, &desc, &window ));
DFBCHECK(window->GetSurface( window, &surface ));
DFBCHECK(surface->GetGL( surface, &gl ));
contexts[i].window = window;
contexts[i].surface = surface;
contexts[i].gl = gl;
contexts[i].last_time = get_millis();
contexts[i].frames = 0;
contexts[i].fps = 0;
setup( &contexts[i] );
if (events)
DFBCHECK(window->AttachEventBuffer( window, events ));
else
DFBCHECK(window->CreateEventBuffer( window, &events ));
DFBCHECK(surface->SetFont( surface, font ));
window->SetOpacity( window, 0xff );
}
while (!quit) {
DFBWindowEvent evt;
for (i=0; i<num; i++)
update( &contexts[i] );
while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
switch (evt.type) {
case DWET_KEYDOWN:
switch (evt.key_symbol) {
case DIKS_ESCAPE:
quit = 1;
break;
default:
break;
}
break;
default:
break;
}
}
}
events->Release( events );
for (i=0; i<num; i++) {
contexts[i].gl->Release( contexts[i].gl );
contexts[i].surface->Release( contexts[i].surface );
contexts[i].window->Release( contexts[i].window );
}
font->Release( font );
layer->Release( layer );
dfb->Release( dfb );
return 0;
}
示例2:
static struct graphics_device *
directfb_init_device (void)
{
struct graphics_device *gd;
DFBDeviceData *data;
IDirectFBWindow *window;
DFBWindowDescription desc;
if (!dfb || !layer)
return NULL;
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;
/*desc.width = directfb_driver.x;
desc.height = directfb_driver.y;
desc.posx = 0;
desc.posy = 0;*/
desc.width = (int)w;
desc.height = (int)h;
desc.posx = (int)x;
desc.posy = (int)y;
if (layer->CreateWindow (layer, &desc, &window) != DFB_OK)
return NULL;
gd = mem_alloc (sizeof (struct graphics_device));
gd->size.x1 = 0;
gd->size.y1 = 0;
window->GetSize (window, &gd->size.x2, &gd->size.y2);
gd->clip = gd->size;
data = mem_alloc (sizeof (DFBDeviceData));
data->window = window;
data->mapped = 0;
data->flip_pending = 0;
data->flipWindow = 0;
data->ghostWindow = 0;
if (arrow)
window->SetCursorShape (window, arrow, arrow_hot_x, arrow_hot_y);
window->GetSurface (window, &data->surface);
window->GetID (window, &data->id);
gd->drv = &directfb_driver;
gd->driver_data = data;
gd->user_data = NULL;
directfb_add_to_table (gd);
if (!events)
{
window->CreateEventBuffer (window, &events);
event_timer = install_timer (20, directfb_check_events, events);
}
else
{
window->AttachEventBuffer (window, events);
}
return gd;
}