2025-10-05 05:42:05 +03:00
|
|
|
#include "App.hpp"
|
|
|
|
|
|
|
|
|
|
#include <EGL/egl.h>
|
|
|
|
|
#include <GLES3/gl3.h>
|
|
|
|
|
#include <print>
|
|
|
|
|
#include <raylib.h>
|
|
|
|
|
#include <rlgl.h>
|
|
|
|
|
#include <xkbcommon/xkbcommon.h>
|
|
|
|
|
|
|
|
|
|
auto App::tick() -> void
|
|
|
|
|
{
|
|
|
|
|
if (!m_visible || m_gl.edpy == EGL_NO_DISPLAY
|
|
|
|
|
|| m_gl.esurf == EGL_NO_SURFACE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
glViewport(0, 0, m_win_w, m_win_h);
|
|
|
|
|
|
|
|
|
|
for (auto const cp : m_kbd.typing) {
|
|
|
|
|
std::println("Char typed: {} ({}) shift={} ctrl={}",
|
|
|
|
|
rune_to_string(cp), cp, m_kbd.shift() ? 'y' : 'n',
|
|
|
|
|
m_kbd.ctrl() ? 'y' : 'n');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_kbd.is_sym_pressed(XKB_KEY_Escape)) {
|
|
|
|
|
set_visible(!visible());
|
|
|
|
|
if (m_kbd.ctrl() && m_kbd.shift()) {
|
|
|
|
|
m_running = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BeginDrawing();
|
|
|
|
|
|
2025-10-07 04:32:14 +03:00
|
|
|
ClearBackground(theme().window.background);
|
2025-10-05 05:42:05 +03:00
|
|
|
|
|
|
|
|
DrawFPS(10, 10);
|
2025-10-05 07:27:12 +03:00
|
|
|
if (m_tr) {
|
|
|
|
|
Color const fg = theme().foreground;
|
|
|
|
|
Vector2 const pos { 40.0f, 60.0f };
|
2025-10-07 02:25:02 +03:00
|
|
|
auto text = std::string_view("Hello from Waylight! 日本人ですか?");
|
|
|
|
|
auto size = sin(GetTime()) * 12 + 32;
|
2025-10-05 07:27:12 +03:00
|
|
|
m_tr->draw_text(m_font, text, pos, size, fg);
|
|
|
|
|
}
|
2025-10-05 05:42:05 +03:00
|
|
|
|
|
|
|
|
EndDrawing();
|
|
|
|
|
|
|
|
|
|
eglSwapBuffers(m_gl.edpy, m_gl.esurf);
|
|
|
|
|
m_kbd.typing.clear();
|
|
|
|
|
m_kbd.clear_transients();
|
|
|
|
|
}
|