本文整理汇总了C++中DirectFBCreate函数的典型用法代码示例。如果您正苦于以下问题:C++ DirectFBCreate函数的具体用法?C++ DirectFBCreate怎么用?C++ DirectFBCreate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DirectFBCreate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dfb_init
void
dfb_init(int argc, char *argv[])
{
DFBCHECK(DirectFBInit( &argc, &argv ));
/* quiet option is no longer supported in DFB 1.2 */
/* DFBCHECK(DirectFBSetOption ("quiet", "")); */
/* create the super interface */
DFBCHECK(DirectFBCreate( &dfb ));
dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
layer->GetConfiguration (layer, &layer_config);
/* get the primary surface, i.e. the surface of the primary layer we have
exclusive access to */
memset( &dsc, 0, sizeof(DFBSurfaceDescription) );
dsc.flags =
DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
dsc.width = layer_config.width;
dsc.height = layer_config.height;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_SYSTEMONLY /*| DSCAPS_FLIPPING */;
/* FIXME */
dsc.pixelformat = DSPF_RGB16;
DFBCHECK(dfb->CreateSurface(dfb, &dsc, &primary ));
primary->GetSize (primary, &opt.client.width, &opt.client.height);
DFBCHECK(dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard ));
DFBCHECK(dfb->GetInputDevice( dfb, DIDID_MOUSE, &mouse ));
DFBCHECK (dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_TRUE, &input_buffer));
}
示例2: dfb_post_connect
int
dfb_post_connect(rdpInst * inst)
{
GDI *gdi;
dfbInfo *dfbi = GET_DFBI(inst);
gdi_init(inst);
gdi = GET_GDI(inst);
dfbi->err = DirectFBCreate(&(dfbi->dfb));
dfbi->dsc.flags = DSDESC_CAPS;
dfbi->dsc.caps = DSCAPS_PRIMARY;
dfbi->err = dfbi->dfb->CreateSurface(dfbi->dfb, &(dfbi->dsc), &(dfbi->primary));
dfbi->err = dfbi->primary->GetSize(dfbi->primary, &(gdi->width), &(gdi->height));
dfbi->dfb->SetVideoMode(dfbi->dfb, gdi->width, gdi->height, gdi->dstBpp);
dfbi->dfb->CreateInputEventBuffer(dfbi->dfb, DICAPS_ALL, DFB_TRUE, &(dfbi->event_buffer));
dfbi->event_buffer->CreateFileDescriptor(dfbi->event_buffer, &(dfbi->read_fds));
dfbi->dfb->GetDisplayLayer(dfbi->dfb, 0, &(dfbi->layer));
dfbi->layer->EnableCursor(dfbi->layer, 1);
dfbi->dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PREALLOCATED | DSDESC_PIXELFORMAT;
dfbi->dsc.caps = DSCAPS_SYSTEMONLY;
dfbi->dsc.width = gdi->width;
dfbi->dsc.height = gdi->height;
dfbi->dsc.pixelformat = DSPF_AiRGB;
dfbi->dsc.preallocated[0].data = gdi->primary_buffer;
dfbi->dsc.preallocated[0].pitch = gdi->width * 4;
dfbi->dfb->CreateSurface(dfbi->dfb, &(dfbi->dsc), &(dfbi->surface));
return 0;
}
示例3: dfb_init
int dfb_init(int argc, char** argv, unsigned short width, unsigned short height) {
DFBCHECK(DirectFBInit (&argc, &argv));
DFBCHECK(DirectFBCreate (&DFBC_INTERFACE_));
DFBCHECK(DFBC_INTERFACE_->SetCooperativeLevel (DFBC_INTERFACE_, DFSCL_FULLSCREEN));
DFBC_ESCAPECTRL_ = DIKS_UP;
DFBC_SURFACE_DESC_.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT;
DFBC_SURFACE_DESC_.height = height;
DFBC_SURFACE_DESC_.width = width;
DFBC_SURFACE_DESC_.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
DFBCHECK(DFBC_INTERFACE_->CreateSurface(DFBC_INTERFACE_, &DFBC_SURFACE_DESC_, &DFBC_SURFACE_));
DFBCHECK(DFBC_SURFACE_->GetSize (DFBC_SURFACE_, &DFB_SCREENW, &DFB_SCREENH));
//Hide the cursor
DFBC_INTERFACE_->GetDisplayLayer(DFBC_INTERFACE_, 0x00, &DFBC_LAYER_);
DFBC_LAYER_->SetCooperativeLevel(DFBC_LAYER_, DLSCL_ADMINISTRATIVE);
DFBC_LAYER_->SetCursorOpacity(DFBC_LAYER_, 0);
/*
* TO-DO
* Return code
*/
return 0;
}
示例4: directfb_init
g_error directfb_init(void) {
DFBResult err;
DFBSurfaceDescription dsc;
err = DirectFBInit(NULL, NULL); /* no argc/argv */
dfb_errcheck_die;
err = DirectFBCreate (&directfb);
dfb_errcheck_die;
//directfb->SetCooperativeLevel (directfb, DFSCL_FULLSCREEN);
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
err = directfb->CreateSurface(directfb, &dsc, &primary);
dfb_errcheck_die;
err = primary->GetSize (primary, &vid->xres, &vid->yres);
dfb_errcheck_die;
vid->display = NULL;
// FIXME
if (!vid->bpp) vid->bpp = 32;
#ifdef DRIVER_DIRECTFBINPUT
/* Load a main input driver */
return load_inlib(&directfbinput_regfunc,&inlib_main);
#else
return success;
#endif
}
示例5: main
int
main( int argc, char** argv )
{
IDirectFB *dfb = NULL;
ISaWMan *saw = NULL;
ISaWManManager *manager = NULL;
D_INFO( "SaWMan/Sample1: Initializing...\n" );
CHECK( DirectFBInit( &argc, &argv ) );
CHECK( DirectFBCreate( &dfb ) );
CHECK( SaWManCreate( &saw ) );
CHECK( saw->CreateManager( saw, &callbacks, NULL, &manager ) );
pause();
out:
D_INFO( "SaWMan/Sample1: Shutting down...\n" );
if (manager)
manager->Release( manager );
if (saw)
saw->Release( saw );
if (dfb)
dfb->Release( dfb );
return 0;
}
示例6: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
IDirectFB *dfb;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: DirectFBCreate() failed!\n" );
return ret;
}
/* Required for keyboard access */
dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
TestResize( dfb );
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}
示例7: v4pDisplayInit
// Prepare things before the very first graphic rendering
Boolean v4pDisplayInit(int quality, Boolean fullscreen) {
int rc = success;
/* Get screen size from display structure macro */
int wantedWidth = defaultScreenWidth * 2 / (3 - quality);
int wantedHeight = defaultScreenHeight * 2 / (3 - quality);
int argc = 0;
char *argv[] = {"directFB"};
DirectFBInit(&argc, &argv);
DirectFBCreate(&dfb);
if (fullscreen) {
dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN);
}
DFBSurfaceDescription dsc;
/* dsc.flags = DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT; */
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY /* | DSCAPS_FLIPPING */;
dsc.width = wantedWidth;
dsc.height = wantedHeight;
dfb->CreateSurface( dfb, &dsc, &v4pDisplayDefaultContextS.surface);
v4pDisplayDefaultContextS.surface->GetSize (
v4pDisplayDefaultContextS.surface,
&v4pDisplayDefaultContextS.width,
&v4pDisplayDefaultContextS.height);
v4pDisplaySetContext(v4pDisplayDefaultContext);
return rc;
}
示例8: putenv
DirectFBFrame *createWindowFrame(const char *inTitle, int inWidth, int inHeight, unsigned int inFlags)
{
putenv ((char*)"DFBARGS=system=x11");
DirectFBInit(0, NULL);
DirectFBCreate(&dfb);
bool fullscreen = (inFlags & wfFullScreen) != 0;
if (fullscreen)
{
dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
}
else
{
//dfb->SetCooperativeLevel(dfb, DFSCL_NORMAL);
dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
}
dfb->SetVideoMode(dfb, inWidth, inHeight, 32);
dfb->CreateInputEventBuffer(dfb, (DFBInputDeviceCapabilities)(DICAPS_KEYS | DICAPS_BUTTONS), DFB_FALSE, &sgEventBuffer);
DFBSurfaceDescription dsc;
dsc.flags = DSDESC_CAPS;
dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_FLIPPING);
dsc.width = inWidth;
dsc.height = inHeight;
IDirectFBSurface *surface = NULL;
dfb->CreateSurface(dfb, &dsc, &surface);
return new DirectFBFrame(surface, inWidth, inHeight);
}
示例9: testing_multicore
int testing_multicore() {
IDirectFB *dfb = NULL;
IDirectFBSurface *surface = NULL;
DFBSurfaceDescription dsc;
pid_t n_pid = fork();
if (n_pid) {
sleep(1);
}
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb, dfb->Release);
DFBCHECK(dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &surface ));
push_release(surface, surface->Release);
if (!n_pid) {
sleep(1);
}
sleep(2);
//DFBCHECK(surface->Release(surface));
//DFBCHECK(dfb->Release(dfb));
release_all();
if (n_pid) {
wait(NULL);
}
return 0;
}
示例10: main
int
main( int argc, char *argv[] )
{
DFBResult ret;
IDirectFB *dfb;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Init: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Init: DirectFBCreate() failed!\n" );
return ret;
}
/* Shutdown DirectFB. */
ret = dfb->Release( dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Init: IDirectFB::Release() failed!\n" );
return ret;
}
return 0;
}
示例11: OpenDisplay
static int OpenDisplay(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
DFBSurfaceDescription dsc;
/*dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH;*/
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
/*dsc.width = 352;*/
/*dsc.height = 240;*/
IDirectFB *directfb = NULL;
if (DirectFBCreate(&directfb) != DFB_OK || !directfb)
return VLC_EGENERIC;
sys->directfb = directfb;
IDirectFBSurface *primary = NULL;
if (directfb->CreateSurface(directfb, &dsc, &primary) || !primary)
return VLC_EGENERIC;
sys->primary = primary;
primary->GetSize(primary, &sys->width, &sys->height);
primary->GetPixelFormat(primary, &sys->pixel_format);
primary->FillRectangle(primary, 0, 0, sys->width, sys->height);
primary->Flip(primary, NULL, 0);
return VLC_SUCCESS;
}
示例12: get_display_layer_window
int get_display_layer_window() {
IDirectFB *dfb = NULL;
IDirectFBDisplayLayer *layer = NULL;
IDirectFBWindow *window = NULL;
DFBWindowDescription desc;
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb,dfb->Release);
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
push_release(layer, layer->Release);
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;
desc.posx = desc.posy = desc.width = desc.height = 20;
DFBCHECK(layer->CreateWindow(layer, &desc, &window));
push_release(window, window->Release);
/* check window */
release_all();
return 0;
}
示例13: directfb_init
int directfb_init(int argc, char *argv[])
{
DFBSurfaceDescription dsc;
DFBFontDescription font_dsc;
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_NORMAL));
dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_INTERLACED | DSCAPS_FLIPPING;
dsc.pixelformat = DSPF_YUY2;
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 48;
DFBCHECK (dfb->CreateFont (dfb, "Vera.ttf", &font_dsc, &font));
DFBCHECK (primary->SetFont(primary, font));
/* Blank screen */
DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF));
DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));
/* Print text */
DFBCHECK (primary->SetColor (primary, 0x80, 0x0, 0x20, 0xFF));
DFBCHECK (primary->DrawString (primary, title, -1, 10, screen_height-100, DSTF_LEFT));
/* Flip the front and back buffer, but wait for the vertical retrace to avoid tearing. */
DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
font->Release (font);
return 23;
}
示例14: DFBCHECK
/** Opens application window and return pointer to offscreen buffer for */
char *directfbapp_open_window() {
DFBWindowDescription wdesc;
DFBDisplayLayerConfig lconfig;
static char *argv_array[] = {
"CVM",
"--dfb:system=FBDev"
",force-windowed" /* use windows instead of surfaces */
",no-vt-switch" /* do not switch between Linux' VT */
",no-cursor" /* do not use pointer */
// ",no-deinit-check" /* do not check for deinit */
,NULL
};
int argc = sizeof argv_array / sizeof argv_array[0] - 1;
char **argv = argv_array;
IDirectFBDisplayLayer *dlayer;
char *dst;
int pitch;
unsigned int win_id;
int win_x, win_y;
DFBCHECK(DirectFBInit(&argc, &argv));
DFBCHECK(DirectFBCreate(&dfb));
DFBCHECK(dfb->SetCooperativeLevel(dfb, DFSCL_NORMAL));
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &dlayer));
DFBCHECK(dlayer->GetConfiguration(dlayer, &lconfig));
wdesc.caps = DWCAPS_DOUBLEBUFFER;
wdesc.surface_caps = DSCAPS_DOUBLE;
wdesc.pixelformat = DSPF_RGB16;
wdesc.width = CHAM_WIDTH;
wdesc.height = CHAM_HEIGHT;
wdesc.flags = DWDESC_CAPS | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT |
DWDESC_SURFACE_CAPS;
DFBCHECK(dlayer->CreateWindow(dlayer, &wdesc, &window));
releaseInterface(dlayer);
if ((lconfig.flags & (DLCONF_WIDTH | DLCONF_HEIGHT)) == (DLCONF_WIDTH | DLCONF_HEIGHT)) {
DFBCHECK(window->GetID(window, &win_id));
set_win_position(win_id, lconfig.width, lconfig.height, win_x, win_y);
DFBCHECK(window->MoveTo(window, win_x, win_y));
}
DFBCHECK(window->RaiseToTop(window));
DFBCHECK(window->SetOpacity(window, 0xff));
DFBCHECK(window->RequestFocus(window));
DFBCHECK(window->GetSurface(window, &screen));
DFBCHECK(screen->GetSize(screen, &screen_width, &screen_height));
DFBCHECK(screen->Lock(screen, DSLF_WRITE, (void**)(void*)&dst, &pitch));
if (pitch != (int)sizeof(gxj_pixel_type) * screen_width) {
REPORT_ERROR(LC_LOWUI,
"Invalid pixel format: Supports only 16-bit, 5:6:5 display");
goto dfb_err;
}
return dst;
dfb_err:;
directfbapp_finalize();
exit(1); /* TODO: exit from Java */
/* return NULL; */
}
示例15: setVideoMode
void Renderer::init()
{
if (m_initialized) return;
// Set Video mode, if requested.
// Must be done before DirectFBCreate()!
if (m_videoMode != -1)
{
setVideoMode(m_videoMode);
}
DFBSurfaceDescription dsc;
if (DirectFBCreate(&m_dfb) != DFB_OK) {
fprintf(stderr, "Error in DirectFBCreate!\n"); return;
}
if (m_dfb->SetCooperativeLevel(m_dfb, DFSCL_EXCLUSIVE) != DFB_OK) {
fprintf(stderr, "Error in SetCooperativeLevel!\n"); return;
}
dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS | DSDESC_PIXELFORMAT);
dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE);
dsc.pixelformat = (DFBSurfacePixelFormat)DSPF_ARGB;
if (m_dfb->CreateSurface( m_dfb, &dsc, &m_surface ) != DFB_OK) {
fprintf(stderr, "Error in CreateSurface!\n"); return;
}
if (m_surface->GetSize (m_surface, &m_width, &m_height) != DFB_OK) {
fprintf(stderr, "Error in GetSize!\n"); return;
}
m_scale = ((float)m_width) / VIRTUAL_WIDTH;
m_width = VIRTUAL_WIDTH;
m_height = VIRTUAL_HEIGHT;
m_curr_buffer = 0;
color(0,0,0,0xff);
rect(0,0,m_width, m_height); flip();
rect(0,0,m_width, m_height); flip();
if (m_dfb->GetInputDevice (m_dfb, INPUT_DEVICE, &m_input) != DFB_OK) {
fprintf(stderr, "Error in GetInputDevice!\n"); return;
}
if (m_input->CreateEventBuffer (m_input, &m_eventBuffer) != DFB_OK) {
fprintf(stderr, "Error in CreateEventBuffer!\n"); return;
}
// m_image_loader = new ImageLoader();
// m_image_loader->start();
m_exit = false;
m_initialized = true;
}