Prepare for gamepads
This commit is contained in:
parent
9166323b5f
commit
3ee5b75c46
3 changed files with 29 additions and 2 deletions
|
|
@ -42,7 +42,17 @@ set(SUNSHINE_TARGET_FILES
|
|||
utility.h
|
||||
uuid.h
|
||||
config.h config.cpp
|
||||
main.cpp crypto.cpp crypto.h nvhttp.cpp nvhttp.h stream.cpp stream.h video.cpp video.h queue.h input.cpp input.h audio.cpp audio.h platform/linux.cpp platform/common.h)
|
||||
main.cpp
|
||||
crypto.cpp crypto.h
|
||||
nvhttp.cpp nvhttp.h
|
||||
stream.cpp stream.h
|
||||
video.cpp video.h
|
||||
queue.h
|
||||
input.cpp input.h
|
||||
audio.cpp audio.h
|
||||
platform/linux.cpp
|
||||
platform/linux_evdev.cpp
|
||||
platform/common.h)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
|
@ -50,6 +60,7 @@ include_directories(
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/moonlight-common-c/enet/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/moonlight-common-c/reedsolomon
|
||||
${X11_INCLUDE_DIR}
|
||||
/usr/include/libevdev-1.0
|
||||
${FFMPEG_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
|
@ -82,7 +93,8 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
|||
pulse
|
||||
pulse-simple
|
||||
|
||||
opus)
|
||||
opus
|
||||
evdev)
|
||||
|
||||
add_definitions(-DSUNSHINE_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
||||
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
||||
|
|
|
|||
1
main.cpp
1
main.cpp
|
|
@ -12,6 +12,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
#include "config.h"
|
||||
#include "platform/common.h"
|
||||
using namespace std::literals;
|
||||
int main(int argc, char *argv[]) {
|
||||
if(argc > 1) {
|
||||
|
|
|
|||
|
|
@ -14,17 +14,30 @@ void freeDisplay(void*);
|
|||
void freeImage(void*);
|
||||
void freeAudio(void*);
|
||||
void freeMic(void*);
|
||||
void freeGamePad(void*);
|
||||
|
||||
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>;
|
||||
using gamepad_t = util::safe_ptr<void, freeGamePad>;
|
||||
|
||||
struct gamepad_state_t {
|
||||
std::uint16_t buttonFlags;
|
||||
std::uint8_t lt;
|
||||
std::uint8_t rt;
|
||||
std::uint16_t lsX;
|
||||
std::uint16_t lsY;
|
||||
std::uint16_t rsX;
|
||||
std::uint16_t rsY;
|
||||
};
|
||||
|
||||
std::string get_local_ip();
|
||||
display_t display();
|
||||
img_t snapshot(display_t &display);
|
||||
mic_t microphone();
|
||||
audio_t audio(mic_t &mic, std::uint32_t sample_size);
|
||||
gamepad_t gamepad();
|
||||
|
||||
int32_t img_width(img_t &);
|
||||
int32_t img_height(img_t &);
|
||||
|
|
@ -36,6 +49,7 @@ void move_mouse(display_t::element_type *display, int deltaX, int deltaY);
|
|||
void button_mouse(display_t::element_type *display, int button, bool release);
|
||||
void scroll(display_t::element_type *display, int distance);
|
||||
void keyboard(display_t::element_type *display, uint16_t modcode, bool release);
|
||||
void gamepad_event(gamepad_t &gamepad, const gamepad_state_t &gamepad_state);
|
||||
}
|
||||
|
||||
#endif //SUNSHINE_COMMON_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue