RetroArch/input/apple_input.h

98 lines
2.7 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2014 - Daniel De Matteis
2014-01-01 01:50:59 +01:00
* Copyright (C) 2013-2014 - Jason Fetters
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __APPLE_RARCH_INPUT_H__
#define __APPLE_RARCH_INPUT_H__
#include "../general.h"
2014-09-02 16:50:28 +02:00
/* Input responder */
#define MAX_TOUCHES 16
#define MAX_KEYS 256
typedef struct
{
int16_t screen_x, screen_y;
int16_t fixed_x, fixed_y;
int16_t full_x, full_y;
} apple_touch_data_t;
typedef struct
{
apple_touch_data_t touches[MAX_TOUCHES];
uint32_t touch_count;
uint32_t mouse_buttons;
int16_t mouse_delta[2];
uint32_t keys[MAX_KEYS];
uint32_t pad_buttons[MAX_PLAYERS];
int16_t pad_axis[MAX_PLAYERS][4];
} apple_input_data_t;
struct apple_pad_connection;
2014-09-02 16:50:28 +02:00
struct apple_pad_interface
{
2014-09-28 15:06:28 +02:00
void* (*connect)(void *data, uint32_t slot);
void (*disconnect)(void* device);
void (*packet_handler)(void* device, uint8_t *packet, uint16_t size);
2014-09-02 16:50:28 +02:00
void (*set_rumble)(void* device, enum retro_rumble_effect effect,
uint16_t strength);
};
2014-09-28 15:06:28 +02:00
/* Joypad data */
int32_t apple_joypad_connect(const char* name, void *data);
2014-09-02 16:50:28 +02:00
int32_t apple_joypad_connect_gcapi(void);
2014-09-02 16:50:28 +02:00
void apple_joypad_disconnect(uint32_t slot);
2014-09-02 16:50:28 +02:00
void apple_joypad_packet(uint32_t slot, uint8_t* data, uint32_t length);
2014-09-02 16:50:28 +02:00
/* Determine if connected joypad is a hidpad backed device.
* If false, apple_joypad_packet cannot be used */
bool apple_joypad_has_interface(uint32_t slot);
2014-09-02 16:50:28 +02:00
/* This is implemented in the platform-specific
* portions of the input code */
2014-09-28 15:06:28 +02:00
void apple_joypad_send_hid_control(void *connect_data,
2014-09-02 16:50:28 +02:00
uint8_t* data, size_t size);
2014-09-02 16:50:28 +02:00
/* Input data for the main thread and the game thread */
extern apple_input_data_t g_current_input_data;
2014-09-02 16:50:28 +02:00
/* Main thread only */
void apple_input_enable_icade(bool on);
2014-09-02 16:50:28 +02:00
void apple_input_enable_small_keyboard(bool on);
2014-09-02 16:50:28 +02:00
uint32_t apple_input_get_icade_buttons(void);
2014-09-02 16:50:28 +02:00
void apple_input_reset_icade_buttons(void);
2014-09-02 16:50:28 +02:00
void apple_input_keyboard_event(bool down, unsigned code,
uint32_t character, uint32_t mod);
extern int32_t apple_input_find_any_key(void);
2014-09-02 16:50:28 +02:00
extern int32_t apple_input_find_any_button(uint32_t port);
2014-09-02 16:50:28 +02:00
extern int32_t apple_input_find_any_axis(uint32_t port);
#endif