Skip to content

mikyll/SDL2-Controller-Tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License
LinkedIn GitHub followers


SDL2 Controller Tester

This little application has been made while I was attending a tutorial to make games in C using SDL2. Since my purpose will be to implement a game with both keyboard or controller input, I wanted to test which of my PS3 controller feature I could use (spoiler: each one).
Explore the docs »

View Demo · Report Bug | Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

Demo Video
Demo video

Built With

Written:

Tested:

  • on UNIX system (Debian 9.8 running on a VM)
  • with a PS3 Official Controller: Sony® DualShock 3

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Git
  • SDL2
  • At least one controller compatible with your OS

SDL2 Installation

Linux

The easiest way is to open a terminal and install the packages required. In Debian-based distributions, use Advanced Packaging Tool by entering apt-get install libsdl2-dev or every one using apt-get install libsdl2-*. In Fedora-based distributions, enter sudo dnf install SDL2-devel make gcc. Otherwise download the source code from there, extract the content and cd to the main directory. Then run ./configure to configure the installation, make all to compile the source, and finally make install to install the package.

Windows (MinGW)

  1. Download SDL2 source code .zip from there and extract the content.
  2. Inside SDL2-2.0.14, depending on your OS, open the 32bit or 64bit directory, respectively i686-w64-mingw32 or x86_64-w64-mingw32.
  3. Then copy the content of the lib subdirectory to the MinGW lib directory (which should be at C:\MinGW\lib).
  4. Then, going back to our SDL2 directory, open the include subdirectory and copy the folder SDL2 to the MinGW include subdirectory. NB: to compile a project which uses SLD2 libraries, you also need SDL2.dll, which can be found inside the bin subdirectory of the 32 or 64 bit version of the SDL2 root directory (SDL2-2.0.14, the one extracted from the archive). This one has to be put in the directory from which you compile the application.

Project Build (Linux)

  1. Clone the repo.
    git clone https://github.com/mikyll/SDL2-Controller-Tester
    cd SDL2-Controller-Tester
  2. Install SDL2. In Debian-based distributions:
    sudo apt-get install sdl2-*
  3. Compile the project using the makefile.
    make

Usage

  1. Connect the controller via cable.
  2. Run the application.
  3. Spam buttons.
  4. Press the button 0 and 3 (respectively SELECT and START in the case of a PS3 controller) at the same time to make the controller vibrate.

For more detailed information, please refer to the Documentation.

Roadmap

See the open issues for the full list of proposed features (and known issues).

Open Issues

Future developments

  • Add SDL_JoyBallEvent and SDL_JoyHatEvent events in doInput().
  • Sound effects when connecting or disconnecting a device.
  • GUI with text for details.
  • Interactive demo.
  • Use SDL Game Controller support.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

License

Distributed under the GNU v3.0 License. See LICENSE for more information.

Contact

Michele Righi - [email protected]

Project Link: https://github.com/mikyll/SDL2-Controller-Tester

Acknowledgements

  • Parallel Realities for the lovely and super detailed tutorials involving game development in C using SDL2, from which I "stole" (actually I bought some of the tutorials, they're extremely cheap -just 1$ each one-) the project structure and the makefile.
  • Othneil Drew for the amazing README template.