1 / 13

Gaming Input and the Arcade

Donald Heer 2/14/2011. Gaming Input and the Arcade. Overview. Input Types Keyboard Mouse Examples The Arcade What inputs does the arcade have?. Inputs in General. Input is an Event Event: an action that is usually initiated outside the scope of a program Asynchronous

danae
Download Presentation

Gaming Input and the Arcade

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Donald Heer 2/14/2011 Gaming Input and the Arcade

  2. Overview • Input Types • Keyboard • Mouse • Examples • The Arcade • What inputs does the arcade have?

  3. Inputs in General • Input is an Event • Event: an action that is usually initiated outside the scope of a program • Asynchronous • Should be ‘caught’ and buffered

  4. Simple Directmedia Layer (SDL) • SDL is a ‘wrapper’ that allows for use of many standard function in a way that is easier for producing games • SDL contains input and output functions including mouse, keyboard, sound, and video. • SDL is compatible with OpenGL

  5. Sample Program • The sample program we will be using is: • Based on NeHe source (Lesson 3) • Controls the rotation of a cube based on mouse and keyboard input.

  6. Keyboard Events bool Lesson::processEvents(){ SDL_Event event; while (SDL_PollEvent(&event)){ switch (event.type)case{ case SDL_KEYDOWN:{ SDLKey sym = event.key.keysym.sym;

  7. Mouse Events bool Lesson::processEvents(){ SDL_Event event; while (SDL_PollEvent(&event)){ switch (event.type)case{ case SDL_MOUSEBUTTONDOWN:{ std::cout << "Mouse Button Pressed."; if( event.button.button == SDL_BUTTON_LEFT )

  8. Example • Lets look at the sample code.

  9. 2 player Support Acts as a Keyboard Currently setup for ‘free play’ The Arcade

  10. Player 1 Controls • ‘Add Credit’ button is ‘5’ • Limit your program to no more than 8 buttons at once • http://www.ultimarc.com/ipac2.html

  11. Arcade Gotchas • Make sure to check for all buttons, not just the ‘first button’

  12. Summary • Input must be captured and processed when time is available • Special abilities (click and hold) need to be hand made in many cases

  13. Questions?

More Related