mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-27 06:07:14 +01:00
Updated frt2 to the latest. https://github.com/efornara/frt/commits/2.0
This commit is contained in:
parent
e35409a37f
commit
2f68443761
@ -1,6 +1,14 @@
|
|||||||
Release Notes
|
Release Notes
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
# FRT 2.0.1
|
||||||
|
|
||||||
|
- Fixes for Godot 3.5
|
||||||
|
- Better SDL2 error messages
|
||||||
|
- Use Soft Fullscreen
|
||||||
|
- VSync
|
||||||
|
- Icon
|
||||||
|
|
||||||
## FRT 2.0.0
|
## FRT 2.0.0
|
||||||
|
|
||||||
A rewrite of FRT that uses SDL2 instead of custom modules.
|
A rewrite of FRT that uses SDL2 instead of custom modules.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
SPDX-License-Identifier: MIT
|
SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FRT_VERSION "2.0.0"
|
#define FRT_VERSION "2.0.1"
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
#define FRT_OVERRIDE override
|
#define FRT_OVERRIDE override
|
||||||
|
@ -301,6 +301,14 @@ public: // OS
|
|||||||
void _set_use_vsync(bool enable) FRT_OVERRIDE {
|
void _set_use_vsync(bool enable) FRT_OVERRIDE {
|
||||||
os_.set_use_vsync(enable);
|
os_.set_use_vsync(enable);
|
||||||
}
|
}
|
||||||
|
void set_icon(const Ref<Image> &icon) FRT_OVERRIDE {
|
||||||
|
if (icon.is_null())
|
||||||
|
return;
|
||||||
|
Ref<Image> i = icon->duplicate();
|
||||||
|
i->convert(Image::FORMAT_RGBA8);
|
||||||
|
PoolVector<uint8_t>::Read r = i->get_data().read();
|
||||||
|
os_.set_icon(i->get_width(), i->get_height(), r.ptr());
|
||||||
|
}
|
||||||
public: // EventHandler
|
public: // EventHandler
|
||||||
void handle_resize_event(ivec2 size) FRT_OVERRIDE {
|
void handle_resize_event(ivec2 size) FRT_OVERRIDE {
|
||||||
video_mode_.width = size.x;
|
video_mode_.width = size.x;
|
||||||
@ -376,6 +384,9 @@ public: // EventHandler
|
|||||||
void handle_quit_event() FRT_OVERRIDE {
|
void handle_quit_event() FRT_OVERRIDE {
|
||||||
quit_ = true;
|
quit_ = true;
|
||||||
}
|
}
|
||||||
|
void handle_flush_events() FRT_OVERRIDE {
|
||||||
|
input_->flush_buffered_events();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace frt
|
} // namespace frt
|
||||||
|
@ -12,7 +12,7 @@ if [ $# -ge 2 -a "$1" = '-t' ] ; then
|
|||||||
tag=$2
|
tag=$2
|
||||||
shift 2
|
shift 2
|
||||||
else
|
else
|
||||||
tag=343
|
tag=350
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_216_98() {
|
build_216_98() {
|
||||||
|
@ -143,6 +143,7 @@ struct EventHandler {
|
|||||||
virtual void handle_js_axis_event(int id, int axis, float value) = 0;
|
virtual void handle_js_axis_event(int id, int axis, float value) = 0;
|
||||||
virtual void handle_js_hat_event(int id, int mask) = 0;
|
virtual void handle_js_hat_event(int id, int mask) = 0;
|
||||||
virtual void handle_quit_event() = 0;
|
virtual void handle_quit_event() = 0;
|
||||||
|
virtual void handle_flush_events() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
EventHandler::~EventHandler() {
|
EventHandler::~EventHandler() {
|
||||||
@ -339,7 +340,7 @@ public:
|
|||||||
void init(GraphicsAPI api, int width, int height, bool resizable, bool borderless, bool always_on_top) {
|
void init(GraphicsAPI api, int width, int height, bool resizable, bool borderless, bool always_on_top) {
|
||||||
setenv("SDL_VIDEO_RPI_OPTIONS", "gravity=center,scale=letterbox,background=1", 0);
|
setenv("SDL_VIDEO_RPI_OPTIONS", "gravity=center,scale=letterbox,background=1", 0);
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
|
||||||
fatal("SDL_Init failed.");
|
fatal("SDL_Init failed: %s.", SDL_GetError());
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, api == API_OpenGL_ES2 ? 2 : 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, api == API_OpenGL_ES2 ? 2 : 3);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||||
@ -352,7 +353,7 @@ public:
|
|||||||
if (always_on_top)
|
if (always_on_top)
|
||||||
flags |= SDL_WINDOW_ALWAYS_ON_TOP;
|
flags |= SDL_WINDOW_ALWAYS_ON_TOP;
|
||||||
if (!(window_ = SDL_CreateWindow("frt2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags)))
|
if (!(window_ = SDL_CreateWindow("frt2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags)))
|
||||||
fatal("SDL_CreateWindow failed.");
|
fatal("SDL_CreateWindow failed: %s.", SDL_GetError());
|
||||||
context_ = SDL_GL_CreateContext(window_);
|
context_ = SDL_GL_CreateContext(window_);
|
||||||
SDL_GL_MakeCurrent(window_, context_);
|
SDL_GL_MakeCurrent(window_, context_);
|
||||||
}
|
}
|
||||||
@ -409,6 +410,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
handler_->handle_flush_events();
|
||||||
}
|
}
|
||||||
const InputModifierState *get_modifier_state() const {
|
const InputModifierState *get_modifier_state() const {
|
||||||
return &st_;
|
return &st_;
|
||||||
@ -416,6 +418,16 @@ public:
|
|||||||
void set_title(const char *title) {
|
void set_title(const char *title) {
|
||||||
SDL_SetWindowTitle(window_, title);
|
SDL_SetWindowTitle(window_, title);
|
||||||
}
|
}
|
||||||
|
void set_icon(int width, int height, const unsigned char *data) {
|
||||||
|
SDL_Surface *icon = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_ABGR8888);
|
||||||
|
if (!icon)
|
||||||
|
return;
|
||||||
|
SDL_LockSurface(icon);
|
||||||
|
memcpy(icon->pixels, data, width * height * 4);
|
||||||
|
SDL_UnlockSurface(icon);
|
||||||
|
SDL_SetWindowIcon(window_, icon);
|
||||||
|
SDL_FreeSurface(icon);
|
||||||
|
}
|
||||||
void set_pos(ivec2 pos) {
|
void set_pos(ivec2 pos) {
|
||||||
SDL_SetWindowPosition(window_, pos.x, pos.y);
|
SDL_SetWindowPosition(window_, pos.x, pos.y);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user