-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinterface-manager.h
67 lines (58 loc) · 1.78 KB
/
interface-manager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
// Copyright(c) Leonardo Romor <[email protected]>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://gnu.org/licenses/gpl-2.0.txt>
#ifndef _INTERFACE_MANAGER_H
#define _INTERFACE_MANAGER_H
#include <X11/Xlib.h>
#include <chrono>
#include "scene.h"
#include "input/xinput2.h"
#include "input/gamepad.h"
#include "camera.h"
class InterfaceManager {
public:
InterfaceManager(Display *display, Window window,
Scene *scene, Camera *camera,
XInput2 *xinput2, Gamepad *gamepad);
bool Exit() { return exit_; }
void UpdateScene(double dt);
private:
Display *display_;
Window window_;
Scene *scene_;
Camera *camera_;
XInput2 *xinput2_;
Gamepad *gamepad_;
struct GamepadState {
float axis_left_x_;
float axis_left_y_;
float axis_right_x_;
float axis_right_y_;
} gamepad_state_;
enum MouseStateValue {
IDLE,
DRAG_MODE1,
DRAG_MODE2
};
int mouse_state_;
bool exit_;
// Mouse pointer stuff
void EnableDragMode1();
void EnableDragMode2();
void DisableDragMode();
void DispatchPointerMotionEvent(double dx, double dy);
void DispatchWheelEvent(float dz);
void DispatchKeyPressEvent(unsigned int keysim);
};
#endif // _INTERFACE_MANAGER_H