mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Move GetDefaultGuiMatrix to a separate file.
The function was located in the wrong file, because it is not logically related to IGUIObject settings. The separate file allows the various users to include it without including the GUIRenderer. This was SVN commit r22605.
This commit is contained in:
parent
85a622b13a
commit
da4e601d8f
11 changed files with 89 additions and 43 deletions
|
|
@ -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"
|
||||
|
|
|
|||
42
source/gui/GUIMatrix.cpp
Normal file
42
source/gui/GUIMatrix.cpp
Normal file
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
28
source/gui/GUIMatrix.h
Normal file
28
source/gui/GUIMatrix.h
Normal file
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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<typename T>
|
||||
CGUISetting<T>::CGUISetting(IGUIObject& pObject, const CStr& Name)
|
||||
|
|
@ -290,23 +286,6 @@ bool __ParseString<CGUISeries>(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 <typename T>
|
||||
PSRETURN GUI<T>::GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ GUI util
|
|||
|
||||
class CClientArea;
|
||||
class CGUIString;
|
||||
class CMatrix3D;
|
||||
template<typename T> class GUI;
|
||||
|
||||
class IGUISetting
|
||||
|
|
@ -109,9 +108,6 @@ private:
|
|||
template <typename T>
|
||||
bool __ParseString(const CStrW& Value, T& tOutput);
|
||||
|
||||
// Model-view-projection matrix with (0,0) in top-left of screen
|
||||
CMatrix3D GetDefaultGuiMatrix();
|
||||
|
||||
struct SGUIMessage;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
#include "gui/GUI.h"
|
||||
#include "renderer/VertexArray.h"
|
||||
|
||||
|
||||
class CCamera;
|
||||
class CMatrix3D;
|
||||
class CTerrain;
|
||||
|
||||
class CMiniMap : public IGUIObject
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -22,23 +22,23 @@
|
|||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
|
||||
#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 <algorithm>
|
||||
#include <ctime>
|
||||
|
||||
extern int g_xres, g_yres;
|
||||
|
||||
struct CProfileViewerInternals
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue