remove unnecessary SDL2 include

[skip ci]
This commit is contained in:
Kae 2024-03-17 01:52:34 +11:00
parent d577a98980
commit 463205c09c
4 changed files with 10 additions and 5 deletions

View File

@ -54,6 +54,7 @@ public:
virtual bool openAudioInputDevice(const char* name, int freq, int channels, void* userdata, AudioCallback callback) = 0;
virtual bool closeAudioInputDevice() = 0;
virtual bool hasClipboard() = 0;
virtual void setClipboard(String text) = 0;
virtual Maybe<String> getClipboard() = 0;

View File

@ -481,6 +481,10 @@ private:
Controller(SdlPlatform* parent)
: parent(parent) {}
bool hasClipboard() override {
return SDL_HasClipboardText();
}
Maybe<String> getClipboard() override {
Maybe<String> string;
if (SDL_HasClipboardText()) {

View File

@ -1,14 +1,14 @@
#include "StarClipboardLuaBindings.hpp"
#include "StarLuaConverters.hpp"
#include "SDL2/SDL.h"
namespace Star {
LuaCallbacks LuaBindings::makeClipboardCallbacks(ApplicationControllerPtr appController) {
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> {
return appController->getClipboard();
@ -21,4 +21,4 @@ LuaCallbacks LuaBindings::makeClipboardCallbacks(ApplicationControllerPtr appCon
return callbacks;
};
}// namespace Star
}