Emulator: Set camera zoom-level and screen flip in scene JSON

This commit is contained in:
Riyyi
2022-10-16 12:47:21 +02:00
parent 16db21fcab
commit 900dbde54b
2 changed files with 12 additions and 14 deletions
+8 -1
View File
@@ -4,6 +4,13 @@
"translate": [ 0.0, 0.0, -1.0 ],
"rotate": [ 0.0, 0.0, 0.0 ],
"scale": [ 1.0, 1.0, 1.0 ],
"type": "orthographic"
"type": "orthographic",
"zoom-level": 0.45
},
"quad" : [
{
"name": "Screen",
"scale": [ 1.0, -0.9, 1.0 ]
}
]
}
+1 -10
View File
@@ -25,17 +25,8 @@ PPU ::PPU(uint32_t frequency)
{
m_shared_registers.emplace("LY", &m_lcd_y_coordinate);
// Setup screen
auto& scene = Inferno::Application::the().scene();
m_entity = scene.createEntity("Screen");
// Flip the screen to accommodate OpenGL's coordinate system
auto& transform = scene.getComponent<Inferno::TransformComponent>(m_entity);
transform.scale.y = -1.0f;
auto texture = std::make_shared<Inferno::Texture>(m_screen.data(), SCREEN_WIDTH, SCREEN_HEIGHT, FORMAT_SIZE);
scene.addComponent<Inferno::SpriteComponent>(m_entity, glm::vec4 { 1.0f }, texture);
m_entity = scene.findEntity("Screen");
}
PPU::~PPU()