X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=dfbapi.c;fp=dfbapi.c;h=45960bedf9b21a6850c59719a4b8443e768dd16c;hb=9150a149d453da8cffd8bc362d829cebb06ae3df;hp=0000000000000000000000000000000000000000;hpb=331c29aeea2e174b40277a0c5c181255f57afbee;p=my-code%2Fivac.git diff --git a/dfbapi.c b/dfbapi.c new file mode 100644 index 0000000..45960be --- /dev/null +++ b/dfbapi.c @@ -0,0 +1,38 @@ +/* dfb functions + * + * author: hackbard@hackdaworld.dyndns.org + * + */ + +#include +#include +#include "ivac.h" + +int dfb_init(int arg_c,char **arg_v,struct ivac *ivac) { + DFBSurfaceDescription surface_dsc; + DFBFontDescription font_dsc; + + DirectFBInit(&arg_c,&arg_v); + DirectFBCreate(&(ivac->dfb_stuff.dfb)); + ivac->dfb_stuff.dfb->SetCooperativeLevel(ivac->dfb_stuff.dfb,DFSCL_FULLSCREEN); + + surface_dsc.flags=DSDESC_CAPS; + surface_dsc.caps=DSCAPS_PRIMARY|DSCAPS_FLIPPING; + ivac->dfb_stuff.dfb->CreateSurface(ivac->dfb_stuff.dfb,&surface_dsc,&(ivac->dfb_stuff.p_surface)); + ivac->dfb_stuff.p_surface->GetSize(ivac->dfb_stuff.p_surface,&(ivac->dfb_stuff.s_width),&(ivac->dfb_stuff.s_height)); + + font_dsc.flags=DFDESC_HEIGHT; + font_dsc.height=ivac->dfb_stuff.s_height/20; + ivac->dfb_stuff.dfb->CreateVideoProvider(ivac->dfb_stuff.dfb,ivac->video_dev,&(ivac->dfb_stuff.v_provider)); + + return 1; +} + +int dfb_tini(struct ivac *ivac) { + ivac->dfb_stuff.v_provider->Release(ivac->dfb_stuff.v_provider); + ivac->dfb_stuff.p_surface->Release(ivac->dfb_stuff.p_surface); + ivac->dfb_stuff.dfb->Release(ivac->dfb_stuff.dfb); + + return 1; +} +