Changeset 7811 in project


Ignore:
Timestamp:
01/21/08 04:30:17 (12 years ago)
Author:
hans
Message:
  • added IDirectFBInputDevice functions
  • dfb-create-surface can now optionally call make-dfb-surface-description by itself
File:
1 edited

Legend:

Unmodified
Added
Removed
  • directfb/trunk/directfb.scm

    r7802 r7811  
    3939         dfbs-draw-line dfbs-flip dfbs-blit dfbs-release
    4040
     41         dfbid-get-id dfbid-get-description dfbid-get-keymap-entry
     42         dfbid-create-event-buffer dfbid-attach-event-buffer
     43         dfbid-detach-event-buffer dfbid-get-key-state dfbid-get-modifiers
     44         dfbid-get-lock-state dfbid-get-buttons dfbid-get-button-state
     45         dfbid-get-axis dfbid-get-xy dfbid-release
     46
    4147         dfbeb-reset dfbeb-wait-for-event dfbeb-wait-for-event-with-timeout
    4248         dfbeb-get-event dfbeb-peek-event dfbeb-has-event dfbeb-post-event
    4349         dfbeb-wake-up dfbeb-create-file-descriptor dfbeb-release
    44          
     50         dfbeb-wait/get-event
     51
    4552         dfbip-get-surface-description dfbip-render-to dfbip-release
    4653
     
    104111
    105112(define-foreign-type dfb-text-encoding-id unsigned-int)
     113(define-foreign-type dfbid-key-identifier int)
     114(define-foreign-type dfbid-key-symbol int)
     115(define-foreign-type dfbid-key-state bool)
     116(define-foreign-type dfbid-button-identifier int)
     117(define-foreign-type dfbid-button-mask int)
     118(define-foreign-type dfbid-button-state bool)
     119(define-foreign-type dfbid-axis-identifier int)
    106120
    107121
     
    263277   flag: DIEF_TIMESTAMP)
    264278  (int key-code flag: DIEF_KEYCODE)
    265   (int key-id flag: DIEF_KEYID)
    266   (int key-symbol flag: DIEF_KEYSYMBOL)
     279  (dfbid-key-identifier key-id flag: DIEF_KEYID)
     280  (dfbid-key-symbol key-symbol flag: DIEF_KEYSYMBOL)
    267281  (dfb-input-device-modifier-mask modifiers flag: DIEF_MODIFIERS)
    268282  (dfb-input-device-lock-state locks flag: DIEF_LOCKS)
    269   (int button flag: DIEF_BUTTONS)
    270   (int buttons flag: DIEF_BUTTONS)
    271   ((int int) axis-abs flag: DIEF_AXISABS c-name: (axis axisabs))
    272   ((int int) axis-rel flag: DIEF_AXISREL c-name: (axis axisrel)))
     283  (dfbid-button-identifier button flag: DIEF_BUTTONS)
     284  (dfbid-button-mask buttons flag: DIEF_BUTTONS)
     285  ((dfbid-axis-identifier int) axis-abs flag: DIEF_AXISABS c-name: (axis axisabs))
     286  ((dfbid-axis-identifier int) axis-rel flag: DIEF_AXISREL c-name: (axis axisrel)))
    273287
    274288
     
    281295  ($dfb$ IDirectFB dfb SetCooperativeLevel ((dfb-cooperative-level level))))
    282296
    283 (define (dfb-create-surface dfb dsc)
     297(define (dfb-create-surface dfb . dsc)
    284298  (let-location ((surf c-pointer))
    285     ($dfb$ IDirectFB dfb CreateSurface ((dfb-surface-description dsc) (c-pointer #$surf)))
     299    (let ((dsc (if (null? (cdr dsc)) (car dsc) (apply make-dfb-surface-description dsc))))
     300      ($dfb$ IDirectFB dfb CreateSurface ((dfb-surface-description dsc) (c-pointer #$surf))))
    286301    (make-dfbs-interface surf)))
    287302
     
    351366
    352367;;; IDirectFBInputDevice Interface
     368
     369(define (dfbid-get-id idev)
     370  ($dfb$o IDirectFBInputDevice idev GetID ((dfb-input-device-id $out$))))
     371
     372(define (dfbid-get-description idev)
     373  (error "implement me"))
     374
     375(define (dfbid-get-keymap-entry idev keycode)
     376  (error "implement me"))
     377
     378(define (dfbid-create-event-buffer idev)
     379  (let-location ((eb c-pointer))
     380    ($dfb$ IDirectFBInputDevice idev CreateEventBuffer ((c-pointer #$eb)))
     381    (make-dfbeb-interface eb)))
     382
     383(define (dfbid-attach-event-buffer idev eb)
     384  ($dfb$ IDirectFBInputDevice idev AttachEventBuffer ((dfbeb-interface eb))))
     385
     386(define (dfbid-detach-event-buffer idev eb)
     387  ($dfb$ IDirectFBInputDevice idev DetachEventBuffer ((dfbeb-interface eb))))
     388
     389(define (dfbid-get-key-state idev key-id)
     390  ($dfb$o IDirectFBInputDevice idev GetKeyState
     391          ((dfbid-key-identifier key-id) (dfbid-key-state $out$))))
     392
     393(define (dfbid-get-modifiers idev)
     394  ($dfb$o IDirectFBInputDevice idev GetModifiers
     395          ((dfb-input-device-modifier-mask $out$))))
     396
     397(define (dfbid-get-lock-state idev)
     398  ($dfb$o IDirectFBInputDevice idev GetLockState
     399          ((dfb-input-device-lock-state $out$))))
     400
     401(define (dfbid-get-buttons idev)
     402  ($dfb$o IDirectFBInputDevice idev GetButtons
     403          ((dfbid-button-mask $out$))))
     404
     405(define (dfbid-get-button-state idev button)
     406  ($dfb$o IDirectFBInputDevice idev GetButtonState
     407          ((dfbid-button-identifier button) (dfbid-button-state $out$))))
     408
     409(define (dfbid-get-axis idev axis)
     410  ($dfb$o IDirectFBInputDevice idev GetAxis
     411          ((dfbid-axis-identifier axis) (int $out$))))
     412
     413(define (dfbid-get-xy idev)
     414  ($dfb$o IDirectFBInputDevice idev GetXY ((int $out$) (int $out$))))
     415
     416(define (dfbid-release idev)
     417  ($dfb$ IDirectFBInputDevice idev Release ()))
    353418
    354419
Note: See TracChangeset for help on using the changeset viewer.