shengine pre-release
shengine by mrsinho
|
Be sure to have installed Python 3.9
or later in order to run the python script without errors. The script generates a CMake file relative to your application and a bash/shell command running CMake. For example, in case you need to generate a Makefiles or a Visual Studio solution for the application located at application/triangle
, do:
You can build your application as a single EXECUTABLE
, which is going to be linked with the engine libraries and embedded with the shEditor.c
source file. If you build your application as a SHARED
library, an executable target named sheditor
will be built. It must be located in the same directory of your shared target, which is going to be linked at runtime.
The additional argument "generator"
allows you to specify which build system to select, by choosing between the CMake generators:
Be careful when choosing the generator to replace the space character with a dash:
If you are running the command for a second time and you need to clear che CMakeCache.txt
file, use the optional argument CLEAN-CACHE
:
Go to the build directory and run cmake --build .
or the command you prefer for your generator of choice.
All build files are located at application-path/os/build
, while libraries and executables are all located at application-path/os/bin
.
The paths of your application source files are defined at source-files.txt
. The formatting is very easy: use the endline character to load a new source file.
The libs.txt
file allows you to add an external CMake file to your application's CMake file and link all the specified libraries. Even if you have no external libraries to link, you must have this file on your application's root directory.
If you want to know more about the smd
file format you can check the repository at mrsinho/smd
.
ini.smd
must be on the same directory of your executable file and it cannot be empty, it allows the engine to reach the application shared library, application.smd, host-memory.smd, scene.smd, serial.smd, vulkan-memory.smd;application.smd
is required to call the application functions when your project has been built as a SHARED
library;host-memory.smd
is useful to automatically allocate some heap memory on your RAM before running the p_start
function of your application (this file can be empty since it's not necessary);vulkan-memory.smd
is useful to automatically allocate some vulkan memory before running the p_start
function of your application (this file can be empty since it's not necessary);scene.smd
allows you to load components from collection/shcomponents/include
(this file can be empty since it loads optional features);serial.smd
is useful to load a serial port properties before actually opening a serial port, which is a developer's responsibility by implementing (for example) the cross-platform shserial
library.You can create your own smd filse and setup your own implementation for the file format. The smd library is already linked to the application.
Since this application renders a triangle on a window using a standard pipeline (for some reason the example is named triangle
), shaders and assets have to be stored somewhere. You're free to put them anywhere you want, what matters is to load them correctly from your application scripts see "Native scripting" on the Related pages
.
The triangle
application is a very good example which could be copied and pasted in order to setup a new project. You can also check the template-documented source code ./_native-scripting.md_ at the Related pages
.
Another good and documented example is the noise
application.
If your application has been built as a SHARED
library instead of an EXECUTABLE
, you can change the application name at ini.smd
in order to release the old shared library and load the newly specified application. For example, change:
to this:
If one of your application's functions returned with an error (non 1
value) or if you missed some information on your .smd
files, the engine will move to a safe mode. To free al resources and reload the engine press LEFT_ALT
+ R
to restart the program. You can restart the application at any time by pressing the same key sequence.