If you want the SDL3 version got to SDL3 Template This template is built with git submodules, and CMake!
This template uses git submodules, if you do not git clone it and just use download from the web, you will have to place the content of SDL2 into the SDL folder in the folder External/SDL2 and the content of Tiny File Dialog (if you want to use it,) in AppTemplate/Submodules/tinyfd (or you can delete the files and folders relating to it and remove the references in the CMake files.)
You can Change the rendering backend without much effort, as time progresses I will make this process easier, but at the moment it can be done easily by changing the contents of src/main (the actual entry point of your program,) and the graphics-backend value in CMake (You can see the options in AppTemplate/CMakeLists.txt.)
This a template designed around the CMake build system, it includes Dear ImGui, Vulkan, SDL2, and Tiny File Dialog.
This project requires you to have the Vulkan SDK installed on your system, as well as an appropriate compiler and CMake for the actual build process. Below are links you may require:
On Windows the MinGW,
Visual Studio Compiler, or other appropriate compiler is
required for building.
On Linux based systems GCC or another appropriate compiler can be used.
On macOS when you install Xcode, you should have all you need to build it.
If you open the Folder SDL2-Vulkan-DearImGUI-Template
(the top level of this git repository), in your chosen platforms console/terminal
you can run the following commands to build the project
mkdir "build"
cd build
cmake ..
make
This template has made a few simple choices in order to show you how you can structure your project or add other git repositories to your project, but if you don't want any of them you just have to remove them, remove the reference to it in .gitsubmodules and alter the relevant CMake files from your project for example with Tiny File Dialog files you can remove it by deleting the following files in the project:
/AppTemplate/Submodules/tinyfd.cmake
/AppTemplate/Submodules/tinyfd/*
The line in the CMakeLists.txt file present in AppTemplate/Submodules/
which says include(${SUBMODULE_CMAKE}/tinyfd.cmake)
.
The files I wrote using them located at
/AppTemplate/src/fileDialog.h
/AppTemplate/src/fileDialog.cpp
Any reference to them in the main.h
and main.cpp
files.
Finally remove the following from /AppTemplate/CMakeLists.txt
located in the set_executable
command
src/fileDialog.cpp
src/fileDialog.h
${TINYFD_REQ}
You can also disable Vulkan and use only SDL2's renderer, if you choose by modifying your CMakeLists files, as this template is built for you to make use of so you can skip to learning SDL2, Dear ImGui, Vulkan, and/or whatever you want to add/remove into this template.
To add a new library, I recomend using the project layout I have set up and adding it as either a git submodule if
it can be built with CMake to the folder /External/
followed by the project/git repository name, if adding with git submodules
you can for example run (the command below shows how to add the SDL2 branch to your project, if you would rather use that*.)
git submodule add -b SDL2 https://github.com/libsdl-org/SDL.git External/SDL2
* - You will have to make several changes throughout the CMake build system, and the CMake Bundler scripts will not work without changes
If you want to integrate code directly into the main program you can instead use the /AppTemplate/Submodules/
directory as
opposed to External
in the above command.
Some External Libraries and git repositories, might not be built with CMake, in which case you can look at how the imgui.cmake,
and imgui
folder located in /AppTemplate/Submodules/
is integrated into the project to bring your wanted project in.
This Project is licensed under the MIT license, as such you are free to do anything allowed by the MIT license with this project.
-
This project uses the Dear ImGui GUI Framework. The MIT license is included in the folder
src/Submodules/imgui
. -
This project uses Vulkan. The license for which is available from them Vulkan Site.
-
This project uses SDL2. The Zlib license is included in the folder
external/SDL2
. -
This project uses the Tiny File Dialog Project. The zlib license is included in the source code files of
src/Submodules/tinyfd
.
If you appreciate it, give sugestions to make it better, drop a star, or tell a friend.