Skip to content

feat(Core): functions to run and stop the core#122

Merged
ripel2 merged 10 commits intomainfrom
101-run-all-systems-of-core-in-a-loop
Mar 15, 2025
Merged

feat(Core): functions to run and stop the core#122
ripel2 merged 10 commits intomainfrom
101-run-all-systems-of-core-in-a-loop

Conversation

@Divengerss
Copy link
Contributor

Related to:

Providing functions to handle the core state, in order to avoid defining the core loop in the game code.

Divengerss and others added 5 commits March 14, 2025 17:36
The point is to prevent the user to define the core loop logic inside
the game code, but let them only call the run and stop functions.
…gineSquared/EngineSquared into 101-run-all-systems-of-core-in-a-loop
@Divengerss Divengerss added the enhancement New feature or request label Mar 14, 2025
@Divengerss Divengerss requested a review from a team March 14, 2025 09:13
@Divengerss Divengerss self-assigned this Mar 14, 2025
@ripel2
Copy link
Contributor

ripel2 commented Mar 14, 2025

How will this affect usage with our windows plugins ? I am talking about the "window should close" methods
Have you tested it ?

@ripel2
Copy link
Contributor

ripel2 commented Mar 14, 2025

How will this affect usage with our windows plugins ? I am talking about the "window should close" methods Have you tested it ?

Please provide an example like this

@Divengerss
Copy link
Contributor Author

Since I tested it from the current Raylib implementation of the GameDemo, the windows plugins should works the same way.

As an example, the current implementation let the user define a new system to handle whenever the window should close like this:

core.RegisterSystem<ES::Engine::Scheduler::RelativeTimeUpdate>(Game::RunLoop);

This system being as simple as this:

void Game::RunLoop(ES::Engine::Core &core)
{
    if (Raylib::WindowShouldClose())
        core.Stop();
}

We can simply call the runCore function now to run the systems. This avoids having to write a loop condition outside of the core to handle their execution, but inside as systems:

core.RunCore();

@ripel2
Copy link
Contributor

ripel2 commented Mar 15, 2025

Since I tested it from the current Raylib implementation of the GameDemo, the windows plugins should works the same way.

As an example, the current implementation let the user define a new system to handle whenever the window should close like this:

core.RegisterSystem<ES::Engine::Scheduler::RelativeTimeUpdate>(Game::RunLoop);

This system being as simple as this:

void Game::RunLoop(ES::Engine::Core &core)
{
    if (Raylib::WindowShouldClose())
        core.Stop();
}

We can simply call the runCore function now to run the systems. This avoids having to write a loop condition outside of the core to handle their execution, but inside as systems:

core.RunCore();

Okay, fix conflicts and it's good

@ripel2 ripel2 enabled auto-merge (squash) March 15, 2025 09:16
@sonarqubecloud
Copy link

@ripel2 ripel2 merged commit 1832529 into main Mar 15, 2025
10 checks passed
@ripel2 ripel2 deleted the 101-run-all-systems-of-core-in-a-loop branch March 15, 2025 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run all systems of Core in a loop directly in it rather than giving the responsability to the user

2 participants