Files
waylight/src/Tick.cpp

56 lines
1.0 KiB
C++
Raw Normal View History

#include "App.hpp"
#include <cassert>
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#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);
if (m_kbd.is_sym_pressed(XKB_KEY_Escape)) {
set_visible(!visible());
if (m_kbd.ctrl() && m_kbd.shift()) {
m_running = false;
}
}
BeginDrawing();
ClearBackground(theme().window.background);
{
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();
eglSwapBuffers(m_gl.edpy, m_gl.esurf);
m_kbd.typing.clear();
m_kbd.clear_transients();
}