⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpw_event.h

📁 关于游戏手柄的驱动编程
💻 H
📖 第 1 页 / 共 2 页
字号:
  /*    cpwClearWindowEvents                                               */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Clears all events in the event stack for the specified window.     */
  /*                                                                       */
  CPW_API bool           
  cpwClearWindowEvents( pCpw cpw, 
                        uint_32 id ); 
  /*                                                                       */
  /*************************************************************************/

  /*************************************************************************/
  /*                                                                       */
  /* <Function>                                                            */
  /*    cpwClearWindowEvent                                                */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Clears all of the events of the type specified in the event stack  */
  /*    for the specified window.                                          */
  /*                                                                       */
  CPW_API bool           
  cpwClearWindowEvent( pCpw cpw, 
                       CpwWindowEvent event, 
                       uint_32 id ); 
  /*                                                                       */
  /*************************************************************************/

  /*************************************************************************/
  /*                                                                       */
  /* <Function>                                                            */
  /*    cpwPopEvent                                                        */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Discards the top event off the event stack.                        */
  /*                                                                       */
  CPW_API bool           
  cpwPopEvent( pCpw cpw );
  /*                                                                       */
  /*************************************************************************/

  /*************************************************************************/
  /*                                                                       */
  /* <Function>                                                            */
  /*    cpwStackDepth                                                      */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Returns the current number of events pending.                      */
  /*                                                                       */
  CPW_API int_32         
  cpwStackDepth( pCpw cpw );
  /*                                                                       */
  /*************************************************************************/

  /*************************************************************************/
  /*                                                                       */
  /*   internal functions and definitions                                  */
  /*                                                                       */
  /*************************************************************************/

#ifdef CPW_INTERN

  /*************************************************************************/
  /*                                                                       */
  /*   localhost event interface - see localhost adapter for information.  */
  /*                                                                       */
  /*************************************************************************/

  /* inserting events into the event stack */

  void cpw_hostevent_setfocus( pCpw cpw, uint_32 id ); 
  void cpw_hostevent_lostfocus( pCpw cpw, uint_32 id ); 
  void cpw_hostevent_cursorenter( pCpw cpw, uint_32 id );
  void cpw_hostevent_cursorleft( pCpw cpw, uint_32 id );
  void cpw_hostevent_draw( pCpw cpw, uint_32 id );
  void cpw_hostevent_reshape( pCpw cpw, uint_32 id, uint_32 width, uint_32 height );
  void cpw_hostevent_destroy( pCpw cpw, uint_32 id );
  void cpw_hostevent_position( pCpw cpw, uint_32 id, uint_32 x, uint_32 y );
  void cpw_hostevent_visibility( pCpw cpw, uint_32 id, uint_32 state );
  void cpw_hostevent_mouseclick( pCpw cpw, uint_32 id, uint_32 state, uint_32 button, uint_32 x, uint_32 y );
  void cpw_hostevent_mousedrag( pCpw cpw, uint_32 id, uint_32 button, int_32 x, int_32 y );
  void cpw_hostevent_mousemove( pCpw cpw, uint_32 id, uint_32 x, uint_32 y );
  void cpw_hostevent_keyboard( pCpw cpw, uint_32 id, uint_32 key, bool shift, uint_32 state, uint_32 x, uint_32 y );
  void cpw_hostevent_systemkeyboard( pCpw cpw, uint_32 id, uint_32 key, uint_32 state, uint_32 x, uint_32 y );
  void cpw_hostevent_menuselect( pCpw cpw, uint_32 id, uint_32 menuid, uint_32 entryid );

  /* quick check to see if an event is filtered */

  bool cpw_event_filtered( pCpw cpw, CpwWindowEvent event );

  /*************************************************************************/
  /*                                                                       */
  /* <Struct>                                                              */
  /*    CpwEventFilter                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used in storing the current event filters.             */
  /*                                                                       */
  struct _CpwEventFilter 
  {
    bool flag[CPW_EVENTCOUNT];
  };
  typedef struct _CpwEventFilter CpwEventFilter;
  /*                                                                       */
  /*************************************************************************/

  /*************************************************************************/
  /*                                                                       */
  /* <Struct>                                                              */
  /*    CpwEvent                                                           */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Events received by the localhost adapter are stored in an event    */
  /*    stack. This sturcture encompasses a single event in the event      */
  /*    stack.                                                             */
  /*                                                                       */
  struct _CpwEvent 
  {
    bool            used;   /* 1: holds a valid event, 0 : at top of stack */
    bool            filt;   /* 1: this event was purged, skip to next */
    uint_32         winid;  /* id of the window this event is destined for */
    CpwWindowEvent  event;  /* event constant */
    uint_32         p1;     /* p1-p5 are the event's parameters. */
    uint_32         p2;
    uint_32         p3;
    uint_32         p4;
    uint_32         p5;
  };
  typedef struct _CpwEvent CpwEvent;
  /*                                                                       */
  /*************************************************************************/

  /*************************************************************************/
  /*                                                                       */
  /* <Struct>                                                              */
  /*    CpwEventStack                                                      */
  /*                                                                       */
  /* <Description>                                                         */
  /*    The Cpw event stack structure.                                     */
  /*                                                                       */
  /* <Notes>                                                               */
  /*                                                                       */
  /*    The event stack is currently statically defined and holds 256      */
  /*    events. You can bump the size of this structure up to 65535 but    */
  /*    expect it to suck alot of memory. I'd like to convert this to a    */
  /*    dynamic stack, but there are a number of performance issues with   */
  /*    this i'm not in the mood to deal with right now. 256 events        */
  /*    is actually fairly respectable, i've rarely seen the stack fill    */
  /*    completely even on slow machines with crappy video cards.          */
  /*                                                                       */
  /*    When the stack fills up incoming events are discarded.             */
  /*                                                                       */
  #define CPW_EVENTSTACK_DEPTH 256 /* 255+1:uint_8 */
  struct _CpwEventStack 
  {
    uint_8         nxtindex;  /* next event location index */
    uint_8         insindex;  /* insert location index */
    CpwEvent       stack[CPW_EVENTSTACK_DEPTH];
    CpwEventFilter filter;    /* list of event filter flags */
  };
  typedef struct _CpwEventStack CpwEventStack;
  /*                                                                       */
  /*************************************************************************/

  /* init and exit */

  bool cpw_event_init( pCpw cpw );
  void cpw_event_exit( pCpw cpw );

  /* insert standard event - returns false if event is filtered */

  bool cpw_event_insert( pCpw cpw, uint_32 id, CpwWindowEvent event, 
                         uint_32 p1, uint_32 p2, uint_32 p3, uint_32 p4, uint_32 p5 );

  /* insert high priority event */

  bool cpw_event_insertnext( pCpw cpw, uint_32 id, CpwWindowEvent event,
                         uint_32 p1, uint_32 p2, uint_32 p3, uint_32 p4, uint_32 p5 );

  /* processing events in the event stack, used by main */

  bool cpw_event_sendevent( pCpw cpw );
  bool cpw_event_sendevents( pCpw cpw, uint_32 num );

#endif /* CPW_INTERN */

CPW_END_HEADER

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -