Optibits
Loading...
Searching...
No Matches
Input.hpp
1#pragma once
2
3#include <Optibits/Keyboard.hpp>
4#include <Optibits/Platform.hpp>
5#include <Optibits/Utility.hpp>
6#include <functional>
7#include <memory>
8#include <string>
9#include <vector>
10
11namespace Optibits
12{
13
14 class Input : private Noncopyable
15 {
16
17 struct Impl;
18 std::unique_ptr<Impl> pimpl;
19
20 public:
21 #ifdef OPTIBITS_IPHONE
22 Input(void* view, float upate_intrv);
23 void feedTouchEvent(); // TODO
24 #else
25 explicit Input(void* window);
26 bool feedSdlEvent(void* event);
27 #endif
28
29 ~Input();
30
31 static std::string idToChar(Key key);
32 static Key charToId(std::string ch);
33 static std::string keyName(Key key);
34
35 static std::string gamepadName(int idx);
36
37 static bool down(Key key);
38
39 static double axis(Key key);
40
41 double mouseX() const;
42 double mouseY() const;
43
44 void setMousePosition(double x, double y);
45
46
47 void update();
48
49 std::function<void (Key)> onButtonDown, onButtonUp;
50
51 };
52
53}
Definition Input.hpp:15
Definition Utility.hpp:24
Definition Input.cpp:42