Commit graph

49 commits

Author SHA1 Message Date
alexei-zebra
b6f6235249
Fix the issues found while reviewing the build files
Install the Wayland development packages in both workflows and bundle the
runtime libraries in the AppImage: the release build had no native Wayland
backend at all, and the engine silently fell back to GLFW there.

Build the window backends on every platform that is not Windows and not
Apple, glob the wayland sources with CONFIGURE_DEPENDS, and report a
missing Wayland dependency with the list of what is missing.

Also drop the dead nested project() calls and the duplicate -no-pie
option, make .dirIcon the file appimagetool expects, and describe the
real Linux dependencies in the README.
2026-10-11 20:06:19 +03:00
alexei-zebra
b9a13c853d
Give the window backends the engine include surface
VoxelWindowBase only got the src include directory, so BaseInput.cpp could
not find glm/vec2.hpp through window/input.hpp on macOS, where glm lives in
a prefix outside the default include path. VoxelGLFW had glm linked, which
hid the problem on Linux, where glm sits in /usr/include anyway.

The backends now link a single interface target carrying the engine sources
and the third-party headers their public headers pull in, instead of each
backend keeping its own list.
2026-10-10 14:20:33 +03:00
alexei-zebra
aac0bfa44a
Build the window backends as separate libraries
VoxelGLFW, VoxelWindowBase (the input state both backends share) and
VoxelWayland own their sources, dependencies and protocol generation,
while VoxelCoreSrc only sees the Window/Input interfaces and the
factories declared in detail/WindowBackends.hpp.

VOXELCORE_WAYLAND now only selects the subdirectory to add and the
library to link, and the wayland library defines the macro for whoever
links it, so linking the backend is what enables it. The protocol sources
are generated inside build/src/window/wayland, and missing dependencies
only turn the backend off instead of breaking the configuration.
2026-10-10 14:15:40 +03:00
alexei-zebra
714567a06e
fix names 2026-10-10 12:34:52 +03:00
alexei-zebra
b5416d1219
Fix the issues found while reviewing the Wayland frame work
A review of the branch turned up a number of defects, gaps and leftovers;
this commit addresses all of them.

Defects:
- the shadow uniform array held seven entries while eight locations were
  written, so the last one landed outside the object;
- CursorShape::LAST stayed in the middle of the enum after the new corner
  shapes were appended, which made the GLFW cursor table read out of
  bounds; the extra shapes are now mapped onto the ones GLFW knows, and
  the table is only filled for those;
- GlStateGuard asked glIsEnabled for an attribute pname, so it always got
  GL_INVALID_ENUM and never restored the vertex attribute arrays;
- the early returns in wayland_window_initialize left the global window
  and input pointers dangling when falling back to GLFW;
- the icon textures were listed nowhere, so none of them ever loaded;
- a shader failure disabled the shadow after the surface had already been
  sized for it, and VOXEL_DECORATIONS outlived the switch cleanup.

Behavior:
- the keyboard now releases every pressed key when it loses focus, and a
  repeat rate of zero means no repeat;
- the fourth UTF-8 lead byte is decoded with the right mask, control
  characters no longer reach text fields, and a vanished clipboard offer
  clears the cached text;
- compositor side decorations disable ours again instead of leaving two
  titles, the window destructor releases the rest of the state, and the
  content inset is computed before the GUI acts so the HUD and the
  container never disagree for a frame; the HUD clamps it;
- the window controls fall back to minimize, maximize and close, and the
  icons are drawn from textures only.

Cleanups: one monotonic timer instead of three, one vertex shader shared
by both renderers with a link check, one button layout parser, the inset
rule moved into Screen, the scissor stack moved into the base Window
(about 110 duplicated lines), named shadow and evdev constants, trimmed
includes, a README note about the Wayland dependencies, and the long
lines introduced by this branch wrapped.
2026-10-10 12:23:42 +03:00
alexei-zebra
6c2192b5d8
Draw the window title bar by the engine
The native Wayland backend had no window controls: no title, no close
button, no way to move or resize the window, and the fullscreen toggle
could throw the window to another monitor. GNOME does not implement
zxdg_decoration_manager_v1, so there is nobody to draw a frame for us:
the backend now falls back to its own decorations when the compositor
offers no server side ones, and the engine draws the visible part.

The bar itself is drawn by the engine (WindowBar.cpp) through the usual
batch and font, so it uses the same assets as the rest of the UI and the
backend only owns the behaviour: hit zones, cursor shapes, click
interception and the xdg-shell requests. Its geometry follows the
desktop's button layout, read and subscribed through
xdg-desktop-portal over sd-bus (libsystemd is an optional dependency,
gsettings is only a startup fallback).

Controls behave like they do elsewhere:
- pressing anywhere on the bar starts a move once the pointer leaves a
  5 px radius, so dragging works from the buttons as well;
- a button acts on release, only if the pointer stayed on it;
- a double click on the bar toggles maximize;
- the top edge and the top corners resize, the top 8 px of the sides,
  the sides and the bottom are 8 px wide resize strips;
- right and middle clicks and the scroll wheel over the bar never reach
  the game.

The in-game user interface is offset below the bar while menus keep the
whole window, so the translucent bar shows the menu background through
itself and never covers the HUD. The HUD lays its elements out against
the content height and the cursor is translated once, which fixes items
following the mouse one row above the pointer in game.

The window size is now written to the settings when the window is
resized in windowed mode and applied on the first configure, so the
window opens with the size it was left with, and leaving fullscreen or
borderless mode restores it instead of overwriting the settings with the
fullscreen size (an unconditional unmaximize made the compositor restore
the maximized geometry).

Measured: menu layout unchanged (706 bright pixels in the same place),
gui viewport 1123x751 in menus against 1123x721 in game, 1123x751 ->
2560x1080 -> 1123x751 round trip keeps the settings, a saved 1000x640
opens as 1000x640, no errors in the log.
2026-10-10 12:23:41 +03:00
alexei-zebra
14fa7e5fd2
fix building without the Wayland backend
The backend sources live in window/wayland and were picked up by the
global source glob, so a build with VOXELENGINE_WAYLAND=OFF (and any
non-Linux build, where the option is skipped entirely) tried to compile
them and failed on the generated protocol headers.

They are now collected separately and added to the target only when the
backend is enabled.

Also restores the CRLF line endings of Engine.cpp, GUI.hpp and
input.cpp, which were rewritten with LF and made their diffs look like
whole-file rewrites.
2026-10-10 12:23:31 +03:00
alexei-zebra
1e689e88b1
add native Wayland window backend
Wayland support was missing a proper windowing layer: the GLFW backend
leaves the known platform gaps (cursor themes, window icon, window
position, fullscreen output selection).

The new backend talks to the compositor directly:
- xdg-shell, EGL, xkbcommon (keyboard, repeat, layout) instead of GLFW;
- cursors through wp_cursor_shape_manager_v1, so no cursor theme lookup
  is required and no "standard cursor shape unavailable" errors appear;
- window icon and title are drawn by the engine itself, since Wayland
  has no window icon protocol and GNOME provides no server-side
  decorations;
- fullscreen requests the current output (set_fullscreen with NULL), so
  the window no longer jumps to another monitor;
- interactive resize presents a cached frame scaled to the new size
  while the pointer is down and refreshes the real frame when the drag
  pauses, keeping the window glued to the cursor.

libdecor is not used: libdecor_frame_commit() redraws the whole
decoration and acks the configure in the same call, and mutter sends
200-330 configures per second during an interactive resize, so the
decoration was redrawn hundreds of times per second (measured: 2 s of
work per second, loop stalls up to 6 s). The decorations are drawn by
the engine instead, which measured 2.3 ms average configure-to-present
latency during a real drag.

GLFW stays the backend for X11 and Windows; VOXEL_WINDOW_BACKEND=x11
forces it on Wayland sessions.
2026-10-10 12:23:18 +03:00
MihailRis
8962042627 complete the rename of voxelengine to voxelcore 2026-10-10 10:54:36 +03:00
nogitsune-youkai
d062c28376
Fix: correct luajit lookup on Windows (#1006)
* Fix: correct luajit paths

* fixed comment

* removed unnecessary comments
2026-10-02 17:23:49 +03:00
dagger
a23c4d4159 add crypto library 2026-08-22 15:22:55 +07:00
NigthLier
68f4c3c55e Added Clion build section 2026-05-05 12:58:11 +03:00
MihailRis
b1356ca561 add freetype library 2026-02-13 13:14:13 +03:00
MihailRis
9653b18143 fix: unknown warning option in clang build 2025-11-17 20:18:02 +03:00
MihailRis
48b8c3e9b4 fix 2025-10-10 23:22:47 +03:00
MihailRis
24931770d3
fix warnings (#648)
* fix unknown command line argument

* fix warnings settings for gcc

* fix -Wzero-as-null-pointer-constant

* revert CMakeLists.txt
2025-10-10 23:12:01 +03:00
MihailRis
8f3e5e880c
temporary disable -Wsign-conversion 2025-10-10 14:32:07 +03:00
MihailRis
8e52ad4e3b
enable more clang/gcc warnings 2025-10-10 13:58:29 +03:00
MihailRis
31f3c2de6a
disable msvc warning C4457 2025-10-10 13:50:50 +03:00
MihailRis
c6c08e1efb
add -Wpedantic 2025-10-10 13:31:36 +03:00
MihailRis
b55879116f
disable msvc warning C4459 2025-10-10 13:20:18 +03:00
MihailRis
5bdf8f8065 remove -Og flag from debug build 2025-04-20 00:14:42 +03:00
MihailRis
3d22de761f fix compiler warnings (GCC + Clang) 2025-03-20 22:04:29 +03:00
Ygrik2003
6c3d2d0907
Merge pull request #435 from Ygrik2003/Refactoring-cmake
Refactoring cmake
2025-03-20 20:59:19 +03:00
Stepanov Igor
bb15d17892 add cmake-format.py and formating all cmake files 2025-01-09 16:32:54 +03:00
MihailRis
d73c0b21f5 fix cmake in linux 2024-12-27 07:00:30 +03:00
Stepanov Igor
59933943b8 Add comment 2024-12-25 18:23:02 +03:00
Stepanov Igor
c18c210fe0 Return old behavior 2024-12-25 18:21:46 +03:00
Stepanov Igor
398206653b Try Fix 2024-12-25 17:47:18 +03:00
Stepanov Igor
17460be026 Fix builds 2024-12-25 03:07:14 +03:00
Stepanov Igor
e7d36ef4f5 Fix static compilation 2024-12-25 02:43:59 +03:00
Stepanov Igor
5eab58fcc5 Fix comment 2024-12-22 03:39:20 +03:00
Stepanov Igor
d6997640b6 Refactoring and try move to pwsh for clang 2024-12-22 03:24:11 +03:00
Stepanov Igor
b458df42de Fik lib luajit 2024-12-22 03:06:58 +03:00
Stepanov Igor
e34a7bb117 Fik lib ext for clang 2024-12-22 02:00:43 +03:00
Stepanov Igor
d0e8f43f14 Fix lua linking 2024-12-22 01:37:58 +03:00
Stepanov Igor
84887d26ec Refactoring CmakePresets for windows github actions and refactoring README 2024-12-20 17:16:31 +03:00
Stepanov Igor
7547152ab2 Fix resources linking 2024-12-15 02:17:27 +03:00
Stepanov Igor
dccda99364 Fix usage vcpkg for windows and fix readme, remove vcpkg usage flag from cmake 2024-12-15 01:56:02 +03:00
MihailRis
12c10d1ad1
Add Windows build with Clang (#411)
after 72 commits and 24 hours
2024-12-14 03:09:25 +03:00
MihailRis
27acc1d8b1 rename voxel_engine.cpp to main.cpp 2024-12-07 00:12:42 +03:00
MihailRis
cb925d005c add libcurl 2024-11-10 22:37:28 +03:00
MihailRis
d0dbe549a1 remove libspng mentions from Windows build 2024-10-21 13:58:54 +03:00
MihailRis
6e07ea1a44 update CMakeLists.txt 2024-10-21 13:52:59 +03:00
MihailRis
659f1fedc8 fix src/CMakeLists.txt for Windows 2024-08-12 01:13:26 +03:00
MihailRis
29b1299b87 update src/CMakeLists.txt 2024-08-12 01:07:18 +03:00
MihailRis
59afd4de27 update src/CMakeLists.txt 2024-08-12 00:59:51 +03:00
MihailRis
d021240a32 fix lua include directory 2024-08-12 00:39:36 +03:00
MihailRis
2b30ab966b add test and src subdirectories 2024-08-12 00:35:23 +03:00