-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
⚠ Warn:
Currently, no official version has been released yet. It is expected to be released early next year.
You can obtain the third-party library shared libraries through Github Release or Gitee Release pages.
To use this project, you need to install the following dependencies. You can install the dependency libraries in one go directly through the Github Release or Gitee Release page:
Optional dependencies: (p.s: Required for MacOS)
- FMT
- HowardHinnant Date (Not recommended for Windows)
You can clone this project from the Git repository and configure and compile the project using the corresponding build tool.
📝 Installation Requirements
Before performing this step, you need to install the following tools to facilitate subsequent installation operations:
And you also need to install the corresponding compiler according to the operating system you are using:
- MinGW (Windows)
- MSVC (Windows)
- GCC/G++ (Linux/MacOS)
- Clang (Linux/MacOS)
For specific installation instructions, please refer to the Compiler Installation Guide.
❗ Attention:
For development using IDEs (such as: Clion, Visual Studio, Xcode, etc.), you do not need to consider installing the compilers mentioned above. However, some IDEs (such as: Visual Studio Code) still require the installation of the above compilers and the installation or configuration of corresponding plugins to be usable. For details, please see: IDE Setup Guide.
ℹ️ Note: For Linux/MacOS systems, you can use the corresponding package manager for installation.
Under Linux system, you need to select the corresponding package manager according to the distribution version used. Usually, it may be:
aptdnfyumpacman;Under MacOS system, you can use other package managers such as Homebrew (
brew), MacPorts (port), etc.
-
Clone the project using Git
git clone https://github.com/CatIsNotFound/MyEngine
Or clone the project using the following URL:
git clone https://gitee.com/CatIsNotFound/MyEngine
If you need to install dependency libraries, execute the following command after cloning the project:
cd MyEngine git submodule update --init --remoteIf you only want to install one or two dependency libraries (such as the
fmtlibrary anddatelibrary), execute the following command in the terminal:cd MyEngine git submodule update --init --remote libs/fmt libs/dateIf you need to view all submodules of the project, execute the following command in the terminal:
git submodule
-
Configure the project using CMake
cd MyEngine mkdir build ; cd build cmake .. -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="/path/to/MyEngine" -DSDL3_LIB=/path/to/SDL3 -DSDL3_IMAGE_LIB=/path/to/SDL3_image -DSDL3_MIXER_LIB=/path/to/SDL3_mixer -DSDL3_TTF_LIB=/path/to/SDL3_ttf
❗ Note:
You need to replace the shared library paths for
CMAKE_INSTALL_PREFIX,SDL3_LIB,SDL3_IMAGE_LIB,SDL3_TTF_LIB, andSDL3_MIXER_LIB. -
Compile and install the project
cmake --build . --config install
-
Create a new
CMakeLists.txtfile and write the following content:cmake_minimum_required(VERSION 3.24) # Need to modify your project name. project(Demo) set(CMAKE_CXX_STANDARD 20) # Need to set these paths before cmake configuration. set(SDL3_LIB "/path/to/SDL3") set(SDL3_IMAGE_LIB "/path/to/SDL3_image") set(SDL3_TTF_LIB "/path/to/SDL3_ttf") set(SDL3_MIXER_LIB "/path/to/SDL3_mixer") set(MYENGINE_LIB "/path/to/MyEngine") set(CMAKE_INCLUDE_CURRENT_DIR ON) list(APPEND CMAKE_PREFIX_PATH ${SDL3_LIB}) list(APPEND CMAKE_PREFIX_PATH ${SDL3_IMAGE_LIB}) list(APPEND CMAKE_PREFIX_PATH ${SDL3_TTF_LIB}) list(APPEND CMAKE_PREFIX_PATH ${SDL3_MIXER_LIB}) list(APPEND CMAKE_PREFIX_PATH ${MYENGINE_LIB}) find_package(SDL3 REQUIRED) find_package(SDL3_image REQUIRED) find_package(SDL3_ttf REQUIRED) find_package(SDL3_mixer REQUIRED) find_package(MyEngine REQUIRED) add_executable(${PROJECT_NAME} main.cpp ) target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3 SDL3_image::SDL3_image SDL3_ttf::SDL3_ttf SDL3_mixer::SDL3_mixer MyEngine::MyEngine ) set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) # TODO: If the project requires resources, remove the following comment # add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD # COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/assets ${CMAKE_BINARY_DIR}/bin/assets # ) if (WIN32) set(POST_BUILD_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_directory ${SDL3_LIB}/bin ${CMAKE_BINARY_DIR}/bin COMMAND ${CMAKE_COMMAND} -E copy_directory ${SDL3_MIXER_LIB}/bin ${CMAKE_BINARY_DIR}/bin ) if (MINGW) list(APPEND POST_BUILD_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_directory ${SDL3_IMAGE_LIB}/x86_64-w64-mingw32/bin ${CMAKE_BINARY_DIR}/bin COMMAND ${CMAKE_COMMAND} -E copy_directory ${SDL3_TTF_LIB}/x86_64-w64-mingw32/bin ${CMAKE_BINARY_DIR}/bin ) else () list(APPEND POST_BUILD_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_directory ${SDL3_IMAGE_LIB}/bin ${CMAKE_BINARY_DIR}/bin COMMAND ${CMAKE_COMMAND} -E copy_directory ${SDL3_TTF_LIB}/bin ${CMAKE_BINARY_DIR}/bin ) endif() add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD ${POST_BUILD_COMMANDS} ) endif()
-
Edit the
main.cppfile:#include <MyEngine/MyEngine> using namespace MyEngine; int main() { Engine engine; auto win = new Window(&engine, "Hello world!"); win->installPaintEvent([](Renderer* r) { r->fillBackground(StdColor::DarkBlue); r->drawDebugText("Hello world!", {20, 20}, StdColor::White); }); win->show(); return engine.exec(); }
-
Test and run the entire project, for example using the command line:
cd /path/to/YourProject mkdir build ; cd build cmake .. cmake --build . ./YourProject
-
After executing the above commands, the following output information will be displayed in the terminal:
MyEngine v0.1.3-beta (Based on SDL 3.3.0) For more information, visit: https://github.com/CatIsNotFound/MyEngine https://gitee.com/CatIsNotFound/MyEngine === Application Info === ID: HelloWorld.app Name: Hello world Version: v1.0.0At the same time, a dark blue window will be displayed with "Hello world!" written in the upper left corner. If it displays normally, it means you have succeeded!
