diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 42dfa76..d7f93f0 100755 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -23,7 +23,7 @@ jobs: curl -L -o butler.zip https://broth.itch.ovh/butler/windows-amd64/LATEST/archive/default 7z e butler.zip dir - .\butler.exe push bin bluerriq/symmetry:windows-prealpha + .\butler.exe push bin bluerriq/symmetry:windows-prealpha --userversion-file bin/version.txt diff --git a/README.md b/README.md index 1972ee2..8cf1f9f 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ![alt-text](screenshots/project_symmetry.jpg "Project Symmetry") + + ## About A simple first person shooter that may or may not have anything to do with the concept of symmetry. @@ -17,6 +19,8 @@ libraries: | [Nuklear](https://github.com/vurtun/nuklear) | In-game and editor UI | | [GLAD](https://github.com/dav1dde/glad-web) | OpenGL Extension Loading | +For more information visit the development blog at my website: [Link]("http://shariqshah.com/tags/project-symmetry/") + ## Building The game uses the [GENie](https://github.com/bkaradzic/GENie) build system. The game can be build by llowing steps: diff --git a/build/genie.lua b/build/genie.lua index ed9a161..ae94e77 100644 --- a/build/genie.lua +++ b/build/genie.lua @@ -55,6 +55,36 @@ solution "Symmetry" end } + newaction { + trigger = "generate_version_file", + description = "Generate version.h from git revision number", + execute = function() + local major_version = 0 + local minor_version = 1 + local revision_number = os.outputof("git rev-list --count HEAD") + local branch = os.outputof("git rev-parse --abbrev-ref HEAD") + + revision_number = revision_number:gsub("%s+", "") + branch = branch:gsub("%s+", "") + + print("Writing Version Number.....") + io.output("../../src/common/version.h") + io.write("#ifndef SYMMETRY_VERSION_FILE\n") + io.write("#define SYMMETRY_VERSION_FILE\n\n") + io.write("/* Auto generated version file. DO NOT MODIFY */\n") + io.write("#define SYMMETRY_VERSION_MAJOR " .. major_version .. "\n") + io.write("#define SYMMETRY_VERSION_MINOR " .. minor_version .. "\n") + io.write("#define SYMMETRY_VERSION_REVISION " .. revision_number .. "\n") + io.write("#define SYMMETRY_VERSION_BRANCH \"" .. branch .. "\"\n") + io.write("\n#endif") + io.close() + + io.output("version.txt") + io.write(major_version .. "." .. minor_version .. "." .. revision_number .. "-" .. branch) + io.close() + end + } + ------------------------- -- Game ------------------------- @@ -65,7 +95,12 @@ solution "Symmetry" files { "../src/common/**.c", "../src/common/**.h", "../src/system/**.c", "../src/system/**.h", "../src/game/**.h", "../src/game/**.c"} includedirs {"../include/common"} defines {"USE_GLAD"} - + + prebuildcommands + { + _PREMAKE_COMMAND .. ' generate_version_file' + } + configuration "linux" includedirs {"../include/linux/sdl2/", "../include/common/soloud/", "../include/linux/"} libdirs {"../lib/linux/sdl2/", "../lib/linux/soloud/", "../lib/linux/ode/"} @@ -99,6 +134,7 @@ solution "Symmetry" 'install_name_tool -change "/usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib" "@rpath/libSDL2-2.0.0.dylib" release/Symmetry', 'install_name_tool -change "/Users/shariqshah/Dev/ode/build_cmake/libode.0.16.0.dylib" "@rpath/libode.0.16.0.dylib" release/Symmetry', 'install_name_tool -change "/usr/local/lib/libsoloud.dylib" "@rpath/libsoloud.dylib" release/Symmetry', + 'cp version.txt release/' } configuration {"windows", "vs2019"} @@ -125,6 +161,7 @@ solution "Symmetry" "copy release\\SDL2.dll ..\\..\\bin\\ /Y", "copy release\\soloud_x64.dll ..\\..\\bin\\ /Y", "copy release\\ode_double.dll ..\\..\\bin\\ /Y", + "copy version.txt ..\\..\\bin\\ /Y", "rmdir release\\assets", "mklink /D release\\assets ..\\..\\..\\assets" } diff --git a/src/common/log.c b/src/common/log.c index b1033bc..b94dabc 100755 --- a/src/common/log.c +++ b/src/common/log.c @@ -4,6 +4,7 @@ #include #include "log.h" +#include "version.h" #ifdef __linux__ #define COLOURED_STDOUT @@ -54,6 +55,7 @@ void log_init(const char* log_file_name, const char* user_directory) time_t current_time; time(¤t_time); fprintf(log_file, "Log Initialized at %s\n", ctime(¤t_time)); + fprintf(log_file, "Version: %d.%d.%d-%s\n\n", SYMMETRY_VERSION_MAJOR, SYMMETRY_VERSION_MINOR, SYMMETRY_VERSION_REVISION, SYMMETRY_VERSION_BRANCH); fflush(log_file); } // Disable stdout buffering diff --git a/src/common/version.h b/src/common/version.h new file mode 100755 index 0000000..0d3d005 --- /dev/null +++ b/src/common/version.h @@ -0,0 +1,10 @@ +#ifndef SYMMETRY_VERSION_FILE +#define SYMMETRY_VERSION_FILE + +/* Auto generated version file. DO NOT MODIFY */ +#define SYMMETRY_VERSION_MAJOR 0 +#define SYMMETRY_VERSION_MINOR 1 +#define SYMMETRY_VERSION_REVISION 298 +#define SYMMETRY_VERSION_BRANCH "dev" + +#endif \ No newline at end of file diff --git a/src/game/game.c b/src/game/game.c index ea421ab..05f4794 100755 --- a/src/game/game.c +++ b/src/game/game.c @@ -358,7 +358,7 @@ void game_debug(float dt) if(input_is_key_pressed(KEY_PAGEUP)) { struct Entity* model = scene_find(game_state->scene, "Suzanne_Test_Parent"); - //vec3 y_axis = {0, 0, 1}; + vec3 y_axis = {0, 0, 1}; //transform_rotate(mod_tran, &y_axis, 25.f * dt, TS_LOCAL); vec3 amount = {0, 0, -5 * dt}; transform_translate(model, &amount, TS_LOCAL); diff --git a/todo.txt b/todo.txt index 884826b..1641c86 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,6 @@ Todo: + - Figure out the revision number and branching situation + - Add links to Itch.io builds of the game in readme and on the blog. Add link to blog in the readme as well - Save/Load base bounding boxes for entity types other than static mesh - Determine whether we should enable or disble picking when a tool is active within an editor ? Only show bounding box for hovered entity instead of wireframe mesh