Change UI design
This commit is contained in:
parent
adbc8f1ccc
commit
594fef4164
@ -56,7 +56,7 @@ Graphic3DRenderer::Graphic3DRenderer() {
|
|||||||
mMainCamera = std::make_unique<Camera>();
|
mMainCamera = std::make_unique<Camera>();
|
||||||
mMainCamera->SetPosition(0.0f, 1.5f, -8.0f);
|
mMainCamera->SetPosition(0.0f, 1.5f, -8.0f);
|
||||||
}
|
}
|
||||||
SetRTSize(1280.f, 324.f);
|
SetRTSize(1280.f, 400.f);
|
||||||
mMainCamera->UpdateCamView();
|
mMainCamera->UpdateCamView();
|
||||||
|
|
||||||
// Fill world object list to render
|
// Fill world object list to render
|
||||||
|
@ -49,7 +49,7 @@ CockpitUI::CockpitUI(unsigned int w, unsigned int h) : UI(w, h) {
|
|||||||
CreateDefaultRenderWindow();
|
CreateDefaultRenderWindow();
|
||||||
|
|
||||||
mStaticCockpitTexture.setSrgb(true);
|
mStaticCockpitTexture.setSrgb(true);
|
||||||
if (!mStaticCockpitTexture.loadFromFile("cockpit_ui_empty_rescaled.png", sf::IntRect(0, 0, 1280, 780)))
|
if (!mStaticCockpitTexture.loadFromFile("cockpit_ui.png", sf::IntRect(0, 0, 1280, 780)))
|
||||||
throw std::runtime_error("Unable to load texture datas");
|
throw std::runtime_error("Unable to load texture datas");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ void CockpitUI::Draw(std::shared_ptr<sf::RenderWindow>& context) {
|
|||||||
mUIRender.clear(sf::Color::Transparent);
|
mUIRender.clear(sf::Color::Transparent);
|
||||||
|
|
||||||
// Draw the radar display
|
// Draw the radar display
|
||||||
sf::CircleShape radar(95, 8);
|
sf::CircleShape radar(98, 8);
|
||||||
radar.setRotation(22.5f);
|
radar.setRotation(22.5f);
|
||||||
radar.setPosition(sf::Vector2f(838,378));
|
radar.setPosition(sf::Vector2f(836,416));
|
||||||
radar.setFillColor(SF_COLOR_4CHEX(0x666666FF));
|
radar.setFillColor(SF_COLOR_4CHEX(0x666666FF));
|
||||||
mUIRender.draw(radar, sRS);
|
mUIRender.draw(radar, sRS);
|
||||||
|
|
||||||
|
8
Game.cpp
8
Game.cpp
@ -8,6 +8,8 @@
|
|||||||
#include "Engine/Misc/Logger.hpp"
|
#include "Engine/Misc/Logger.hpp"
|
||||||
#include "Engine/Utils/Perfs.hpp"
|
#include "Engine/Utils/Perfs.hpp"
|
||||||
|
|
||||||
|
#define COCKPIT_VIEW_RATIO (400.f / WNDSIZE_DEFAULT_H)
|
||||||
|
|
||||||
using std::make_shared;
|
using std::make_shared;
|
||||||
using std::make_unique;
|
using std::make_unique;
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ Game::Game(std::shared_ptr<sf::RenderWindow>& mainWnd, bool dbgFlag) : mbDbgMode
|
|||||||
|
|
||||||
mWorld3D = make_shared<Graphic3DRenderer>();
|
mWorld3D = make_shared<Graphic3DRenderer>();
|
||||||
mCockpitUI = make_unique<CockpitUI>(wndWidth, (wndWidth * H_RATIO));
|
mCockpitUI = make_unique<CockpitUI>(wndWidth, (wndWidth * H_RATIO));
|
||||||
mWorldUI = make_unique<WorldUI>(wndWidth, std::floor((wndWidth * H_RATIO) * 0.45f), mWorld3D);
|
mWorldUI = make_unique<WorldUI>(wndWidth, std::floor((wndWidth * H_RATIO) * COCKPIT_VIEW_RATIO), mWorld3D);
|
||||||
|
|
||||||
if (mbDbgModeEnabled) {
|
if (mbDbgModeEnabled) {
|
||||||
mDbgUI = make_unique<DebugUI>();
|
mDbgUI = make_unique<DebugUI>();
|
||||||
@ -120,8 +122,8 @@ void Game::EventMouseMoved(int _x, int _y) {
|
|||||||
|
|
||||||
void Game::EventWindowSizeChanged(unsigned int w, unsigned int h) {
|
void Game::EventWindowSizeChanged(unsigned int w, unsigned int h) {
|
||||||
mCockpitUI->SetRTSize(static_cast<float>(w), (w * H_RATIO));
|
mCockpitUI->SetRTSize(static_cast<float>(w), (w * H_RATIO));
|
||||||
mWorldUI->SetRTSize(static_cast<float>(w), std::floor((w * H_RATIO) * 0.45f), true);
|
mWorldUI->SetRTSize(static_cast<float>(w), std::floor((w * H_RATIO) * COCKPIT_VIEW_RATIO), true);
|
||||||
mWorld3D->SetRTSize(static_cast<float>(w), std::floor((w * H_RATIO) * 0.45f));
|
mWorld3D->SetRTSize(static_cast<float>(w), std::floor((w * H_RATIO) * COCKPIT_VIEW_RATIO));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::Update() {
|
void Game::Update() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user