Skip to Main Content
Hands-On Reactive Programming with Clojure - Second Edition
book

Hands-On Reactive Programming with Clojure - Second Edition

by Konrad Szydlo, Leonardo Borges
January 2019
Intermediate to advanced content levelIntermediate to advanced
298 pages
7h 46m
English
Packt Publishing
Content preview from Hands-On Reactive Programming with Clojure - Second Edition

Modeling user input as event streams

One of the things that we discussed in the previous chapters is that, if you can think of events as a list of things that haven't happened yet, you can probably model it as an event stream. In our case, this list is composed of the keys that the player presses during the game, and can be visualized like so:

There is a catch, though. Most games need to handle simultaneously pressed keys.

Say you're flying the spaceship forward. You don't want to have to stop it in order to rotate it to the left and then continue moving forward. What you want is to press left at the same time you're pressing up and have the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Clojure Programming

Clojure Programming

Chas Emerick, Brian Carper, Christophe Grand
Clojure in Action, Second Edition

Clojure in Action, Second Edition

Amit Rathore, Francis Avila
Programming Clojure, 2nd Edition

Programming Clojure, 2nd Edition

Stuart Halloway, Aaron Bedra

Publisher Resources

ISBN: 9781789346138Supplemental Content