Skip to content

Commit

Permalink
Merge pull request #5 from arf20/feature/freebsd
Browse files Browse the repository at this point in the history
FreeBSD support
  • Loading branch information
arf20 authored Feb 3, 2023
2 parents 35c829f + 8033be8 commit f588027
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev
run: sudo apt-get update && sudo apt-get install build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ project(ww1game)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

include_directories("/usr/local/include")
link_directories("/usr/local/lib")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down
1 change: 1 addition & 0 deletions src/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

// == Macros
#define ASSET_PATH "../assets"
Expand Down
4 changes: 2 additions & 2 deletions src/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace Assets {
bool run = true;

float fps = 0.0f;
std::chrono::_V2::system_clock::time_point time_prev = std::chrono::high_resolution_clock::now();
auto time_prev = std::chrono::high_resolution_clock::now();
long frameCounter = 0;
int anim_div = 0;
bool inMenu = true;
Expand Down Expand Up @@ -380,7 +380,7 @@ void renderLoop() {
SDL_Event event;
while (run) {
//Uint32 time_now = SDL_GetTicks();
std::chrono::_V2::system_clock::time_point time_now = std::chrono::high_resolution_clock::now();
auto time_now = std::chrono::high_resolution_clock::now();
float deltaTime = (time_now - time_prev).count() / 1000000000.0f;
fps = (deltaTime > 0.0f) ? 1.0f / deltaTime : 1.0f;
anim_div = std::roundl(fps / (float)ANIM_FPS);
Expand Down

0 comments on commit f588027

Please sign in to comment.