added game_object_pool_size as Engine constructor argument

This commit is contained in:
Timerix 2025-05-19 03:45:28 +05:00
parent 851e1ee122
commit 8fd6cee223
3 changed files with 6 additions and 14 deletions

View File

@ -3,12 +3,9 @@
namespace ougge { namespace ougge {
Engine::Engine() Engine::Engine(u32 game_object_pool_size)
: gameObjectPool(GAMEOBJECTPOOL_SIZE), textures(&resourceManager) : gameObjectPool(game_object_pool_size), textures(&resourceManager)
{ {
}
void Engine::init(){
engineManagedAssembly = mono.loadAssembly("Ougge.dll"); engineManagedAssembly = mono.loadAssembly("Ougge.dll");
gameObjectClass = engineManagedAssembly->getClass("Ougge", "GameObject"); gameObjectClass = engineManagedAssembly->getClass("Ougge", "GameObject");
gameObjectCtor = Mono::Method<void(u64, u32)>(gameObjectClass, ".ctor"); gameObjectCtor = Mono::Method<void(u64, u32)>(gameObjectClass, ".ctor");

View File

@ -8,8 +8,6 @@
namespace ougge { namespace ougge {
#define GAMEOBJECTPOOL_SIZE 64*1024
using UpdateFunc_t = function_shared_ptr<void(f64)>; using UpdateFunc_t = function_shared_ptr<void(f64)>;
class Engine { class Engine {
@ -32,8 +30,8 @@ public:
resources::ResourceManager resourceManager; resources::ResourceManager resourceManager;
resources::CacheStorage<resources::Texture> textures; resources::CacheStorage<resources::Texture> textures;
Engine(); Engine(u32 game_object_pool_size = 64*1024);
void init();
void openMainWindow(const std::string& window_title); void openMainWindow(const std::string& window_title);
// start game loop on the current thread // start game loop on the current thread
void startLoop(); void startLoop();

View File

@ -22,12 +22,9 @@ void drawTutel(Engine& engine){
int main(int argc, const char** argv){ int main(int argc, const char** argv){
try { try {
std::cout<<"initialized resource loader"<<std::endl; std::cout<<"initializing game engine... ";
Engine engine; Engine engine;
std::cout<<"initialized mono jit runtime"<<std::endl; std::cout<<"done"<<std::endl;
engine.init();
std::cout<<"initialized game engine"<<std::endl;
game::GameObject& exampleObj = engine.createGameObject(); game::GameObject& exampleObj = engine.createGameObject();
std::string componentClassName = "Ougge.ExampleComponent"; std::string componentClassName = "Ougge.ExampleComponent";