33
src/Tick.cpp
33
src/Tick.cpp
@@ -1,26 +1,23 @@
|
||||
#include "App.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#include <print>
|
||||
#include <raylib.h>
|
||||
#include <rlgl.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
auto App::tick() -> void
|
||||
{
|
||||
static std::pmr::string text_input_data;
|
||||
|
||||
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()) {
|
||||
@@ -33,12 +30,22 @@ auto App::tick() -> void
|
||||
ClearBackground(theme().window.background);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
if (m_tr) {
|
||||
Color const fg = theme().foreground;
|
||||
Vector2 const pos { 40.0f, 60.0f };
|
||||
auto text = std::string_view("Hello from Waylight! 日本人ですか?");
|
||||
auto size = sin(GetTime()) * 12 + 32;
|
||||
m_tr->draw_text(m_font, text, pos, size, fg);
|
||||
{
|
||||
assert(m_gui);
|
||||
u32 rune { 0 };
|
||||
if (!m_kbd.typing.empty()) {
|
||||
rune = m_kbd.typing.back();
|
||||
m_kbd.typing.clear();
|
||||
}
|
||||
ImGuiGuard gui_scope(m_gui, rune, m_kbd.ctrl(), m_kbd.shift());
|
||||
|
||||
m_gui->text_input(1, text_input_data,
|
||||
{
|
||||
0,
|
||||
0,
|
||||
static_cast<float>(GetScreenWidth()),
|
||||
static_cast<float>(GetScreenHeight()),
|
||||
});
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
|
||||
Reference in New Issue
Block a user