1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Mouse and Keyboard Input in Gosu

By

1 of 5

Mouse and Keyboard Input in Gosu
Mouse and Keyboard Input in Gosu

Games are, by definition, interactive. Gosu makes this interaction straightforward with a simple interface for detecting and reacting to key and mouse button presses.

There are two primary ways to handle input in your program. The first is an event-oriented approach. When buttons are pressed, your programs receives an event and you can react accordingly. The second is to check if, at the time of an update, a certain button is pressed. Both techniques are perfectly valid, use whichever one suits you best.

This article is part of a series. Read more articles about Rapid Game Prototyping in Ruby

©2014 About.com. All rights reserved.