remove unnecessary SDL2 include
[skip ci]
This commit is contained in:
parent
d577a98980
commit
463205c09c
@ -54,6 +54,7 @@ public:
|
|||||||
virtual bool openAudioInputDevice(const char* name, int freq, int channels, void* userdata, AudioCallback callback) = 0;
|
virtual bool openAudioInputDevice(const char* name, int freq, int channels, void* userdata, AudioCallback callback) = 0;
|
||||||
virtual bool closeAudioInputDevice() = 0;
|
virtual bool closeAudioInputDevice() = 0;
|
||||||
|
|
||||||
|
virtual bool hasClipboard() = 0;
|
||||||
virtual void setClipboard(String text) = 0;
|
virtual void setClipboard(String text) = 0;
|
||||||
virtual Maybe<String> getClipboard() = 0;
|
virtual Maybe<String> getClipboard() = 0;
|
||||||
|
|
||||||
|
@ -481,6 +481,10 @@ private:
|
|||||||
Controller(SdlPlatform* parent)
|
Controller(SdlPlatform* parent)
|
||||||
: parent(parent) {}
|
: parent(parent) {}
|
||||||
|
|
||||||
|
bool hasClipboard() override {
|
||||||
|
return SDL_HasClipboardText();
|
||||||
|
}
|
||||||
|
|
||||||
Maybe<String> getClipboard() override {
|
Maybe<String> getClipboard() override {
|
||||||
Maybe<String> string;
|
Maybe<String> string;
|
||||||
if (SDL_HasClipboardText()) {
|
if (SDL_HasClipboardText()) {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "StarClipboardLuaBindings.hpp"
|
#include "StarClipboardLuaBindings.hpp"
|
||||||
#include "StarLuaConverters.hpp"
|
#include "StarLuaConverters.hpp"
|
||||||
|
|
||||||
#include "SDL2/SDL.h"
|
|
||||||
|
|
||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
LuaCallbacks LuaBindings::makeClipboardCallbacks(ApplicationControllerPtr appController) {
|
LuaCallbacks LuaBindings::makeClipboardCallbacks(ApplicationControllerPtr appController) {
|
||||||
LuaCallbacks callbacks;
|
LuaCallbacks callbacks;
|
||||||
|
|
||||||
callbacks.registerCallback("hasText", []() -> bool { return SDL_HasClipboardText() == SDL_TRUE;});
|
callbacks.registerCallback("hasText", [appController]() -> bool {
|
||||||
|
return appController->hasClipboard();
|
||||||
|
});
|
||||||
|
|
||||||
callbacks.registerCallback("getText", [appController]() -> Maybe<String> {
|
callbacks.registerCallback("getText", [appController]() -> Maybe<String> {
|
||||||
return appController->getClipboard();
|
return appController->getClipboard();
|
||||||
@ -21,4 +21,4 @@ LuaCallbacks LuaBindings::makeClipboardCallbacks(ApplicationControllerPtr appCon
|
|||||||
return callbacks;
|
return callbacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
}// namespace Star
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user