add app.focus function
This commit is contained in:
parent
6195d014cd
commit
c42d661223
@ -5,6 +5,7 @@
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "network/Network.hpp"
|
||||
#include "util/platform.hpp"
|
||||
#include "window/Window.hpp"
|
||||
|
||||
using namespace scripting;
|
||||
|
||||
@ -27,8 +28,14 @@ static int l_start_debug_instance(lua::State* L) {
|
||||
return lua::pushinteger(L, port);
|
||||
}
|
||||
|
||||
static int l_focus(lua::State* L) {
|
||||
engine->getWindow().focus();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg applib[] = {
|
||||
{"start_debug_instance", lua::wrap<l_start_debug_instance>},
|
||||
{"focus", lua::wrap<l_focus>},
|
||||
// for other functions see libcore.cpp and stdlib.lua
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
@ -36,6 +36,8 @@ public:
|
||||
virtual void setMode(WindowMode mode) = 0;
|
||||
virtual WindowMode getMode() const = 0;
|
||||
|
||||
virtual void focus() = 0;
|
||||
|
||||
virtual void setTitle(const std::string& title) = 0;
|
||||
virtual void setIcon(const ImageData* image) = 0;
|
||||
|
||||
|
||||
@ -468,6 +468,10 @@ public:
|
||||
return mode;
|
||||
}
|
||||
|
||||
void focus() override {
|
||||
glfwFocusWindow(window);
|
||||
}
|
||||
|
||||
void setTitle(const std::string& title) override {
|
||||
glfwSetWindowTitle(window, title.c_str());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user