diff --git a/.github/workflows/nob.yaml b/.github/workflows/nob.yaml index 5b981a8b..f6cce683 100644 --- a/.github/workflows/nob.yaml +++ b/.github/workflows/nob.yaml @@ -1,5 +1,7 @@ name: no-build build -on: [push, pull_request] +on: + push: + pull_request: jobs: macos: @@ -16,6 +18,18 @@ jobs: with: name: macos-build-folder path: build/ + - name: Package release + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: | + brew install imagemagick + ./nob dist + ditto -c -k --sequesterRsrc --keepParent build/Musializer.app musializer-macos.zip + - name: Upload release package + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + uses: actions/upload-artifact@v4 + with: + name: release-macos + path: musializer-macos.zip ubuntu: strategy: matrix: @@ -35,6 +49,15 @@ jobs: with: name: ubuntu-${{ matrix.cc }}-build-folder path: build/ + - name: Package release + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.cc == 'gcc' + run: ./nob dist + - name: Upload release package + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.cc == 'gcc' + uses: actions/upload-artifact@v4 + with: + name: release-linux + path: musializer-linux-x86_64.tar.gz windows: name: windows (${{ matrix.hotreload == true && 'hotreload' || '' }}) runs-on: windows-latest @@ -51,12 +74,12 @@ jobs: # https://github.com/actions/runner-images/issues/6205#issuecomment-1241573412 # https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#create-your-own-command-prompt-shortcut run: | - call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" + for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat" cl.exe /Fenob nob.c - name: Run nob shell: cmd run: | - call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" + for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat" nob.exe config ${{ matrix.hotreload == true && 'hotreload' || '' }} nob.exe - name: Upload build folder @@ -64,3 +87,40 @@ jobs: with: name: windows-${{ matrix.hotreload == true && 'hotreload' || '' }}-build-folder path: build/ + # `nob dist` is not implemented for the MSVC target, so package by hand + - name: Package release + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.hotreload == false + shell: pwsh + run: | + New-Item -ItemType Directory musializer-win64 + Copy-Item build/musializer.exe musializer-win64/ + Copy-Item -Recurse resources musializer-win64/resources + Copy-Item musializer-logged.bat musializer-win64/ + Compress-Archive -Path musializer-win64 -DestinationPath musializer-win64.zip + - name: Upload release package + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.hotreload == false + uses: actions/upload-artifact@v4 + with: + name: release-windows + path: musializer-win64.zip + release: + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + needs: [macos, ubuntu, windows] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download release packages + uses: actions/download-artifact@v4 + with: + pattern: release-* + path: dist + merge-multiple: true + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + # Creates the tag on the pushed commit if it doesn't exist yet + tag_name: v0.${{ github.run_number }} + target_commitish: ${{ github.sha }} + files: dist/* + generate_release_notes: true diff --git a/.gitignore b/.gitignore index 712bb841..df2db6c8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ nob.old nob.exe nob.exe.old nob.obj + +# stupid extension creates file +.vscode/ \ No newline at end of file diff --git a/README.md b/README.md index f17afb31..c1888c78 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

> [!WARNING] -> This software is unfinished. Keep your expectations low. +> This is a fork of [https://github.com/tsoding/musializer](https://github.com/tsoding/musializer) The project aims to make a tool for creating beautiful music visualizations and rendering high quality videos of them. diff --git a/src/plug.c b/src/plug.c index 84d0ef24..1ad74749 100644 --- a/src/plug.c +++ b/src/plug.c @@ -192,6 +192,7 @@ typedef struct { int circle_radius_location; int circle_power_location; bool fullscreen; + bool castrated; // Renderer bool rendering; @@ -363,6 +364,10 @@ static void fft_render(Rectangle boundary, size_t m) Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; + // No balls if castrated + if (p->castrated) {return;} + + // Display the Smears SetShaderValue(p->circle, p->circle_radius_location, (float[1]){ 0.3f }, SHADER_UNIFORM_FLOAT); SetShaderValue(p->circle, p->circle_power_location, (float[1]){ 3.0f }, SHADER_UNIFORM_FLOAT); @@ -1227,6 +1232,37 @@ static int render_button_with_location(const char *file, int line, Rectangle bou return state; } +static int castrated_checkbox_with_location(const char *file, int line, Rectangle boundary) +{ + uint64_t id = DJB2_INIT; + id = djb2(id, file, strlen(file)); + id = djb2(id, &line, sizeof(line)); + + int state = button_with_id(id, boundary); + if (state & BS_CLICKED) { + p->castrated = !p->castrated; + } + + Rectangle checkbox = { + .x = boundary.x + boundary.width/2 - boundary.width*0.2f, + .y = boundary.y + boundary.height/2 - boundary.height*0.2f, + .width = boundary.width*0.4f, + .height = boundary.height*0.4f, + }; + Color color = (state & BS_HOVEROVER) ? COLOR_TRACK_BUTTON_HOVEROVER : COLOR_TRACK_BUTTON_BACKGROUND; + DrawRectangleRounded(boundary, 0.2f, 20, color); + if (p->castrated) { + DrawRectangleRec(checkbox, COLOR_ACCENT); + } + DrawRectangleLinesEx(checkbox, 2, WHITE); + + tooltip(boundary, "Castrated mode (no balls)", SIDE_TOP, false); + return state; +} + +#define castrated_checkbox(boundary) \ + castrated_checkbox_with_location(__FILE__, __LINE__, (boundary)) + #ifdef MUSIALIZER_MICROPHONE #define microphone_button(boundary) \ microphone_button_with_location(__FILE__, __LINE__, (boundary)) @@ -1355,9 +1391,9 @@ static bool toolbar(Track *track, Rectangle boundary) int state = 0; #ifdef MUSIALIZER_MICROPHONE - size_t buttons_count = 5; + size_t buttons_count = 6; #else - size_t buttons_count = 4; + size_t buttons_count = 5; #endif // MUSIALIZER_MICROPHONE if (boundary.width < HUD_BUTTON_SIZE*buttons_count) return interacted; @@ -1390,6 +1426,17 @@ static bool toolbar(Track *track, Rectangle boundary) start_rendering_track(track); } + state = castrated_checkbox((CLITERAL(Rectangle) { + x, + boundary.y, + HUD_BUTTON_SIZE, + HUD_BUTTON_SIZE, + })); + x += HUD_BUTTON_SIZE; + if (state & BS_CLICKED) { + interacted = true; + } + #ifdef MUSIALIZER_MICROPHONE state = microphone_button((CLITERAL(Rectangle) { x, @@ -1871,6 +1918,7 @@ MUSIALIZER_PLUG void plug_init(void) load_assets(); p->screen = LoadRenderTexture(RENDER_WIDTH, RENDER_HEIGHT); p->current_track = -1; + p->castrated = false; // TODO: restore master volume between sessions SetMasterVolume(0.5);