载入中...
搜索中...
未找到
Window.cpp
浏览该文件的文档.
1#include "window/Window.h"
2
3#include <simplesquirrel/simplesquirrel.hpp>
4
5#include "window/sdl/Window.h"
6
7namespace eve {
8
9namespace window {
10
12
13void Window::expose(ssq::Table& table) {
14 auto cls = table.addClass(name, Window::create, false);
15 expose(cls);
16
17 auto settings = table.addClass("WindowSettings", ssq::Class::Ctor<WindowSettings()>());
18 settings.addVar("width", &WindowSettings::width);
19 settings.addVar("height", &WindowSettings::height);
20 settings.addVar("centered", &WindowSettings::centered);
21}
22
23void Window::expose(ssq::Class& cls) {
24 cls.addFunc("getName", &Window::getName);
25 cls.addFunc("setSize", &Window::setSize);
26 cls.addFunc("getWidth", &Window::getWidth);
27 cls.addFunc("getHeight", &Window::getHeight);
28 cls.addFunc("hasFocus", &Window::hasFocus);
29 cls.addFunc("getPixelWidth", [](Window* self) { return self ? self->getPixelWidth() : 0; });
30 cls.addFunc("getPixelHeight", [](Window* self) { return self ? self->getPixelHeight() : 0; });
31 cls.addFunc("getDPIScale", [](Window* self) { return self ? static_cast<float>(self->getDPIScale()) : 1.0f; });
32
33 cls.addFunc("setWindowSettings", &Window::setWindowSettings);
34 cls.addFunc("getWindowSettings", &Window::getWindowSettings);
35 cls.addFunc("close", &Window::close);
36}
37
38} // namespace window
39} // namespace eve
HSQOBJECT cls
Definition ECS.cpp:21
std::string name
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:26
TerrainThermalSettings settings
virtual std::string getName() const =0
Returns the name.
Platform window interface (SDL implementation on desktop/mobile). Script: win <- eve....
Definition Window.h:47
virtual bool hasFocus() const =0
True when the window has keyboard focus.
virtual int getWidth() const =0
Current logical window width.
virtual bool setWindowSettings(WindowSettings settings)=0
Applies a full WindowSettings struct (recreates the window when needed).
virtual void close()=0
Closes and destroys the underlying window.
virtual WindowSettings getWindowSettings()=0
Returns the settings last applied to this window.
virtual int getHeight() const =0
Current logical window height.
virtual void setSize(int width, int height)=0
Requests a new logical window size.
SDL2 desktop/mobile implementation of eve::window::Window.
Definition Window.h:16
WidgetDesc window(std::string title, std::vector< WidgetDesc > children, std::string id)
Top-level window widget with a title bar.
Definition Widget.cpp:292
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
Display settings for window creation/resize. width/height == 0 selects the desktop display mode size.
Definition Window.h:18