Rearrangements; Audio support

This commit is contained in:
2025-08-30 21:06:56 +03:00
parent 503db60c60
commit 657107b4ae
30 changed files with 95935 additions and 57 deletions

View File

@@ -0,0 +1,5 @@
project(gamedata)
find_package(OGRE REQUIRED COMPONENTS Bites Bullet Paging Terrain CONFIG)
add_library(GameData STATIC GameData.cpp)
target_link_libraries(GameData PUBLIC OgreMain OgreBullet flecs::flecs_static)
target_include_directories(GameData PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

29
src/gamedata/GameData.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include <Ogre.h>
#include "GameData.h"
namespace ECS
{
static flecs::world ecs;
CharacterModule::CharacterModule(flecs::world &ecs)
{
ecs.component<Input>();
ecs.add<Input>();
ecs.system("HandleInput").kind(flecs::OnUpdate).run([](flecs::iter &it) {
/* handle input */
});
}
void setup()
{
ecs.add<GameData>();
ecs.import <CharacterModule>();
}
void update(float delta)
{
ecs.progress(delta);
}
flecs::world &get()
{
return ecs;
}
}

36
src/gamedata/GameData.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef GAMEDATA_H
#define GAMEDATA_H
#include <OgreBullet.h>
#include <flecs.h>
namespace ECS
{
struct GameData {
flecs::entity player;
};
struct Vector3 {
float x;
float y;
float z;
};
struct Input {
Vector3 motion;
bool fast;
Input()
: motion({ 0, 0, 0 })
, fast(false)
{
}
};
struct CharacterBody {
btPairCachingGhostObject *mGhostObject;
btCompoundShape *mCollisionShape;
Ogre::Bullet::DynamicsWorld *mWorld;
};
struct CharacterModule {
CharacterModule(flecs::world &ecs);
};
void setup();
void update(float delta);
flecs::world &get();
}
#endif