From: hackbard Date: Mon, 24 Mar 2003 16:43:31 +0000 (+0000) Subject: some more dfb stuff X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc4fbff2dcad64083b2fa7403d6d17650097c0fd;p=physik%2Fmorpheus.git some more dfb stuff --- diff --git a/defines.h b/defines.h index 0be5bc4..19ce139 100644 --- a/defines.h +++ b/defines.h @@ -36,7 +36,7 @@ typedef long long unsigned int u64; /* display stuff */ typedef struct __display { u32 max_x,max_y,max_z; /* dimensions */ - u32 *cell_p; /* pointer to cell data */ + void *cell_p; /* pointer to cell data */ #ifdef USE_DFB_API IDirectFB *dfb; /* pointer to dfb main construct */ IDirectFBSurface *primary_surface; /* pointer to dfb primary surface */ @@ -49,6 +49,8 @@ typedef struct __display { #define DEFAULT_DISPLAY_Z 50 #define DEFAULT_DISPLAY_REF_RATE 100 +#define DISPLAY_X_FREE 15 +#define DISPLAY_Y_FREE 15 /* masks for u32 cell */ #define AMORPH 0x00000001 diff --git a/display.c b/display.c index f61e7e2..62612e7 100644 --- a/display.c +++ b/display.c @@ -15,7 +15,7 @@ static int screen_width=0; static int screen_height=0; #endif -int display_init(int x,int y,int z,display *display,u32 *cell,int *argc,char **argv) +int display_init(int x,int y,int z,display *display,void *cell,int *argc,char **argv) { #ifdef USE_DFB_API DFBSurfaceDescription surface_dsc; @@ -46,9 +46,24 @@ int display_init(int x,int y,int z,display *display,u32 *cell,int *argc,char **a return 23; } -int display_draw(u32 *cell,int x,int y,int z) +int display_draw(display *display,int x,int y,int z) { #ifdef USE_DFB_API + int x_c,y_c; + int display_faktor_x,display_faktor_y; + if(((display->max_x+display->max_y+DISPLAY_X_FREE)>=display->screen_width)| + ((display->max_y+display->max_z+DISPLAY_Y_FREE)>=display->screen_height)) + { + puts("resolution too low!"); + return -23; + } + display_faktor_x=display->screen_width/(display->max_x+display->max_y); + display_faktor_y=display->screen_height/(display->max_z+display->max_y); + /* draw x-z surface */ + // for(x_c=1;x_c<=display->max_x,x_c++) + // { + + #endif return 23; diff --git a/main.c b/main.c index 07f34c9..190955c 100644 --- a/main.c +++ b/main.c @@ -173,13 +173,14 @@ int main(int argc,char **argv) /* display stuff */ if((i%display_refresh_rate)==0) { - puts("refreshing diplay ..."); + puts("refreshing display ..."); // display_draw(&display,display_x,display_y,display_z); } /* */ } /* display again and quit when button hit */ + display_draw(&display,display_x,display_y,display_z); puts("hit button to quit ..."); getchar();