]> hackdaworld.org Git - my-code/ivac.git/commitdiff
-
authorhackbard <hackbard>
Tue, 26 Aug 2003 18:23:39 +0000 (18:23 +0000)
committerhackbard <hackbard>
Tue, 26 Aug 2003 18:23:39 +0000 (18:23 +0000)
dfbapi.c
dfbapi.o
ivac.c
ivac.h

index 45960bedf9b21a6850c59719a4b8443e768dd16c..7de46c3440128d85509ecc071bcb5b73f162a037 100644 (file)
--- a/dfbapi.c
+++ b/dfbapi.c
@@ -8,29 +8,48 @@
 #include <directfb.h>
 #include "ivac.h"
 
+// do
+// int flip_blit_callback()
+// int dfb_play_video()
+// int dfb_stop_video()
+
 int dfb_init(int arg_c,char **arg_v,struct ivac *ivac) {
-       DFBSurfaceDescription surface_dsc;
-       DFBFontDescription font_dsc;
-       
+       DFBSurfaceDescription sdsc;
+       // DFBFontDescription fdsc;
+       DFBWindowDescription wdsc;
+
+       /* init */      
        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));
+       /* input devices and event stuff */
+       ivac->dfb_stuff.dfb->GetInputDevice(ivac->dfb_stuff.dfb,DIDID_MOUSE,&(ivac->dfb_stuff.mouse));
+       ivac->dfb_stuff.dfb->GetInputDevice(ivac->dfb_stuff.dfb,DIDID_KEYBOARD,&(ivac->dfb_stuff.keyboard));
+       ivac->dfb_stuff.mouse->CreateEventBuffer(ivac->dfb_stuff.mouse,&(ivac->dfb_stuff.buffer));
 
-       font_dsc.flags=DFDESC_HEIGHT;
-       font_dsc.height=ivac->dfb_stuff.s_height/20;
+       /* first window -- video window */
+       ivac->dfb_stuff.dfb->GetDisplayLayer(ivac->dfb_stuff.dfb,DLID_PRIMARY,&(ivac->dfb_stuff.layer));
        ivac->dfb_stuff.dfb->CreateVideoProvider(ivac->dfb_stuff.dfb,ivac->video_dev,&(ivac->dfb_stuff.v_provider));
+       ivac->dfb_stuff.v_provider->GetSurfaceDescription(ivac->dfb_stuff.v_provider,&sdsc);
+
+       wdsc.flags=DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT;
+       wdsc.posx=0;
+       wdsc.posy=0;
+       wdsc.width=sdsc.width;
+       wdsc.height=sdsc.height;
+
+       ivac->dfb_stuff.layer->CreateWindow(ivac->dfb_stuff.layer,&wdsc,&(ivac->dfb_stuff.v_window));
+       ivac->dfb_stuff.v_window->GetSurface(ivac->dfb_stuff.v_window,&(ivac->dfb_stuff.v_surface));
+       ivac->dfb_stuff.v_window->SetOpacity(ivac->dfb_stuff.v_window,0xff);
+       ivac->dfb_stuff.v_provider->PlayTo(ivac->dfb_stuff.v_provider,ivac->dfb_stuff.v_surface,NULL,NULL,NULL);
 
        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.v_window->Release(ivac->dfb_stuff.v_window);
+       ivac->dfb_stuff.layer->Release(ivac->dfb_stuff.layer);
        ivac->dfb_stuff.dfb->Release(ivac->dfb_stuff.dfb);
        
        return 1;
index c1ce11098cb7b81cb94ea95c49b2b480d7533884..4dc8798882973ab50f1d17fdd4c5fc0e70f7d18c 100644 (file)
Binary files a/dfbapi.o and b/dfbapi.o differ
diff --git a/ivac.c b/ivac.c
index d4e1581c7f6cfe38a50ac972f3f2d25a82e81ca4..a9f270e518d5d6e58bb857356fff6be35d24113a 100644 (file)
--- a/ivac.c
+++ b/ivac.c
@@ -22,27 +22,12 @@ int usage(void) {
        return 1;
 }
 
-int video_callback(void *ctx) {
-       struct ivac *ivac;
-       IDirectFBSurface *surf;
-       DFBSurfaceDescription desc;
-       
-       ivac=ctx;
-       puts("debug: callback!");
-       ivac->dfb_stuff.v_provider->GetSurfaceDescription(ivac->dfb_stuff.v_provider,&desc);
-       printf("debug: w: %d -- h: %d\n",desc.width,desc.height);
-       ivac->dfb_stuff.dfb->CreateSurface(ivac->dfb_stuff.dfb,&desc,&surf);
-       ivac->dfb_stuff.p_surface->Blit(ivac->dfb_stuff.p_surface,surf,NULL,0,0);
-       ivac->dfb_stuff.p_surface->Flip(ivac->dfb_stuff.p_surface,NULL,DSFLIP_WAITFORSYNC);
-       ivac->dfb_stuff.count+=1;
-       if(ivac->dfb_stuff.count==5000)
-               ivac->dfb_stuff.v_provider->Stop(ivac->dfb_stuff.v_provider);
-       return DFENUM_OK;
-}
-
 int main(int argc, char **argv) {
        int i;
        struct ivac ivac;
+       DFBInputDeviceKeyState quit;
+
+       quit=DIKS_UP;
 
        /* default */
        strcpy(ivac.video_dev,VIDEO_DEV);
@@ -75,19 +60,9 @@ int main(int argc, char **argv) {
                return -1;
        }
 
-       puts("debug: dfb init done!!");
-
-       ivac.dfb_stuff.count=0;
-       ivac.dfb_stuff.rect.x=5;
-       ivac.dfb_stuff.rect.y=5;
-       ivac.dfb_stuff.rect.w=500;
-       ivac.dfb_stuff.rect.h=400;
-       ivac.dfb_stuff.v_provider->PlayTo(ivac.dfb_stuff.v_provider,ivac.dfb_stuff.p_surface,&(ivac.dfb_stuff.rect),video_callback,(void *)&ivac);
-
-       sleep(2);
+       getchar();
 
        dfb_tini(&ivac);
-       puts("debug: dfb tini done!!");
 
        return 1;
 }
diff --git a/ivac.h b/ivac.h
index beb9b821c1adbd89c89d6aefdff84b8be90d08b0..030b1444a16a9aedea8d815b32ebff7d174b5270 100644 (file)
--- a/ivac.h
+++ b/ivac.h
 
 struct dfb_stuff {
        IDirectFB *dfb;
-       IDirectFBSurface *p_surface;
-       IDirectFBFont *font;
-       IDirectFBInputDevice *keyboard;
-       IDirectFBEventBuffer *k_buffer;
-       IDirectFBVideoProvider *v_provider;
+       IDirectFBDisplayLayer *layer;
        IDirectFBImageProvider *i_provider;
-       int s_width,s_height;
-       DFBRectangle rect;
-       int count;
+       IDirectFBVideoProvider *v_provider;
+       IDirectFBWindow *window,*v_window;;
+       IDirectFBSurface *v_surface,*i_surface,*surface;
+       IDirectFBFont *font;
+       IDirectFBInputDevice *keyboard,*mouse;
+       IDirectFBEventBuffer *buffer;
 };
 
 struct ivac {
@@ -35,6 +34,7 @@ struct ivac {
        char video_dev[MAX_CHAR_VIDEO_DEV];
        char audio_dev[MAX_CHAR_AUDIO_DEV];
        unsigned char flags;
+       int count;
 };