Brenta Engine
1.2
Loading...
Searching...
No Matches
camera_render_system.hpp
1
// SPDX-License-Identifier: MIT
2
// Author: Giovanni Santini
3
// Mail: giovanni.santini@proton.me
4
// Github: @San7o
5
6
#pragma once
7
8
#ifndef BRENTA_NO_ECS
9
10
#include <brenta/ecs/ecs.hpp>
11
#include <brenta/renderer/opengl/framebuffer.hpp>
12
#include <brenta/ecs/components/camera_ecs_component.hpp>
13
14
#include <vector>
15
16
namespace
brenta
17
{
18
19
class
CameraRenderSystem
:
public
viotecs::System<CameraEcsComponent>
20
{
21
public
:
22
23
void
run(std::vector<viotecs::EntityId> entities)
const override
24
{
25
for
(
auto
& e : entities)
26
{
27
auto
camera =
28
viotecs::World::entity_to_component<CameraEcsComponent>(e);
29
30
if
(
const
auto
& f = camera->fb.lock())
31
Renderer::set_camera(*camera->camera,
32
f->width, f->height);
33
}
34
}
35
};
36
37
}
// namespace brenta
38
39
#endif
// BRENTA_NO_ECS
brenta::CameraRenderSystem
Definition
camera_render_system.hpp:20
include
brenta
ecs
systems
camera_render_system.hpp
Generated by
1.9.8