-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_camera.h
More file actions
22 lines (20 loc) · 788 Bytes
/
set_camera.h
File metadata and controls
22 lines (20 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
namespace Game::Render
{
template<typename T>
void set_camera([[maybe_unused]] T &syscall, System::ECS::Query<Game::Render::Camera2D> &query)
{
if (query.begin() == query.end())
return;
const auto &[offsetX, offsetY, scaleX, scaleY, rotation, zoom] = query.front().get<Game::Render::Camera2D>();
// ReSharper disable once CppUseStructuredBinding
auto &intent_camera = System::Render::IntentStorage::get_camera();
intent_camera.offsetX = offsetX;
intent_camera.offsetY = offsetY;
intent_camera.scaleX = scaleX;
intent_camera.scaleY = scaleY;
intent_camera.zoom = zoom;
intent_camera.rotation = rotation;
LOG_INFO("Camera set");
}
} // namespace Game::Render