forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
siminteraction.h
71 lines (59 loc) · 1.4 KB
/
siminteraction.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
68
69
70
71
/*
* Copyright (c) 2013 The Simutrans Community
*
* This file is part of the Simutrans project under the artistic license.
* (see license.txt)
*/
#ifndef siminteraction_h
#define siminteraction_h
class karte_ptr_t;
class viewport_t;
struct event_t;
/**
* User interaction class, it collects and processes all user and system events from the OS.
* @brief Event manager of the game.
* @see karte_t::interactive
*/
class interaction_t
{
private:
/**
* The associated world.
*/
static karte_ptr_t world;
/**
* Associated viewport of the world, this is a cached value.
* @note Since a world in our project just has one viewport, we cache its value.
*/
viewport_t *viewport;
/**
* Processes a mouse event that's moving the camera.
*/
void move_view(const event_t &ev);
/**
* Processes a cursor movement event, related to the tool pointer in-map.
* @see zeiger_t
*/
void move_cursor(const event_t &ev);
/**
* Processes a user event on the map, like a keyclick, or a mouse event.
*/
void interactive_event(const event_t &ev);
/**
* Processes a single event.
* @return true if we need to stop processing events.
*/
bool process_event( event_t &ev );
bool is_dragging;
public:
/**
* Processes all the pending system events.
* @brief Message Pump
*/
void check_events();
/**
* @note Requires world() with it's viewport already attached!
*/
interaction_t();
};
#endif