Use PiGuiView instead of UIView

master
Webster Sheets 2020-11-22 19:15:30 -05:00 committed by Webster Sheets
parent 6aab0908ae
commit e16b978fca
5 changed files with 12 additions and 23 deletions

View File

@ -95,7 +95,7 @@ void SectorView::InputBinding::RegisterBindings()
}
SectorView::SectorView(Game *game) :
UIView(),
PiGuiView("sector-view"),
InputBindings(Pi::input),
m_galaxy(game->GetGalaxy())
{
@ -128,7 +128,7 @@ SectorView::SectorView(Game *game) :
}
SectorView::SectorView(const Json &jsonObj, Game *game) :
UIView(),
PiGuiView("sector-view"),
InputBindings(Pi::input),
m_galaxy(game->GetGalaxy())
{
@ -383,8 +383,6 @@ void SectorView::Draw3D()
m_disk->SetColor(Color(0, 0, 204));
m_disk->Draw(m_renderer);
m_renderer->ResetDepthRange();
UIView::Draw3D();
}
void SectorView::SetHyperspaceTarget(const SystemPath &path)
@ -1095,7 +1093,6 @@ void SectorView::OnSwitchTo()
{
m_renderer->SetViewport({ 0, 0, Graphics::GetScreenWidth(), Graphics::GetScreenHeight() });
Pi::input->AddInputFrame(&InputBindings);
UIView::OnSwitchTo();
Update();
}
@ -1241,8 +1238,6 @@ void SectorView::Update()
m_fresnelMat->diffuse = Color::WHITE;
m_jumpSphere.reset(new Graphics::Drawables::Sphere3D(m_renderer, m_fresnelMat, m_jumpSphereState, 4, 1.0f));
}
UIView::Update();
}
void SectorView::ShowAll()

View File

@ -4,14 +4,13 @@
#ifndef _SECTORVIEW_H
#define _SECTORVIEW_H
#include "Input.h"
#include "UIView.h"
#include "DeleteEmitter.h"
#include "Input.h"
#include "galaxy/Sector.h"
#include "galaxy/SystemPath.h"
#include "graphics/Drawables.h"
#include "gui/Gui.h"
#include "DeleteEmitter.h"
#include "pigui/PiGuiView.h"
#include <set>
#include <string>
#include <vector>
@ -23,7 +22,7 @@ namespace Graphics {
class RenderState;
}
class SectorView : public UIView, public DeleteEmitter {
class SectorView : public PiGuiView, public DeleteEmitter {
public:
SectorView(Game *game);
SectorView(const Json &jsonObj, Game *game);

View File

@ -234,7 +234,7 @@ void SystemView::InputBindings::RegisterBindings()
}
SystemView::SystemView(Game *game) :
UIView(),
PiGuiView("system-view"),
m_input(Pi::input),
m_game(game),
m_showL4L5(LAG_OFF),
@ -589,8 +589,6 @@ void SystemView::Draw3D()
if (m_gridDrawing != GridDrawing::OFF) {
DrawGrid();
}
UIView::Draw3D();
}
void SystemView::Update()
@ -633,8 +631,6 @@ void SystemView::Update()
m_rot_x_to += m_input.mapViewPitch->GetValue() * ft * 60;
m_rot_x_to = Clamp(m_rot_x_to, -80.0f, 80.0f);
UIView::Update();
}
void SystemView::MouseWheel(bool up)

View File

@ -8,7 +8,7 @@
#include "DeleteEmitter.h"
#include "Frame.h"
#include "Input.h"
#include "UIView.h"
#include "pigui/PiGuiView.h"
#include "graphics/Drawables.h"
#include "matrix4x4.h"
#include "vector3.h"
@ -112,13 +112,13 @@ struct Projectable
Projectable() : type(NONE) {}
};
class SystemView : public UIView, public DeleteEmitter {
class SystemView : public PiGuiView, public DeleteEmitter {
public:
SystemView(Game *game);
virtual ~SystemView();
virtual void Update();
virtual void Draw3D();
virtual void OnSwitchTo() { Update(); Draw3D(); }
// virtual void OnSwitchTo() { Update(); Draw3D(); }
Projectable* GetSelectedObject();
void SetSelectedObject(Projectable::types type, Projectable::bases base, SystemBody *sb);

View File

@ -4,11 +4,10 @@
#pragma once
#include "../View.h"
#include "PiGui.h"
// replacement for UIView. Currently a shim, this class should be able to
// dispatch to lua-registered handler functions and call them during the Draw3D
// method.
// Replacement for UIView. This class dispatches to lua-registered pigui draw
// functions when DrawPiGui() is called.
// TODO: support rendering to a debug window during the Update() and Draw3D() methods.
class PiGuiView : public View {
public:
PiGuiView(std::string name) :