Prepare port

This commit is contained in:
2025-06-09 00:53:50 +02:00
parent 49f45423d1
commit 9d09b70bae
6 changed files with 18 additions and 23 deletions

View File

@@ -31,7 +31,6 @@ find_package(entt CONFIG REQUIRED)
find_package(SDL3 CONFIG REQUIRED)
find_package(SDL3_ttf CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
add_executable(HansTheGatherer
src/main.cpp
@@ -42,6 +41,6 @@ add_executable(HansTheGatherer
src/render.cpp
)
target_link_libraries(HansTheGatherer SDL3::SDL3 SDL3_ttf::SDL3_ttf EnTT spdlog::spdlog)
target_link_libraries(HansTheGatherer SDL3::SDL3 SDL3_ttf::SDL3_ttf EnTT)
set_property(TARGET HansTheGatherer PROPERTY CXX_STANDARD 20)

View File

@@ -3,7 +3,6 @@
#include "definitions.hpp"
#include <cstdint>
#include <spdlog/spdlog.h>
static constexpr uint8_t BACKGROUND_DATA[] = {
#embed "../assets/images/jungle.bmp"
@@ -43,13 +42,13 @@ SDL_Texture* load_texture(uint8_t const* data, size_t size, SDL_Renderer* render
SDL_Surface* surface = SDL_LoadBMP_IO(iostream, false);
if (surface == nullptr)
{
spdlog::error("Failed to load SDL surface!\nCause: {}", SDL_GetError());
// spdlog::error("Failed to load SDL surface!\nCause: {}", SDL_GetError());
}
SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface);
if (texture == nullptr)
{
spdlog::error("Failed to create texture from surface!\nCause: {}", SDL_GetError());
// spdlog::error("Failed to create texture from surface!\nCause: {}", SDL_GetError());
}
return texture;
@@ -64,7 +63,7 @@ AudioAsset load_audio(uint8_t const* data, size_t size)
iostream, false, &audio_asset.spec, &audio_asset.buffer, &audio_asset.buffer_length);
if (!res)
{
spdlog::error("Failed to load audio file!\nCause: {}", SDL_GetError());
// spdlog::error("Failed to load audio file!\nCause: {}", SDL_GetError());
}
return audio_asset;
}

View File

@@ -1,8 +1,6 @@
#include "level.hpp"
#include "input.hpp"
#include <spdlog/spdlog.h>
void LevelModule::MoveBasket(entt::registry& registry)
{
auto const& input = registry.ctx().get<ButtonInput>();

View File

@@ -5,7 +5,6 @@
#include "sprite.hpp"
#include <entt/entt.hpp>
#include <spdlog/spdlog.h>
struct Background
{

View File

@@ -8,7 +8,6 @@
#include <SDL3/SDL.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <entt/entt.hpp>
#include <spdlog/spdlog.h>
void increment_ticks(entt::registry& registry)
{
@@ -28,13 +27,13 @@ void increment_ticks(entt::registry& registry)
int main()
{
spdlog::info("Initialize SDL...");
// spdlog::info("Initialize SDL...");
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO))
{
spdlog::critical("Failed to initialize SDL!\nCause: {}", SDL_GetError());
// spdlog::critical("Failed to initialize SDL!\nCause: {}", SDL_GetError());
std::terminate();
}
@@ -43,13 +42,13 @@ int main()
auto* window = SDL_CreateWindow("HansTheGatherer", WINDOW_WIDTH, WINDOW_HEIGHT, 0);
if (window == nullptr)
{
spdlog::critical("Failed to create SDL window!\nCause: {}", SDL_GetError());
// spdlog::critical("Failed to create SDL window!\nCause: {}", SDL_GetError());
}
auto* renderer = SDL_CreateRenderer(window, nullptr);
if (renderer == nullptr)
{
spdlog::critical("Failed to create SDL renderer!\nCause: {}", SDL_GetError());
// spdlog::critical("Failed to create SDL renderer!\nCause: {}", SDL_GetError());
}
auto* text_engine = TTF_CreateRendererTextEngine(renderer);
@@ -106,12 +105,15 @@ int main()
AudioModule::FeedAudioStreams(registry);
if (registry.ctx().get<Game>().time != 0)
{
increment_ticks(registry);
LevelModule::MoveBasket(registry);
LevelModule::SpawnFruits(registry);
LevelModule::CollectFruit(registry);
LevelModule::CollectSpider(registry);
// LevelModule::DespawnItems(registry);
}
PhysicsModule::TranslatePhysicsObject(registry);
PhysicsModule::PropagatePosition(registry);

View File

@@ -1,8 +1,6 @@
#include "physics.hpp"
#include "level.hpp"
#include <spdlog/spdlog.h>
void PhysicsModule::TranslatePhysicsObject(entt::registry& registry)
{
auto view = registry.view<Position, Velocity const>();