Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
26114b9
First iteration. Window create successfull
Oct 4, 2025
f62bd09
Unimpl gl
Oct 4, 2025
9dad262
Merge remote-tracking branch 'origin/main' into sdl-try-2
Oct 4, 2025
2293f6f
refactoring
Oct 4, 2025
433a2ea
Fix mouse pos detect
Oct 4, 2025
51927ee
Mouse work
Oct 5, 2025
6a73359
Mouse move work
Oct 5, 2025
8256230
half keyboard is work
Oct 5, 2025
5e19c68
final, but buuugs
Oct 5, 2025
bca7421
ci/cd update
Oct 5, 2025
dc84201
Test manual build sdl for ubuntu
Oct 5, 2025
e4d8a34
refactor and speedup builds
Oct 5, 2025
5b3733d
use only 4 threads for build
Oct 5, 2025
43899d0
Final ci/cd fix
Oct 5, 2025
3843226
Final ci/cd fix
Oct 5, 2025
706fe0c
fix bug with keycodes
Oct 6, 2025
fddf810
Small refactoring and restore Scissors logic. Render not work with en…
Oct 7, 2025
f631382
some refactoring, add props and fix scissors
Oct 7, 2025
13ae4ed
fix scroll
Oct 7, 2025
f8302a4
fix typo
Oct 7, 2025
d896d2d
fix some warns and errors
Oct 7, 2025
5906421
restore screenshot logic
Oct 7, 2025
ad5834b
fix utf8 input
Oct 10, 2025
640cfcc
Merge branch 'sdl-try-2' of github.com:Ygrik2003/VoxelEngine-Cpp into…
Oct 10, 2025
4e97923
fix cursors
Oct 10, 2025
9f9978f
fix focus problem
Oct 10, 2025
1edb13b
Merge branch 'main' into sdl-try-2
Oct 10, 2025
71ab542
undo focus changes
Oct 10, 2025
3e48768
we not use sdl audio
Oct 10, 2025
73f64c8
Rename class
Oct 10, 2025
a7a64f0
Rename files
Oct 10, 2025
685fbf6
Rename class
Oct 10, 2025
968d012
Resave without format
Oct 10, 2025
726f004
add switching text edit state
Oct 11, 2025
dfd0100
Use textInput state only for TextBox
Oct 11, 2025
18d8c9c
clean
Oct 11, 2025
378f588
reset cmake min version changes
Ygrik2003 Oct 14, 2025
7a9587b
Update flake.lock
VOXEL0798 Oct 14, 2025
faaa746
Merge pull request #2 from VOXEL0798/patch-1
Ygrik2003 Oct 15, 2025
52db37a
Try fix ubuntu mouse grabbing
Oct 15, 2025
0c121f7
Merge branch 'MihailRis:main' into sdl-try-2
Ygrik2003 Oct 15, 2025
8481c5c
fix sdl build in cicd
Oct 17, 2025
8cd75ad
Merge remote-tracking branch 'mih/dev' into sdl-try-2
Oct 17, 2025
62ab514
fix after merge
Oct 17, 2025
686a20c
fix after merge
Oct 17, 2025
14829f8
fix fps settings
Oct 17, 2025
9e4b1c9
fix window mode
Oct 17, 2025
71ec061
Merge pull request #642 from Ygrik2003/sdl-try-2
MihailRis Nov 12, 2025
7f7533f
Merge branch 'main' into continue-sdl-support-implementation
MihailRis Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libglfw3-dev libglfw3 libglew-dev libglew2.2 \
sudo apt-get install -y build-essential libglew-dev libglew2.2 \
libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev \
libcurl4-openssl-dev libgtest-dev cmake squashfs-tools valgrind
# dependency for building sdl
# https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md
sudo apt-get install -y build-essential git make \
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
libaudio-dev libfribidi-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev \
libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev
# fix luajit paths
sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
Expand All @@ -35,10 +44,17 @@ jobs:
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DENTT_INSTALL=on ..
sudo make install
cd ../..
# install SDL3
git clone https://github.com/libsdl-org/SDL.git
cd SDL
cmake -G "Ninja Multi-Config" -B.build .
cmake --build .build --config Release -j 4
sudo cmake --install .build --config Release
cd ..
- name: Configure
run: cmake -S . -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON
- name: Build
run: cmake --build build -t install
run: cmake --build build -t install -j 4
- name: Run tests
run: ctest --test-dir build
- name: Run engine tests
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ jobs:
# make && make install INSTALL_INC=/usr/include/lua
run: |
sudo apt-get update
sudo apt-get install libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libgtest-dev libcurl4-openssl-dev
sudo apt-get install libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libgtest-dev libcurl4-openssl-dev
# dependency for building sdl
# https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md
sudo apt-get install -y build-essential git make \
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
libaudio-dev libfribidi-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev
# fix luajit paths
sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua-5.1.a
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
Expand All @@ -49,6 +57,13 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Release -DENTT_INSTALL=on ..
sudo make install
cd ../..
# install SDL3
git clone https://github.com/libsdl-org/SDL.git
cd SDL
cmake -G "Ninja Multi-Config" -B.build .
cmake --build .build --config Release -j 4
sudo cmake --install .build --config Release
cd ..

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only
Expand All @@ -61,7 +76,7 @@ jobs:
- name: Build
# Build your program with the given configuration
run: |
cmake --build ${{github.workspace}}/build --config ${{inputs.build_type}}
cmake --build ${{github.workspace}}/build --config ${{inputs.build_type}} -j 4
mv ${{github.workspace}}/build/VoxelEngine VoxelEngine
- name: Run tests
if: ${{ inputs.run_tests }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:

- name: Install dependencies from brew
run: |
brew install glfw3 glew libpng openal-soft luajit libvorbis skypjack/entt/entt googletest glm
brew install sdl3 glew libpng openal-soft luajit libvorbis skypjack/entt/entt googletest glm

- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_APPDIR=1

- name: Build
run: cmake --build build -t install
run: cmake --build build -t install -j 4

- name: Make fix_dylibs.sh executable
run: chmod +x dev/fix_dylibs.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
mkdir build
cd build
cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake ..
cmake --build . --config Release
cmake --build . --config Release -j 4
- name: Package for Windows
run: |
mkdir packaged
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
run: |
cmake --preset default-vs-msvc-windows
cmake --build --preset default-vs-msvc-windows --config Release
cmake --build --preset default-vs-msvc-windows --config Release -j 4
- name: Run tests
run: ctest --preset default-vs-msvc-windows
- name: Run engine tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Debug/voxel_engine
/export
/config
/out
/compile_commands.json
/projects

/misc
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
xauth \
gdb \
gdbserver \
libglfw3-dev \
libglfw3 \
libsdl3-dev \
libglew-dev \
libglew2.2 \
libglm-dev \
Expand Down
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,19 @@ sudo make install

```sh
su -
apt-get install entt-devel libglfw3-devel libGLEW-devel libglm-devel libpng-devel libvorbis-devel libopenal-devel libluajit-devel libstdc++13-devel-static libcurl-devel
apt-get install entt-devel SDL3-devel libGLEW-devel libglm-devel libpng-devel libvorbis-devel libopenal-devel libluajit-devel libstdc++13-devel-static libcurl-devel
```

#### Debian based distros

```sh
sudo apt install libglfw3 libglfw3-dev libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libcurl4-openssl-dev
sudo apt install libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libcurl4-openssl-dev
```

> [!WARNING]
> You need manualy prebuild and install SDL3 lib.


> [!TIP]
> CMake missing `LUA_INCLUDE_DIR` and `LUA_LIBRARIES` fix:
>
Expand All @@ -48,21 +52,12 @@ sudo apt install libglfw3 libglfw3-dev libglew-dev libglm-dev libpng-dev libopen
#### RHEL based distros

```sh
sudo dnf install glfw-devel glew-devel glm-devel libpng-devel libvorbis-devel openal-soft-devel luajit-devel libcurl-devel
sudo dnf install SDL3-devel glew-devel glm-devel libpng-devel libvorbis-devel openal-soft-devel luajit-devel libcurl-devel
```

#### Arch based distros

If you use X11:

```sh
sudo pacman -S glfw-x11 glew glm libpng libvorbis openal luajit libcurl
```

If you use Wayland:

```sh
sudo pacman -S glfw-wayland glew glm libpng libvorbis openal luajit libcurl
sudo pacman -S sdl3 glew glm libpng libvorbis openal luajit libcurl
```

And install EnTT:
Expand Down Expand Up @@ -92,7 +87,7 @@ cmake --build . --parallel
### Install libraries

```sh
brew install glfw3 glew glm libpng libvorbis lua luajit libcurl openal-soft skypjack/entt/entt
brew install sdl3 glew glm libpng libvorbis lua luajit libcurl openal-soft skypjack/entt/entt
```

> [!TIP]
Expand Down
1 change: 0 additions & 1 deletion dev/AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ AppDir:
- libexpat1
- libfam0
- libgcrypt20
- libglfw3
- libglew2.2
- libpng16-16
- libopenal1
Expand Down
7 changes: 4 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

buildInputs = with pkgs; [
glm
glfw
sdl3
glew
zlib
libpng
Expand All @@ -42,7 +42,7 @@
]; # libglvnd

packages = with pkgs; [
glfw
sdl3
mesa
freeglut
entt
Expand Down
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(VoxelEngineSrc)

file(GLOB_RECURSE headers ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
file(GLOB_RECURSE headers CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
file(GLOB_RECURSE sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)

add_library(VoxelEngineSrc STATIC ${sources} ${headers})
Expand All @@ -18,7 +18,7 @@ endif()
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
find_package(CURL REQUIRED)
find_package(glfw3 REQUIRED)
find_package(SDL3 REQUIRED)
if(NOT APPLE)
find_package(EnTT REQUIRED)
endif()
Expand Down Expand Up @@ -65,7 +65,7 @@ target_include_directories(VoxelEngineSrc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(
VoxelEngineSrc
PRIVATE glfw
PRIVATE SDL3::SDL3
OpenGL::GL
GLEW::GLEW
ZLIB::ZLIB
Expand Down
9 changes: 0 additions & 9 deletions src/graphics/core/Shader.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
#include "Shader.hpp"

#include <exception>
#include <fstream>
#include <sstream>
#include <filesystem>

#include <glm/gtc/type_ptr.hpp>

#include <GL/glew.h>
#include <GLFW/glfw3.h>

#include "coders/GLSLExtension.hpp"
#include "debug/Logger.hpp"

static debug::Logger logger("gl-shader");

namespace fs = std::filesystem;

GLSLExtension* Shader::preprocessor = new GLSLExtension();
Shader* Shader::used = nullptr;

Expand Down
2 changes: 1 addition & 1 deletion src/graphics/ui/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void GUI::actMouse(float delta, const CursorState& cursor) {
}

if (hover) {
for (Mousecode code : MOUSECODES_ALL) {
for (Mousecode code : mousecodes_all) {
if (input.jclicked(code)) {
hover->clicked(code);
}
Expand Down
7 changes: 7 additions & 0 deletions src/graphics/ui/elements/TextBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,15 @@ bool TextBox::isAutoResize() const {
return autoresize;
}

void TextBox::defocus() {
Container::defocus();
gui.getInput().stopTextInput();
}


void TextBox::onFocus() {
Container::onFocus();
gui.getInput().startTextInput();
if (onEditStart) {
setCaret(input.size());
onEditStart();
Expand Down
1 change: 1 addition & 0 deletions src/graphics/ui/elements/TextBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ namespace gui {
virtual bool isShowLineNumbers() const;

virtual void reposition() override;
virtual void defocus() override;
virtual void onFocus() override;
virtual void refresh() override;
virtual void doubleClick(int x, int y) override;
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/ui/elements/UINode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ namespace gui {
virtual void listenFocus(OnAction action);
virtual void listenDefocus(OnAction action);

virtual void defocus();
virtual void onFocus();
virtual void doubleClick(int x, int y);
virtual void click(int x, int y);
Expand All @@ -228,7 +229,6 @@ namespace gui {
virtual void scrolled(int value);

bool isPressed() const;
void defocus();
bool isFocused() const;

/// @brief Check if element catches all user input when focused
Expand Down
22 changes: 10 additions & 12 deletions src/window/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
#include <memory>

#include "graphics/core/commons.hpp"
#include "typedefs.hpp"

class ImageData;
class Input;
struct DisplaySettings;

enum class WindowMode {
WINDOWED,
FULLSCREEN,
BORDERLESS
};
enum class WindowMode { WINDOWED, FULLSCREEN, BORDERLESS };

class Window {
public:
Expand All @@ -23,7 +18,7 @@ class Window {
Window(glm::ivec2 size) : size(std::move(size)) {}

virtual ~Window() = default;
virtual void swapBuffers() = 0;
virtual void swapBuffers() noexcept = 0;

virtual bool isMaximized() const = 0;
virtual bool isFocused() const = 0;
Expand Down Expand Up @@ -55,14 +50,17 @@ class Window {
// todo: move somewhere
virtual std::unique_ptr<ImageData> takeScreenshot() = 0;

const glm::ivec2& getSize() const {
[[nodiscard]] virtual bool isValid() const = 0;

virtual const glm::ivec2& getSize() const {
return size;
}
virtual void setSize(const glm::ivec2& s) {
size = std::move(s);
}

static std::tuple<
std::unique_ptr<Window>,
std::unique_ptr<Input>
> initialize(DisplaySettings* settings, std::string title);
static std::tuple<std::unique_ptr<Window>, std::unique_ptr<Input>>
initialize(DisplaySettings* settings, std::string title);
protected:
glm::ivec2 size;
WindowMode mode = WindowMode::WINDOWED;
Expand Down
Loading
Loading