[ServerWorld] Sending Scene state more often.
This commit is contained in:
parent
419fc8b46c
commit
4909d1dbc2
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include "Registry.hpp"
|
#include "Registry.hpp"
|
||||||
|
|
||||||
void RenderingController::update(entt::DefaultRegistry ®istry) {
|
void RenderingController::draw(entt::DefaultRegistry ®istry, gk::RenderTarget &target, gk::RenderStates states) {
|
||||||
registry.view<DrawableDef>().each([&](auto entity, auto &drawableDef) {
|
registry.view<DrawableDef>().each([&](auto entity, auto &drawableDef) {
|
||||||
const InventoryCubeDef &cubeDef = drawableDef.getInventoryCubeDef();
|
const InventoryCubeDef &cubeDef = drawableDef.getInventoryCubeDef();
|
||||||
|
|
||||||
@ -48,9 +48,7 @@ void RenderingController::update(entt::DefaultRegistry ®istry) {
|
|||||||
|
|
||||||
registry.remove<DrawableDef>(entity);
|
registry.remove<DrawableDef>(entity);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
void RenderingController::draw(entt::DefaultRegistry ®istry, gk::RenderTarget &target, gk::RenderStates states) {
|
|
||||||
registry.view<DrawableComponent, gk::Transformable>().each([&](auto, auto &drawable, auto &transformable) {
|
registry.view<DrawableComponent, gk::Transformable>().each([&](auto, auto &drawable, auto &transformable) {
|
||||||
gk::RenderStates drawStates = states;
|
gk::RenderStates drawStates = states;
|
||||||
drawStates.transform *= transformable.getTransform();
|
drawStates.transform *= transformable.getTransform();
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
class RenderingController : public AbstractController {
|
class RenderingController : public AbstractController {
|
||||||
public:
|
public:
|
||||||
void update(entt::DefaultRegistry ®istry) override;
|
|
||||||
|
|
||||||
void draw(entt::DefaultRegistry ®istry, gk::RenderTarget &target, gk::RenderStates states) override;
|
void draw(entt::DefaultRegistry ®istry, gk::RenderTarget &target, gk::RenderStates states) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,9 +57,10 @@ void ServerWorld::update() {
|
|||||||
m_scene.update();
|
m_scene.update();
|
||||||
|
|
||||||
// FIXME: Should be placed somewhere else
|
// FIXME: Should be placed somewhere else
|
||||||
|
// FIXME: Shouldn't be sent that often
|
||||||
static int lastTime = m_clock.getTicks(true);
|
static int lastTime = m_clock.getTicks(true);
|
||||||
int now = m_clock.getTicks(true);
|
int now = m_clock.getTicks(true);
|
||||||
if (now - lastTime > 100) {
|
if (now - lastTime > 10) {
|
||||||
lastTime = now;
|
lastTime = now;
|
||||||
|
|
||||||
sf::Packet packet;
|
sf::Packet packet;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user