[nostalgia/core] Add clipboard support
This commit is contained in:
parent
950712b85e
commit
efe61bab6f
19
src/nostalgia/core/clipboard.hpp
Normal file
19
src/nostalgia/core/clipboard.hpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ox/std/string.hpp>
|
||||||
|
|
||||||
|
namespace nostalgia::core {
|
||||||
|
|
||||||
|
ox::String getClipboardText(class Context *ctx) noexcept;
|
||||||
|
|
||||||
|
void setClipboardText(class Context *ctx, const ox::String &text) noexcept;
|
||||||
|
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <ox/fs/fs.hpp>
|
#include <ox/fs/fs.hpp>
|
||||||
|
|
||||||
|
#include "clipboard.hpp"
|
||||||
#include "consts.hpp"
|
#include "consts.hpp"
|
||||||
#include "gfx.hpp"
|
#include "gfx.hpp"
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
add_library(
|
add_library(
|
||||||
NostalgiaCore-GLFW
|
NostalgiaCore-GLFW
|
||||||
|
clipboard.cpp
|
||||||
core.cpp
|
core.cpp
|
||||||
gfx.cpp
|
gfx.cpp
|
||||||
)
|
)
|
||||||
|
29
src/nostalgia/core/glfw/clipboard.cpp
Normal file
29
src/nostalgia/core/glfw/clipboard.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
#include <ox/std/string.hpp>
|
||||||
|
|
||||||
|
#include <nostalgia/core/core.hpp>
|
||||||
|
|
||||||
|
#include "core.hpp"
|
||||||
|
|
||||||
|
namespace nostalgia::core {
|
||||||
|
|
||||||
|
ox::String getClipboardText(Context *ctx) noexcept {
|
||||||
|
const auto id = ctx->windowerData<GlfwImplData>();
|
||||||
|
return glfwGetClipboardString(id->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setClipboardText(Context *ctx, const ox::String &text) noexcept {
|
||||||
|
const auto id = ctx->windowerData<GlfwImplData>();
|
||||||
|
glfwSetClipboardString(id->window, text.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user