Skip to content

Commit

Permalink
Enable Linux builds
Browse files Browse the repository at this point in the history
  • Loading branch information
eXpl0it3r committed Oct 25, 2022
1 parent a7addc4 commit dfde5fb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ on:

jobs:
build:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.arch.name }}
name: ${{ matrix.platform.name }} ${{ matrix.config.name }}
runs-on: ${{ matrix.platform.os }}

strategy:
fail-fast: false
matrix:
platform:
- { name: Windows VS2019, os: windows-2019 }
- { name: Windows VS2022, os: windows-2022 }
arch:
- { name: X86, flag: Win32 }
- { name: X64, flag: x64 }
- { name: Windows VS2019 X86, os: windows-2019, flags: -A Win32 }
- { name: Windows VS2019 X64, os: windows-2019, flags: -A x64 }
- { name: Windows VS2022 X86, os: windows-2022, flags: -A Win32 }
- { name: Windows VS2022 X64, os: windows-2022, flags: -A x64 }
- { name: Linux GCC, os: ubuntu-latest }
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
config:
- { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
- { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
Expand All @@ -37,9 +38,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev

- name: Configure
shell: bash
run: cmake -A ${{ matrix.arch.flag }} -S . -B build -DCMAKE_INSTALL_PREFIX=install ${{ matrix.platform.flags }} ${{ matrix.config.flags }}
run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install ${{ matrix.platform.flags }} ${{ matrix.config.flags }}

- name: Build
shell: bash
Expand All @@ -52,15 +57,15 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.arch.name }}
name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}
path: ./install/bin/*

- name: Get Artifact
id: get_artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/download-artifact@v3
with:
name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.arch.name }}
name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}

- name: Create Release
id: create_release
Expand All @@ -81,5 +86,5 @@ jobs:
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.get_artifact.outputs.download-path }}
asset_name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.arch.name }}.zip
asset_name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}.zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ add_executable(Schiffbruch
)

target_compile_features(Schiffbruch PRIVATE cxx_std_17)
target_link_libraries(Schiffbruch PRIVATE sfml-graphics sfml-audio sfml-main dxguid ddraw)
target_link_libraries(Schiffbruch PRIVATE sfml-graphics sfml-audio)

# Copy DLLs next to the executable
if (WIN32 AND BUILD_SHARED_LIBS)
Expand Down
10 changes: 5 additions & 5 deletions src/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#define MB_LEFT sf::Mouse::Left;

constexpr auto M_PI = 3.14159265358979323846;
constexpr auto PI = 3.14159265358979323846;

namespace Renderer {

Expand Down Expand Up @@ -648,15 +648,15 @@ void DrawPanel()
short diffy = static_cast<short>(Bmp[Tiles::SUN].targetRect.bottom) - static_cast<short>(Bmp[Tiles::SUN].targetRect.top) - Bmp[Tiles::SUN].Height / 2;
short TagesZeit = (Hours * 10 + Minutes * 10 / 60);

DrawPicture(static_cast<short>(Bmp[Tiles::SUN].targetRect.left + diffx * cos(M_PI - M_PI * TagesZeit / 120) + diffx),
static_cast<short>(Bmp[Tiles::SUN].targetRect.top + (-diffy * sin(M_PI - M_PI * TagesZeit / 120) + diffy)),
DrawPicture(static_cast<short>(Bmp[Tiles::SUN].targetRect.left + diffx * cos(PI - PI * TagesZeit / 120) + diffx),
static_cast<short>(Bmp[Tiles::SUN].targetRect.top + (-diffy * sin(PI - PI * TagesZeit / 120) + diffy)),
Tiles::SUN, Bmp[Tiles::SUN].targetRect, false, -1);

// Rettungsring
short Ringtmp;

if (Chance < 100) {
Ringtmp = static_cast<short>(100 * sin(M_PI / 200 * Chance));
Ringtmp = static_cast<short>(100 * sin(PI / 200 * Chance));
} else {
Ringtmp = 100;
}
Expand Down Expand Up @@ -1069,7 +1069,7 @@ void ShowCredits()
for (int z = 1; z < 10; z++) {
if (CreditsList[CreditsNum][z].IsRunning) {
CreditsBlt(CreditsList[CreditsNum][z].Picture,
static_cast<short>(100 * sin(M_PI / MAX_SCREEN_Y * (Bmp[CreditsList[CreditsNum][z].Picture].targetRect.top +
static_cast<short>(100 * sin(PI / MAX_SCREEN_Y * (Bmp[CreditsList[CreditsNum][z].Picture].targetRect.top +
Bmp[CreditsList[CreditsNum][z].IsRunning].Height / 2))));
}
}
Expand Down

0 comments on commit dfde5fb

Please sign in to comment.