Changeset 731 for abuse/trunk/src


Ignore:
Timestamp:
Jul 21, 2014, 12:50:29 AM (8 years ago)
Author:
jjsimpso
Message:

sdlport: Add support for SDL2, inculding the game controller API. Configure
script will check for SDL2 and use it if present, otherwise it will fall
back to SDL v1. Some old SDL v1 features not implemented yet on SDL2, such
as saving screenshots.

core: Small change for SDL2 game controller API to disable the game
controller in the save/load game menu.

Summary of game controller API changes:

  • Enable with -gamepad
  • Tested with PS3 dualshock 3.
  • D-pad moves, right analog controls aiming
  • X: change weapon, []: jump, R1: fire, L1: special ability, /\:use/activate
  • All menu navigation requires the mouse, which is disabled during normal game play.
Location:
abuse/trunk/src
Files:
15 added
3 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/Makefile.am

    r651 r731  
    11## Process this file with automake to produce Makefile.in
    22
    3 SUBDIRS = lisp net imlib sdlport
     3SUBDIRS = lisp net imlib @SDLPORT_DIR@
    44
    55bin_PROGRAMS = abuse abuse-tool
     
    6565    $(NULL)
    6666
    67 EXTRALIBS = lisp/liblisp.a sdlport/libsdlport.a imlib/libimlib.a net/libnet.a
     67EXTRALIBS = lisp/liblisp.a @SDLPORT_DIR@/libsdlport.a imlib/libimlib.a net/libnet.a
    6868abuse_LDADD = $(EXTRALIBS)
    6969abuse_DEPENDENCIES = $(EXTRALIBS)
     
    7575abuse_tool_DEPENDENCIES = $(abuse_tool_LDADD)
    7676
    77 INCLUDES = -I$(srcdir) -I$(srcdir)/lisp -I$(srcdir)/imlib \
     77INCLUDES = -I$(srcdir) -I $(srcdir)/lisp -I$(srcdir)/imlib \
    7878           -I$(srcdir)/net $(SDL_CFLAGS)
    7979
    8080CPPFLAGS = @CPPFLAGS@ -DNO_CHECK
    81 
  • abuse/trunk/src/imlib/event.h

    r682 r731  
    9090    }
    9191
     92  // To enable/disable game controller
     93  // enables switching between mouse and gamepad when entering certain screens
     94  // Added for SDL2 game controller support
     95  void enable_controller(bool enabled)
     96  {
     97      controller_enabled = enabled;
     98  }
     99
    92100private:
    93101    linked_list m_events;
     
    95103
    96104    image *m_screen;
     105    bool controller_enabled;
    97106
    98107protected:
  • abuse/trunk/src/loadgame.cpp

    r682 r731  
    243243    do
    244244    {
     245        // disable game controller during save/load screen so that mouse can be used
     246        wm->enable_controller(false);
     247       
    245248        wm->flush_screen();
    246249        wm->get_event(ev);
     
    259262    } while (!got_level && !quit);
    260263
     264    wm->enable_controller(true);
     265
    261266    wm->close_window(l_win);
    262267    wm->close_window(preview);
Note: See TracChangeset for help on using the changeset viewer.