当前位置: 首页>>代码示例>>C++>>正文


C++ IDirectFBWindow::AttachEventBuffer方法代码示例

本文整理汇总了C++中IDirectFBWindow::AttachEventBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBWindow::AttachEventBuffer方法的具体用法?C++ IDirectFBWindow::AttachEventBuffer怎么用?C++ IDirectFBWindow::AttachEventBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDirectFBWindow的用法示例。


在下文中一共展示了IDirectFBWindow::AttachEventBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static struct graphics_device *
directfb_init_device (void)
{
  struct graphics_device *gd;
  DFBDeviceData          *data;
  IDirectFBWindow        *window;
  DFBWindowDescription    desc;

  desc.flags  = (DFBWindowDescriptionFlags)(DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY);
  desc.width  = directfb_driver.x;
  desc.height = directfb_driver.y;
  desc.posx   = 0;
  desc.posy   = 0;

  retry:
  if (layer->CreateWindow (layer, &desc, &window) != DFB_OK) {
    if (out_of_memory(MF_GPI, NULL, 0))
      goto retry;
    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->flip_pending = 0;

  if (arrow)
    window->SetCursorShape (window, arrow, arrow_hot_x, arrow_hot_y);

  window->GetSurface (window, &data->surface);
  window->GetID (window, &data->id);

  gd->driver_data = data;
  gd->user_data   = NULL;

  directfb_add_to_table (gd);

  window->AttachEventBuffer (window, events);

  window->SetOpacity (window, FOCUSED_OPACITY);

  return gd;
}
开发者ID:coolstreamtech,项目名称:cst-public-plugins-links,代码行数:51,代码来源:directfb.c

示例2: 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;
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:95,代码来源:multi_window.c

示例3:

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;
}
开发者ID:Gingar,项目名称:port,代码行数:64,代码来源:directfb.c


注:本文中的IDirectFBWindow::AttachEventBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。