[ServerWorld] Sending Scene state more often.

This commit is contained in:
Quentin Bazin 2020-04-06 01:24:49 +02:00
parent 419fc8b46c
commit 4909d1dbc2
3 changed files with 3 additions and 6 deletions

View File

@ -34,7 +34,7 @@
#include "Registry.hpp"
void RenderingController::update(entt::DefaultRegistry &registry) {
void RenderingController::draw(entt::DefaultRegistry &registry, gk::RenderTarget &target, gk::RenderStates states) {
registry.view<DrawableDef>().each([&](auto entity, auto &drawableDef) {
const InventoryCubeDef &cubeDef = drawableDef.getInventoryCubeDef();
@ -48,9 +48,7 @@ void RenderingController::update(entt::DefaultRegistry &registry) {
registry.remove<DrawableDef>(entity);
});
}
void RenderingController::draw(entt::DefaultRegistry &registry, gk::RenderTarget &target, gk::RenderStates states) {
registry.view<DrawableComponent, gk::Transformable>().each([&](auto, auto &drawable, auto &transformable) {
gk::RenderStates drawStates = states;
drawStates.transform *= transformable.getTransform();

View File

@ -31,8 +31,6 @@
class RenderingController : public AbstractController {
public:
void update(entt::DefaultRegistry &registry) override;
void draw(entt::DefaultRegistry &registry, gk::RenderTarget &target, gk::RenderStates states) override;
};

View File

@ -57,9 +57,10 @@ void ServerWorld::update() {
m_scene.update();
// FIXME: Should be placed somewhere else
// FIXME: Shouldn't be sent that often
static int lastTime = m_clock.getTicks(true);
int now = m_clock.getTicks(true);
if (now - lastTime > 100) {
if (now - lastTime > 10) {
lastTime = now;
sf::Packet packet;