官术网_书友最值得收藏!

Chapter 4. Grab That Joystick – Input and Event Management

Arguably, the most important aspect of any game ever made is actually being able to play it. Regardless of the purpose of input, ranging from simply hitting keys to navigating through menus to controlling when your character jumps and which direction he or she walks to, the lack of an application presenting a way for you to interact with it might as well leave you with a very fancy screensaver. We have very briefly looked at the primitive way of grabbing and using the keyboard input, however our motivation for this chapter is quite different than simply being content with a large nest of if/else statements that handle every single key being pressed. Instead, we want to look at a more robust way of handling not just the keyboard, but also the mouse and any events that happen between the frames, along with adding potential for processing input of additional peripherals, such as joysticks. With that in mind, let's take a look at what we will be covering in this chapter:

  • Basic means of checking the states of keyboard and mouse buttons
  • Understanding and processing different types of events
  • Understanding and utilizing callbacks
  • Designing and implementing an event manager

Let's not sit still like the character of your game without input and get on coding!

主站蜘蛛池模板: 抚远县| 河西区| 彩票| 阳山县| 邮箱| 新蔡县| 民权县| 青海省| 阿坝县| 浙江省| 安西县| 崇义县| 安岳县| 资溪县| 邵阳县| 德兴市| 宁津县| 文昌市| 广元市| 思茅市| 灵台县| 日喀则市| 嘉荫县| 南郑县| 天津市| 四平市| 济南市| 西乡县| 从江县| 金山区| 曲松县| 顺义区| 闽清县| 通化市| 五家渠市| 堆龙德庆县| 绵竹市| 蓬溪县| 北辰区| 温泉县| 昌都县|