Clean up header dependencies

A lot of source files were depending on utils.h being included by other headers
Cleaned up code that was depending on Input.h being included in Pi.h
master
Webster Sheets 2020-03-27 16:45:17 -04:00
parent 2376b050eb
commit 0c67f400c9
11 changed files with 23 additions and 10 deletions

View File

@ -11,12 +11,13 @@
#include "graphics/Frustum.h"
#include "graphics/Graphics.h"
#include "graphics/Material.h"
#include "graphics/Renderer.h"
#include "graphics/RenderState.h"
#include "graphics/Renderer.h"
#include "graphics/Texture.h"
#include "graphics/VertexArray.h"
#include "graphics/opengl/GenGasGiantColourMaterial.h"
#include "perlin.h"
#include "utils.h"
#include "vcacheopt/vcacheopt.h"
RefCountedPtr<GasPatchContext> GasGiant::s_patchContext;
@ -27,7 +28,7 @@ namespace {
static Uint32 s_texture_size_gpu[5];
static Uint32 s_noiseOctaves[5];
static float s_initialCPUDelayTime = 60.0f; // (perhaps) 60 seconds seems like a reasonable default
static float s_initialGPUDelayTime = 5.0f; // (perhaps) 5 seconds seems like a reasonable default
static float s_initialGPUDelayTime = 5.0f; // (perhaps) 5 seconds seems like a reasonable default
static std::vector<GasGiant *> s_allGasGiants;
static const std::string GGJupiter("GGJupiter");

View File

@ -6,6 +6,7 @@
#include "Pi.h"
#include "graphics/Graphics.h"
#include "graphics/Renderer.h"
#include "utils.h"
#include "perlin.h"
#include "vcacheopt/vcacheopt.h"

View File

@ -20,6 +20,7 @@
#include "graphics/TextureBuilder.h"
#include "graphics/VertexArray.h"
#include "perlin.h"
#include "utils.h"
#include "vcacheopt/vcacheopt.h"
#include <algorithm>
#include <deque>

View File

@ -3,6 +3,7 @@
#include "KeyBindings.h"
#include "GameConfig.h"
#include "Input.h"
#include "Lang.h"
#include "Pi.h"
#include "StringF.h"
@ -453,7 +454,7 @@ namespace KeyBindings {
ossaxisnum << int(axis);
return stringf(Lang::JOY_AXIS,
formatarg("sign", direction == KeyBindings::NEGATIVE ? "-" : ""), // no + sign if positive
formatarg("sign", direction == KeyBindings::NEGATIVE ? "-" : ""), // no + sign if positive
formatarg("signp", direction == KeyBindings::NEGATIVE ? "-" : "+"), // optional with + sign
formatarg("joynum", joystick),
formatarg("joyname", Pi::input->JoystickName(joystick)),

View File

@ -6,7 +6,7 @@
#include "Game.h"
#include "GameConfig.h"
#include "GameSaveError.h"
#include "KeyBindings.h"
#include "Input.h"
#include "MathUtil.h"
#include "Pi.h"
#include "Player.h"
@ -22,6 +22,7 @@
#include "gui/Gui.h"
#include "lua/LuaConstants.h"
#include "lua/LuaObject.h"
#include "utils.h"
#include <algorithm>
#include <sstream>
#include <unordered_set>
@ -637,7 +638,7 @@ void SectorView::AutoRoute(const SystemPath &start, const SystemPath &target, st
Output("SectorView::AutoRoute, nodes to search = %lu\n", nodes.size());
// setup inital values and set everything as unvisited
std::vector<float> path_dist; // distance from source to node
std::vector<float> path_dist; // distance from source to node
std::vector<std::vector<SystemPath>::size_type> path_prev; // previous node in optimal path
std::unordered_set<std::vector<SystemPath>::size_type> unvisited;
for (std::vector<SystemPath>::size_type i = 0; i < nodes.size(); i++) {

View File

@ -7,6 +7,7 @@
#include "Frame.h"
#include "Game.h"
#include "GameLog.h"
#include "Input.h"
#include "Lang.h"
#include "Pi.h"
#include "Player.h"
@ -679,7 +680,7 @@ void SystemView::OnClickShip(Ship *s)
return;
}
if (Pi::player->GetNavTarget() == s) { //un-select ship if already selected
Pi::player->SetNavTarget(0); // remove current
Pi::player->SetNavTarget(0); // remove current
m_game->log->Add(Lang::UNSET_NAVTARGET);
m_infoLabel->SetText(""); // remove lingering text
m_infoText->SetText("");

View File

@ -7,6 +7,7 @@
#include "OS.h"
#include "Renderer.h"
#include "StringF.h"
#include "utils.h"
#include <iterator>
#include <sstream>

View File

@ -7,6 +7,7 @@
#include "StringF.h"
#include "StringRange.h"
#include "graphics/Graphics.h"
#include "utils.h"
#include <set>

View File

@ -2,9 +2,12 @@
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
#include "PiGui.h"
#include "Input.h"
#include "Pi.h"
#include "graphics/opengl/TextureGL.h" // nasty, usage of GL is implementation specific
#include "imgui/imgui.h"
// Use GLEW instead of GL3W.
#define IMGUI_IMPL_OPENGL_LOADER_GLEW 1
#include "imgui/examples/imgui_impl_opengl3.h"

View File

@ -11,9 +11,9 @@
#include <unordered_set>
class PiFace {
friend class PiGui; // need acces to some private data
friend class PiGui; // need acces to some private data
std::string m_ttfname; // only the ttf name, it is automatically sought in data/fonts/
float m_sizefactor; // the requested pixelsize is multiplied by this factor
float m_sizefactor; // the requested pixelsize is multiplied by this factor
std::unordered_set<unsigned short> m_invalid_glyphs;
mutable std::vector<std::pair<unsigned short, unsigned short>> m_used_ranges;
ImVector<ImWchar> m_imgui_ranges;
@ -87,6 +87,9 @@ public:
// Call at the start of every frame. Calls ImGui::NewFrame() internally.
void NewFrame(SDL_Window *window);
// Call at the end of a frame that you're not going to render the results of
void EndFrame();
// Calls ImGui::EndFrame() internally and does book-keeping before rendering.
void Render();
@ -131,8 +134,6 @@ public:
static void ThrustIndicator(const std::string &id_string, const ImVec2 &size, const ImVec4 &thrust, const ImVec4 &velocity, const ImVec4 &bg_col, int frame_padding, ImColor vel_fg, ImColor vel_bg, ImColor thrust_fg, ImColor thrust_bg);
private:
void EndFrame();
LuaRef m_handlers;
LuaRef m_keys;
static std::vector<Graphics::Texture *> m_svg_textures;

View File

@ -5,6 +5,7 @@
#include "GameConfig.h"
#include "Pi.h"
#include "utils.h"
void Terrain::DebugDump() const
{