X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=blobdiff_plain;f=dfbapi.c;h=138f7e44bfaa7bdcf983ba50081af874652a3f5a;hp=3d0e4d0dcfe5cb3466b8557dbe6b56b04fa14c18;hb=cae1c91bf6b8d41d5a436f48f6e18514eeedbfb9;hpb=3525ca35938a42b8c518b65e3747541893025de3 diff --git a/dfbapi.c b/dfbapi.c index 3d0e4d0..138f7e4 100644 --- a/dfbapi.c +++ b/dfbapi.c @@ -6,6 +6,7 @@ */ #include +#include #include "dfbapi.h" /* two dimensional lattice */ @@ -231,7 +232,7 @@ int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v) d3_l->p_surface->SetColor(d3_l->p_surface,r,g,b,a); d3_l->p_surface->DrawRectangle(d3_l->p_surface, x_c*d3_l->fakt_x+X_GAP, - y_c*d3_l->fakt_x+d3_l->info_x, + y_c*d3_l->fakt_y+d3_l->info_y, d3_l->fakt_x,d3_l->fakt_y); } } @@ -271,5 +272,45 @@ int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v) } } + /* now we flip all to surface */ + d3_l->p_surface->Flip(d3_l->p_surface,NULL,0); + + return 1; +} + +int d2_event_init(d2_lattice *d2_l) +{ + d2_l->dfb->GetInputDevice(d2_l->dfb,DIDID_KEYBOARD,&(d2_l->keyboard)); + d2_l->keyboard->CreateEventBuffer(d2_l->keyboard,&(d2_l->k_buffer)); + + return 1; +} + +int d3_event_init(d3_lattice *d3_l) +{ + d3_l->dfb->GetInputDevice(d3_l->dfb,DIDID_KEYBOARD,&(d3_l->keyboard)); + d3_l->keyboard->CreateEventBuffer(d3_l->keyboard,&(d3_l->k_buffer)); + + return 1; +} + +int scan_event(d3_lattice *d3_l,int *x,int *y,int *z,int *q,int *esc) +{ + DFBInputEvent ke; + + d3_l->k_buffer->GetEvent(d3_l->k_buffer,DFB_EVENT(&ke)); + if(ke.type==DIET_KEYPRESS) + { + if(ke.key_id==DIKI_LEFT && *x!=0) *x-=1; + if(ke.key_id==DIKI_RIGHT && *x!=d3_l->max_x-1) *x+=1; + if(ke.key_id==DIKI_DOWN && *y!=0) *y-=1; + if(ke.key_id==DIKI_UP && *y!=d3_l->max_y-1) *y+=1; + if(ke.key_id==DIKI_PAGE_DOWN && *z!=0) *z-=1; + if(ke.key_id==DIKI_PAGE_UP && *z!=d3_l->max_z-1) *z+=1; + if(ke.key_id==DIKI_Q) *q=1; + if(ke.key_id==DIKI_ESCAPE) *esc=1; + } + return 1; -} +} +