Learn how to add keyboard, mouse, and joystick control to your game.
GLFW’s Window user pointer enables you to access input events from the event queue, which means that your game will never miss a keypress as can happen when polling for keyboard state.
Accessing your game-state data member variables can be done directly within GLFW’s callback functions, or by calling member functions of your game-state classes, such as a player class, and typically passing in callback parameter values (or even other game-state class variables).
This tutorial takes advantage of the previous tutorial… OpenGL shadow-maps, by incorporating keyboard, mouse and joystick control for controlling the player’s camera and adjusting the light’s parameters.
Visit https://www.programmingcreatively.com... to acquire all the source code for each OpenGL Quick Start tutorial episode. That way you can just copy and paste rather than typing it all in.
00:00 - Introduction
00:51 - Migrating code to classes
02:17 - Window user pointer
02:49 - Static callback functions
03:31 - Camera and lights demo
04:49 - Player class functions
05:59 - Polling vs event queue
07:17 - Matrix transformations