diff --git a/source/gui/CChart.cpp b/source/gui/CChart.cpp
index 65c0c3abb7..5e10f9f2e7 100644
--- a/source/gui/CChart.cpp
+++ b/source/gui/CChart.cpp
@@ -20,6 +20,7 @@
#include "CChart.h"
#include "gui/CGUIColor.h"
+#include "gui/GUIMatrix.h"
#include "graphics/ShaderManager.h"
#include "i18n/L10n.h"
#include "lib/ogl.h"
diff --git a/source/gui/GUIMatrix.cpp b/source/gui/GUIMatrix.cpp
new file mode 100644
index 0000000000..0605cbed2c
--- /dev/null
+++ b/source/gui/GUIMatrix.cpp
@@ -0,0 +1,42 @@
+/* Copyright (C) 2019 Wildfire Games.
+ * This file is part of 0 A.D.
+ *
+ * 0 A.D. is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 0 A.D. is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with 0 A.D. If not, see .
+ */
+
+#include "precompiled.h"
+
+#include "GUIMatrix.h"
+
+#include "maths/Matrix3D.h"
+
+extern int g_xres, g_yres;
+extern float g_GuiScale;
+
+CMatrix3D GetDefaultGuiMatrix()
+{
+ float xres = g_xres / g_GuiScale;
+ float yres = g_yres / g_GuiScale;
+
+ CMatrix3D m;
+ m.SetIdentity();
+ m.Scale(1.0f, -1.f, 1.0f);
+ m.Translate(0.0f, yres, -1000.0f);
+
+ CMatrix3D proj;
+ proj.SetOrtho(0.f, xres, 0.f, yres, -1.f, 1000.f);
+ m = proj * m;
+
+ return m;
+}
diff --git a/source/gui/GUIMatrix.h b/source/gui/GUIMatrix.h
new file mode 100644
index 0000000000..72e27aa34b
--- /dev/null
+++ b/source/gui/GUIMatrix.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2019 Wildfire Games.
+ * This file is part of 0 A.D.
+ *
+ * 0 A.D. is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 0 A.D. is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with 0 A.D. If not, see .
+ */
+
+#ifndef INCLUDED_GUIMATRIX
+#define INCLUDED_GUIMATRIX
+
+class CMatrix3D;
+
+/**
+ * Model-view-projection matrix with (0,0) in top-left of screen
+ */
+CMatrix3D GetDefaultGuiMatrix();
+
+#endif // INCLUDED_GUIMATRIX
diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp
index 46a66f11c6..33db956700 100644
--- a/source/gui/GUIRenderer.cpp
+++ b/source/gui/GUIRenderer.cpp
@@ -23,6 +23,7 @@
#include "graphics/TextureManager.h"
#include "gui/CGUIColor.h"
#include "gui/GUIutil.h"
+#include "gui/GUIMatrix.h"
#include "i18n/L10n.h"
#include "lib/ogl.h"
#include "lib/utf8.h"
diff --git a/source/gui/GUIutil.cpp b/source/gui/GUIutil.cpp
index 6f2b3fcf74..b61999a1be 100644
--- a/source/gui/GUIutil.cpp
+++ b/source/gui/GUIutil.cpp
@@ -21,11 +21,7 @@
#include "gui/GUI.h"
#include "gui/GUIManager.h"
-#include "maths/Matrix3D.h"
#include "ps/CLogger.h"
-#include "ps/GameSetup/Config.h"
-
-extern int g_xres, g_yres;
template
CGUISetting::CGUISetting(IGUIObject& pObject, const CStr& Name)
@@ -290,23 +286,6 @@ bool __ParseString(const CStrW& UNUSED(Value), CGUISeries& UNUSED(Ou
return false;
}
-CMatrix3D GetDefaultGuiMatrix()
-{
- float xres = g_xres / g_GuiScale;
- float yres = g_yres / g_GuiScale;
-
- CMatrix3D m;
- m.SetIdentity();
- m.Scale(1.0f, -1.f, 1.0f);
- m.Translate(0.0f, yres, -1000.0f);
-
- CMatrix3D proj;
- proj.SetOrtho(0.f, xres, 0.f, yres, -1.f, 1000.f);
- m = proj * m;
-
- return m;
-}
-
template
PSRETURN GUI::GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value)
{
diff --git a/source/gui/GUIutil.h b/source/gui/GUIutil.h
index c1051035a4..72d382d9a2 100644
--- a/source/gui/GUIutil.h
+++ b/source/gui/GUIutil.h
@@ -41,7 +41,6 @@ GUI util
class CClientArea;
class CGUIString;
-class CMatrix3D;
template class GUI;
class IGUISetting
@@ -109,9 +108,6 @@ private:
template
bool __ParseString(const CStrW& Value, T& tOutput);
-// Model-view-projection matrix with (0,0) in top-left of screen
-CMatrix3D GetDefaultGuiMatrix();
-
struct SGUIMessage;
/**
diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp
index b99064a9e2..d180bd66b6 100644
--- a/source/gui/MiniMap.cpp
+++ b/source/gui/MiniMap.cpp
@@ -30,6 +30,7 @@
#include "graphics/TerritoryTexture.h"
#include "gui/GUI.h"
#include "gui/GUIManager.h"
+#include "gui/GUIMatrix.h"
#include "lib/bits.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/ogl.h"
diff --git a/source/gui/MiniMap.h b/source/gui/MiniMap.h
index 74aea6c229..37b61d33a3 100644
--- a/source/gui/MiniMap.h
+++ b/source/gui/MiniMap.h
@@ -21,8 +21,8 @@
#include "gui/GUI.h"
#include "renderer/VertexArray.h"
-
class CCamera;
+class CMatrix3D;
class CTerrain;
class CMiniMap : public IGUIObject
diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp
index a4887f0c80..167ead6f69 100644
--- a/source/ps/CConsole.cpp
+++ b/source/ps/CConsole.cpp
@@ -27,8 +27,9 @@
#include "graphics/FontMetrics.h"
#include "graphics/ShaderManager.h"
#include "graphics/TextRenderer.h"
-#include "gui/GUIutil.h"
+#include "gui/CGUI.h"
#include "gui/GUIManager.h"
+#include "gui/GUIMatrix.h"
#include "lib/ogl.h"
#include "lib/sysdep/clipboard.h"
#include "lib/timer.h"
diff --git a/source/ps/ProfileViewer.cpp b/source/ps/ProfileViewer.cpp
index 3e71454054..74e698f6d6 100644
--- a/source/ps/ProfileViewer.cpp
+++ b/source/ps/ProfileViewer.cpp
@@ -22,23 +22,23 @@
#include "precompiled.h"
-#include
-#include
-
#include "ProfileViewer.h"
#include "graphics/FontMetrics.h"
-#include "gui/GUIutil.h"
#include "graphics/ShaderManager.h"
#include "graphics/TextRenderer.h"
+#include "gui/GUIMatrix.h"
+#include "lib/external_libraries/libsdl.h"
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "ps/Hotkey.h"
#include "ps/Profile.h"
-#include "lib/external_libraries/libsdl.h"
#include "renderer/Renderer.h"
#include "scriptinterface/ScriptInterface.h"
+#include
+#include
+
extern int g_xres, g_yres;
struct CProfileViewerInternals
diff --git a/source/renderer/ShadowMap.cpp b/source/renderer/ShadowMap.cpp
index 2ad9027989..d7eba2d6b9 100644
--- a/source/renderer/ShadowMap.cpp
+++ b/source/renderer/ShadowMap.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -21,24 +21,21 @@
#include "precompiled.h"
-#include "gui/GUIutil.h"
-#include "lib/bits.h"
-#include "lib/ogl.h"
-#include "ps/CLogger.h"
-#include "ps/ConfigDB.h"
-#include "ps/Profile.h"
+#include "ShadowMap.h"
#include "graphics/LightEnv.h"
#include "graphics/ShaderManager.h"
-
+#include "gui/GUIMatrix.h"
+#include "lib/bits.h"
+#include "lib/ogl.h"
#include "maths/BoundingBoxAligned.h"
#include "maths/Brush.h"
#include "maths/MathUtil.h"
#include "maths/Matrix3D.h"
-
+#include "ps/CLogger.h"
+#include "ps/ConfigDB.h"
+#include "ps/Profile.h"
#include "renderer/Renderer.h"
-#include "renderer/ShadowMap.h"
-
///////////////////////////////////////////////////////////////////////////////////////////////////
// ShadowMap implementation