2019-12-03 19:23:33 +00:00
|
|
|
//
|
|
|
|
// Created by loki on 6/21/19.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef SUNSHINE_COMMON_H
|
|
|
|
#define SUNSHINE_COMMON_H
|
|
|
|
|
2019-12-04 23:59:01 +00:00
|
|
|
#include <string>
|
2019-12-08 17:55:58 +00:00
|
|
|
#include "sunshine/utility.h"
|
2019-12-03 19:23:33 +00:00
|
|
|
|
|
|
|
namespace platf {
|
|
|
|
|
|
|
|
void freeDisplay(void*);
|
|
|
|
void freeImage(void*);
|
|
|
|
void freeAudio(void*);
|
|
|
|
void freeMic(void*);
|
2019-12-06 15:33:13 +00:00
|
|
|
void freeInput(void*);
|
2019-12-03 19:23:33 +00:00
|
|
|
|
|
|
|
using display_t = util::safe_ptr<void, freeDisplay>;
|
|
|
|
using img_t = util::safe_ptr<void, freeImage>;
|
|
|
|
using mic_t = util::safe_ptr<void, freeMic>;
|
|
|
|
using audio_t = util::safe_ptr<void, freeAudio>;
|
2019-12-06 15:33:13 +00:00
|
|
|
using input_t = util::safe_ptr<void, freeInput>;
|
2019-12-05 23:13:16 +00:00
|
|
|
|
|
|
|
struct gamepad_state_t {
|
|
|
|
std::uint16_t buttonFlags;
|
|
|
|
std::uint8_t lt;
|
|
|
|
std::uint8_t rt;
|
2019-12-06 15:33:13 +00:00
|
|
|
std::int16_t lsX;
|
|
|
|
std::int16_t lsY;
|
|
|
|
std::int16_t rsX;
|
|
|
|
std::int16_t rsY;
|
2019-12-05 23:13:16 +00:00
|
|
|
};
|
2019-12-03 19:23:33 +00:00
|
|
|
|
2019-12-04 23:59:01 +00:00
|
|
|
std::string get_local_ip();
|
2019-12-06 15:33:13 +00:00
|
|
|
|
2019-12-03 19:23:33 +00:00
|
|
|
mic_t microphone();
|
|
|
|
audio_t audio(mic_t &mic, std::uint32_t sample_size);
|
|
|
|
|
2019-12-06 15:33:13 +00:00
|
|
|
display_t display();
|
|
|
|
img_t snapshot(display_t &display);
|
2019-12-03 19:23:33 +00:00
|
|
|
int32_t img_width(img_t &);
|
|
|
|
int32_t img_height(img_t &);
|
|
|
|
|
|
|
|
uint8_t *img_data(img_t &);
|
|
|
|
int16_t *audio_data(audio_t &);
|
|
|
|
|
2019-12-06 15:33:13 +00:00
|
|
|
input_t input();
|
|
|
|
void move_mouse(input_t &input, int deltaX, int deltaY);
|
|
|
|
void button_mouse(input_t &input, int button, bool release);
|
|
|
|
void scroll(input_t &input, int distance);
|
|
|
|
void keyboard(input_t &input, uint16_t modcode, bool release);
|
|
|
|
void gamepad(input_t &input, const gamepad_state_t &gamepad_state);
|
2019-12-03 19:23:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif //SUNSHINE_COMMON_H
|