RetroArch
menu_input.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  * Copyright (C) 2011-2017 - Daniel De Matteis
4  * Copyright (C) 2016-2017 - Brad Parker
5  *
6  * RetroArch is free software: you can redistribute it and/or modify it under the terms
7  * of the GNU General Public License as published by the Free Software Found-
8  * ation, either version 3 of the License, or (at your option) any later version.
9  *
10  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  * PURPOSE. See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along with RetroArch.
15  * If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _MENU_INPUT_H
19 #define _MENU_INPUT_H
20 
21 #include <stdint.h>
22 #include <compat/strl.h>
23 
24 #include <retro_common_api.h>
25 #include <libretro.h>
26 
27 #include "../input/input_types.h"
28 
30 
32 {
51 };
52 
54 {
60 };
61 
63 {
72 };
73 
75 {
85 };
86 
87 typedef struct menu_input
88 {
89  struct
90  {
91  unsigned ptr;
92  } mouse;
93 
94  struct
95  {
96  bool back;
97  bool pressed[2];
102  unsigned ptr;
103  unsigned counter;
104  float accel;
105  } pointer;
106 } menu_input_t;
107 
108 typedef struct menu_input_ctx_hitbox
109 {
115 
116 /*
117  * This function gets called in order to process all input events
118  * for the current frame.
119  *
120  * Sends input code to menu for one frame.
121  *
122  * It uses as input the local variables' input' and 'trigger_input'.
123  *
124  * Mouse and touch input events get processed inside this function.
125  *
126  * NOTE: 'input' and 'trigger_input' is sourced from the keyboard and/or
127  * the gamepad. It does not contain input state derived from the mouse
128  * and/or touch - this gets dealt with separately within this function.
129  *
130  * TODO/FIXME - maybe needs to be overhauled so we can send multiple
131  * events per frame if we want to, and we shouldn't send the
132  * entire button state either but do a separate event per button
133  * state.
134  */
135 unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_state);
136 
137 /* Set a specific keyboard key.
138  *
139  * 'down' sets the latch (true would
140  * mean the key is being pressed down, while 'false' would mean that
141  * the key has been released).
142  **/
143 void menu_event_kb_set(bool down, enum retro_key key);
144 
145 /* Check if a specific keyboard key has been pressed. */
146 unsigned char menu_event_kb_is_set(enum retro_key key);
147 
148 void menu_input_post_iterate(int *ret, unsigned action);
149 
151 
153 
155 
157 
159 
160 #endif
Definition: menu_input.h:82
unsigned ptr
Definition: menu_input.h:91
menu_input_ctl_state
Definition: menu_input.h:74
Definition: menu_input.h:64
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
Definition: menu_input.h:50
Definition: menu_input.h:37
Definition: menu_input.h:39
int32_t y2
Definition: menu_input.h:113
struct menu_input menu_input_t
Definition: menu_input.h:57
Definition: menu_input.h:41
bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
Definition: menu_input.c:390
Definition: menu_input.h:36
Definition: ibxm.h:9
Definition: menu_input.h:83
unsigned char menu_event_kb_is_set(enum retro_key key)
Definition: menu_input.c:114
Definition: menu_input.h:84
Definition: input_types.h:25
Definition: menu_input.h:108
Definition: menu_input.h:87
struct menu_input::@830 pointer
Definition: menu_input.h:80
Definition: menu_input.h:44
struct menu_input_ctx_hitbox menu_input_ctx_hitbox_t
Definition: menu_input.h:65
bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox)
Definition: menu_input.c:376
int16_t dx
Definition: menu_input.h:100
Definition: menu_input.h:43
int16_t dy
Definition: menu_input.h:101
Definition: menu_input.h:48
Definition: menu_input.h:77
Definition: menu_input.h:35
Definition: menu_input.h:34
signed short int16_t
Definition: stdint.h:122
void menu_input_post_iterate(int *ret, unsigned action)
Definition: menu_input.c:877
void menu_event_kb_set(bool down, enum retro_key key)
Definition: menu_input.c:131
Definition: menu_input.h:46
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
retro_key
Definition: libretro.h:308
Definition: menu_input.h:69
Definition: menu_input.h:42
Definition: menu_input.h:66
Definition: menu_input.h:47
Definition: menu_input.h:79
int16_t y
Definition: menu_input.h:99
menu_input_pointer_state
Definition: menu_input.h:53
unsigned counter
Definition: menu_input.h:103
signed int int32_t
Definition: stdint.h:123
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
int32_t y1
Definition: menu_input.h:112
Definition: menu_input.h:38
menu_action
Definition: menu_input.h:31
Definition: menu_input.h:71
int32_t x2
Definition: menu_input.h:111
Definition: menu_input.h:58
Definition: menu_input.h:81
Definition: menu_input.h:55
unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_state)
Definition: menu_input.c:163
struct menu_input::@829 mouse
Definition: menu_input.h:56
Definition: menu_input.h:76
Definition: menu_input.h:59
Definition: menu_input.h:45
float accel
Definition: menu_input.h:104
Definition: menu_input.h:40
bool back
Definition: menu_input.h:96
Definition: menu_input.h:78
int32_t x1
Definition: menu_input.h:110
Definition: menu_input.h:70
int16_t x
Definition: menu_input.h:98
bool down
Definition: connect_wiiupro.c:51
Definition: menu_input.h:33
Definition: menu_input.h:49
Definition: menu_input.h:67
bool pressed[2]
Definition: menu_input.h:97
Definition: menu_input.h:68
menu_input_mouse_state
Definition: menu_input.h:62