]> hackdaworld.org Git - physik/nlsop.git/commitdiff
added event stuff
authorhackbard <hackbard>
Tue, 13 May 2003 10:23:54 +0000 (10:23 +0000)
committerhackbard <hackbard>
Tue, 13 May 2003 10:23:54 +0000 (10:23 +0000)
dfbapi.c

index 3d0e4d0dcfe5cb3466b8557dbe6b56b04fa14c18..4144783ece09132c3be5a3658125fe3868d93bbf 100644 (file)
--- a/dfbapi.c
+++ b/dfbapi.c
@@ -272,4 +272,37 @@ int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v)
  }
 
  return 1;
-} 
+}
+
+int 2d_event_init(2d_lattice *2d_l)
+{
+ 2d_l->dfb->GetInputDevice(2d_l->dfb,DIDID_KEYBOARD,&(2d_l->keyboard));
+ 2d_l->keyboard->CreateEventBuffer(2d_l->keyboard,&(2d_l->k_buffer));
+ return 1;
+}
+
+int 3d_event_init(3d_lattice *3d_l)                                           
+{                                                                             
+ 3d_l->dfb->GetInputDevice(3d_l->dfb,DIDID_KEYBOARD,&(3d_l->keyboard));
+ 3d_l->keyboard->CreateEventBuffer(3d_l->keyboard,&(3d_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==DIET_DOWN && *y!=0) *y-=1;
+  if(ke.key_id==DIET_UP && *y!=d3_l->max_y-1) *y+=1;
+ }
+
+ return 1;
+}
+