Prepare port
This commit is contained in:
@@ -31,7 +31,6 @@ find_package(entt CONFIG REQUIRED)
|
|||||||
|
|
||||||
find_package(SDL3 CONFIG REQUIRED)
|
find_package(SDL3 CONFIG REQUIRED)
|
||||||
find_package(SDL3_ttf CONFIG REQUIRED)
|
find_package(SDL3_ttf CONFIG REQUIRED)
|
||||||
find_package(spdlog CONFIG REQUIRED)
|
|
||||||
|
|
||||||
add_executable(HansTheGatherer
|
add_executable(HansTheGatherer
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
@@ -42,6 +41,6 @@ add_executable(HansTheGatherer
|
|||||||
src/render.cpp
|
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)
|
set_property(TARGET HansTheGatherer PROPERTY CXX_STANDARD 20)
|
||||||
|
|||||||
BIN
perf.data.old
Normal file
BIN
perf.data.old
Normal file
Binary file not shown.
@@ -3,7 +3,6 @@
|
|||||||
#include "definitions.hpp"
|
#include "definitions.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
static constexpr uint8_t BACKGROUND_DATA[] = {
|
static constexpr uint8_t BACKGROUND_DATA[] = {
|
||||||
#embed "../assets/images/jungle.bmp"
|
#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);
|
SDL_Surface* surface = SDL_LoadBMP_IO(iostream, false);
|
||||||
if (surface == nullptr)
|
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);
|
SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||||
if (texture == nullptr)
|
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;
|
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);
|
iostream, false, &audio_asset.spec, &audio_asset.buffer, &audio_asset.buffer_length);
|
||||||
if (!res)
|
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;
|
return audio_asset;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#include "level.hpp"
|
#include "level.hpp"
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
void LevelModule::MoveBasket(entt::registry& registry)
|
void LevelModule::MoveBasket(entt::registry& registry)
|
||||||
{
|
{
|
||||||
auto const& input = registry.ctx().get<ButtonInput>();
|
auto const& input = registry.ctx().get<ButtonInput>();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "sprite.hpp"
|
#include "sprite.hpp"
|
||||||
|
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
struct Background
|
struct Background
|
||||||
{
|
{
|
||||||
|
|||||||
26
src/main.cpp
26
src/main.cpp
@@ -8,7 +8,6 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3_ttf/SDL_ttf.h>
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
void increment_ticks(entt::registry& registry)
|
void increment_ticks(entt::registry& registry)
|
||||||
{
|
{
|
||||||
@@ -28,13 +27,13 @@ void increment_ticks(entt::registry& registry)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
spdlog::info("Initialize SDL...");
|
// spdlog::info("Initialize SDL...");
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
|
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
|
||||||
|
|
||||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO))
|
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();
|
std::terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,13 +42,13 @@ int main()
|
|||||||
auto* window = SDL_CreateWindow("HansTheGatherer", WINDOW_WIDTH, WINDOW_HEIGHT, 0);
|
auto* window = SDL_CreateWindow("HansTheGatherer", WINDOW_WIDTH, WINDOW_HEIGHT, 0);
|
||||||
if (window == nullptr)
|
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);
|
auto* renderer = SDL_CreateRenderer(window, nullptr);
|
||||||
if (renderer == 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);
|
auto* text_engine = TTF_CreateRendererTextEngine(renderer);
|
||||||
@@ -105,13 +104,16 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
AudioModule::FeedAudioStreams(registry);
|
AudioModule::FeedAudioStreams(registry);
|
||||||
|
|
||||||
increment_ticks(registry);
|
if (registry.ctx().get<Game>().time != 0)
|
||||||
LevelModule::MoveBasket(registry);
|
{
|
||||||
LevelModule::SpawnFruits(registry);
|
increment_ticks(registry);
|
||||||
LevelModule::CollectFruit(registry);
|
LevelModule::MoveBasket(registry);
|
||||||
LevelModule::CollectSpider(registry);
|
LevelModule::SpawnFruits(registry);
|
||||||
// LevelModule::DespawnItems(registry);
|
LevelModule::CollectFruit(registry);
|
||||||
|
LevelModule::CollectSpider(registry);
|
||||||
|
// LevelModule::DespawnItems(registry);
|
||||||
|
}
|
||||||
|
|
||||||
PhysicsModule::TranslatePhysicsObject(registry);
|
PhysicsModule::TranslatePhysicsObject(registry);
|
||||||
PhysicsModule::PropagatePosition(registry);
|
PhysicsModule::PropagatePosition(registry);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#include "physics.hpp"
|
#include "physics.hpp"
|
||||||
#include "level.hpp"
|
#include "level.hpp"
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
void PhysicsModule::TranslatePhysicsObject(entt::registry& registry)
|
void PhysicsModule::TranslatePhysicsObject(entt::registry& registry)
|
||||||
{
|
{
|
||||||
auto view = registry.view<Position, Velocity const>();
|
auto view = registry.view<Position, Velocity const>();
|
||||||
|
|||||||
Reference in New Issue
Block a user