blob: d9dd28bac58007b856cf11f65b22b72d6418b119 (
plain) (
blame)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
// license:BSD-3-Clause
// copyright-holders:Aaron Giles, Brad Hughes
//============================================================
//
// input_windows.h - Common code used by Windows input modules
//
//============================================================
#ifndef INPUT_WIN_H_
#define INPUT_WIN_H_
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef interface
#include "window.h"
//============================================================
// TYPEDEFS
//============================================================
// state information for a keyboard
struct keyboard_state
{
UINT8 state[MAX_KEYS];
INT8 oldkey[MAX_KEYS];
INT8 currkey[MAX_KEYS];
};
// state information for a mouse (matches DIMOUSESTATE exactly)
struct mouse_state
{
LONG lX;
LONG lY;
LONG lZ;
BYTE rgbButtons[8];
};
class wininput_module : public input_module_base
{
protected:
bool m_global_inputs_enabled;
public:
wininput_module(const char * type, const char * name)
: input_module_base(type, name),
m_global_inputs_enabled(false)
{
}
virtual bool should_hide_mouse()
{
if (winwindow_has_focus() // has focus
&& (!video_config.windowed || !win_window_list.front()->win_has_menu()) // not windowed or doesn't have a menu
&& (input_enabled() && !input_paused()) // input enabled and not paused
&& (mouse_enabled() || lightgun_enabled())) // either mouse or lightgun enabled in the core
{
return true;
}
return false;
}
virtual bool handle_input_event(input_event eventid, void* data)
{
return false;
}
protected:
void before_poll(running_machine& machine) override
{
// periodically process events, in case they're not coming through
// this also will make sure the mouse state is up-to-date
winwindow_process_events_periodic(machine);
}
bool should_poll_devices(running_machine &machine) override
{
return input_enabled() && (m_global_inputs_enabled || winwindow_has_focus());
}
};
//============================================================
// INLINE FUNCTIONS
//============================================================
INT32 generic_button_get_state(void *device_internal, void *item_internal);
INT32 generic_axis_get_state(void *device_internal, void *item_internal);
#endif
|