1 //============================================================================ 2 // 3 // SSSS tt lll lll 4 // SS SS tt ll ll 5 // SS tttttt eeee ll ll aaaa 6 // SSSS tt ee ee ll ll aa 7 // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" 8 // SS SS tt ee ll ll aa aa 9 // SSSS ttt eeeee llll llll aaaaa 10 // 11 // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony 12 // and the Stella Team 13 // 14 // See the file "License.txt" for information on usage and redistribution of 15 // this file, and for a DISCLAIMER OF ALL WARRANTIES. 16 // 17 // $Id: Event.hxx 2838 2014-01-17 23:34:03Z stephena $ 18 //============================================================================ 19 20 #ifndef EVENT_HXX 21 #define EVENT_HXX 22 23 #include "bspf.hxx" 24 #include "StellaKeys.hxx" 25 26 /** 27 @author Bradford W. Mott 28 @version $Id: Event.hxx 2838 2014-01-17 23:34:03Z stephena $ 29 */ 30 class Event 31 { 32 public: 33 /** 34 Enumeration of all possible events in Stella, including both 35 console and controller event types as well as events that aren't 36 technically part of the emulation core 37 */ 38 enum Type 39 { 40 NoType, 41 ConsoleOn, ConsoleOff, ConsoleColor, ConsoleBlackWhite, 42 ConsoleLeftDiffA, ConsoleLeftDiffB, 43 ConsoleRightDiffA, ConsoleRightDiffB, 44 ConsoleSelect, ConsoleReset, 45 46 JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight, 47 JoystickZeroFire, JoystickZeroFire5, JoystickZeroFire9, 48 JoystickOneUp, JoystickOneDown, JoystickOneLeft, JoystickOneRight, 49 JoystickOneFire, JoystickOneFire5, JoystickOneFire9, 50 51 PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog, PaddleZeroFire, 52 PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog, PaddleOneFire, 53 PaddleTwoDecrease, PaddleTwoIncrease, PaddleTwoAnalog, PaddleTwoFire, 54 PaddleThreeDecrease, PaddleThreeIncrease, PaddleThreeAnalog, PaddleThreeFire, 55 56 KeyboardZero1, KeyboardZero2, KeyboardZero3, 57 KeyboardZero4, KeyboardZero5, KeyboardZero6, 58 KeyboardZero7, KeyboardZero8, KeyboardZero9, 59 KeyboardZeroStar, KeyboardZero0, KeyboardZeroPound, 60 61 KeyboardOne1, KeyboardOne2, KeyboardOne3, 62 KeyboardOne4, KeyboardOne5, KeyboardOne6, 63 KeyboardOne7, KeyboardOne8, KeyboardOne9, 64 KeyboardOneStar, KeyboardOne0, KeyboardOnePound, 65 66 Combo1, Combo2, Combo3, Combo4, Combo5, Combo6, Combo7, Combo8, 67 Combo9, Combo10, Combo11, Combo12, Combo13, Combo14, Combo15, Combo16, 68 69 SALeftAxis0Value, SALeftAxis1Value, 70 SARightAxis0Value, SARightAxis1Value, 71 72 MouseAxisXValue, MouseAxisYValue, 73 MouseButtonLeftValue, MouseButtonRightValue, 74 75 ChangeState, LoadState, SaveState, TakeSnapshot, Quit, 76 PauseMode, MenuMode, CmdMenuMode, DebuggerMode, LauncherMode, 77 Fry, VolumeDecrease, VolumeIncrease, 78 79 UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown, 80 UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir, 81 82 LastType 83 }; 84 85 public: 86 /** 87 Create a new event object 88 */ Event()89 Event() { clear(); } 90 91 public: 92 /** 93 Get the value associated with the event of the specified type 94 */ get(Type type) const95 Int32 get(Type type) const { return myValues[type]; } 96 97 /** 98 Set the value associated with the event of the specified type 99 */ set(Type type,Int32 value)100 void set(Type type, Int32 value) { myValues[type] = value; } 101 102 /** 103 Clears the event array (resets to initial state) 104 */ clear()105 void clear() 106 { 107 for(uInt32 i = 0; i < LastType; ++i) 108 myValues[i] = Event::NoType; 109 110 for(uInt32 i = 0; i < KBDK_LAST; ++i) 111 myKeyTable[i] = false; 112 } 113 114 /** 115 Get the keytable associated with this event 116 */ getKeys() const117 const bool* getKeys() const { return myKeyTable; } 118 119 /** 120 Set the value associated with the event of the specified type 121 */ setKey(StellaKey key,bool state)122 void setKey(StellaKey key, bool state) { myKeyTable[key] = state; } 123 124 private: 125 // Array of values associated with each event type 126 Int32 myValues[LastType]; 127 128 // Array of keyboard key states 129 bool myKeyTable[KBDK_LAST]; 130 }; 131 132 #endif 133