mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 14:15:46 -04:00
Android: Basic touchscreen controller implementation
This commit is contained in:
@ -2,13 +2,17 @@
|
||||
#include "YBaseLib/Event.h"
|
||||
#include "YBaseLib/Timer.h"
|
||||
#include "core/host_interface.h"
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <jni.h>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
struct ANativeWindow;
|
||||
|
||||
class Controller;
|
||||
|
||||
class AndroidHostInterface final : public HostInterface
|
||||
{
|
||||
public:
|
||||
@ -26,7 +30,15 @@ public:
|
||||
|
||||
void SurfaceChanged(ANativeWindow* window, int format, int width, int height);
|
||||
|
||||
void SetControllerType(u32 index, std::string_view type_name);
|
||||
void SetControllerButtonState(u32 index, s32 button_code, bool pressed);
|
||||
|
||||
private:
|
||||
enum : u32
|
||||
{
|
||||
NUM_CONTROLLERS = 2
|
||||
};
|
||||
|
||||
void EmulationThreadEntryPoint(ANativeWindow* initial_surface, std::string initial_filename,
|
||||
std::string initial_state_filename);
|
||||
|
||||
@ -36,6 +48,8 @@ private:
|
||||
|
||||
void DrawFPSWindow();
|
||||
|
||||
void ConnectControllers() override;
|
||||
|
||||
jobject m_java_object = {};
|
||||
|
||||
std::mutex m_callback_mutex;
|
||||
@ -45,4 +59,7 @@ private:
|
||||
std::atomic_bool m_emulation_thread_stop_request{false};
|
||||
std::atomic_bool m_emulation_thread_start_result{false};
|
||||
Event m_emulation_thread_started;
|
||||
|
||||
std::array<std::string, NUM_CONTROLLERS> m_controller_type_names;
|
||||
std::array<std::shared_ptr<Controller>, NUM_CONTROLLERS> m_controllers;
|
||||
};
|
||||
|
Reference in New Issue
Block a user