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-2019 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 | |
18 | #ifndef AMIGAMOUSE_HXX |
19 | #define AMIGAMOUSE_HXX |
20 | |
21 | #include "PointingDevice.hxx" |
22 | |
23 | class AmigaMouse : public PointingDevice |
24 | { |
25 | public: |
26 | /** |
27 | Create a new Amiga Mouse controller plugged into the specified jack |
28 | |
29 | @param jack The jack the controller is plugged into |
30 | @param event The event object to use for events |
31 | @param system The system using this controller |
32 | */ |
33 | AmigaMouse(Jack jack, const Event& event, const System& system) |
34 | : PointingDevice(jack, event, system, Controller::Type::AmigaMouse, |
35 | trackballSensitivity) { } |
36 | virtual ~AmigaMouse() = default; |
37 | |
38 | /** |
39 | Returns the name of this controller. |
40 | */ |
41 | string name() const override { return "AmigaMouse" ; } |
42 | |
43 | protected: |
44 | uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8, uInt8) override |
45 | { |
46 | static constexpr uInt32 ourTableH[4] = { 0b0000, 0b1000, 0b1010, 0b0010 }; |
47 | static constexpr uInt32 ourTableV[4] = { 0b0000, 0b0100, 0b0101, 0b0001 }; |
48 | |
49 | return ourTableH[countH] | ourTableV[countV]; |
50 | } |
51 | |
52 | static constexpr float trackballSensitivity = 0.8f; |
53 | }; |
54 | |
55 | #endif // AMIGAMOUSE_HXX |
56 | |