From bc1e6762c95053aa3e9be90b566db23875052fb2 Mon Sep 17 00:00:00 2001 From: Vsevolod Kremianskii Date: Mon, 21 Jun 2021 08:45:32 +0700 Subject: [PATCH] Use forward declaration in libgui --- src/engine/engine.cpp | 3 +++ src/engine/game/game.cpp | 1 + src/engine/graphics/font.h | 12 ++-------- src/engine/graphics/types.h | 10 ++++++++ src/engine/gui/control/control.cpp | 3 +++ src/engine/gui/control/control.h | 20 ++++++++++++---- src/engine/gui/control/imagebutton.cpp | 4 ++++ src/engine/gui/control/listbox.cpp | 2 ++ src/engine/gui/control/progressbar.cpp | 5 ++++ src/engine/gui/control/scrollbar.cpp | 4 ++++ src/engine/gui/gui.cpp | 6 +++++ src/engine/gui/gui.h | 33 ++++++++++++++++---------- src/engine/gui/scenebuilder.cpp | 1 + src/engine/gui/scenebuilder.h | 17 +++++++++---- 14 files changed, 91 insertions(+), 30 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 1d4291b0..1b84fb01 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -22,13 +22,16 @@ #include "game/game.h" #include "graphics/context.h" #include "graphics/features.h" +#include "graphics/fonts.h" #include "graphics/lip/lips.h" #include "graphics/materials.h" +#include "graphics/mesh/meshes.h" #include "graphics/model/models.h" #include "graphics/pbribl.h" #include "graphics/renderbuffer.h" #include "graphics/services.h" #include "graphics/walkmesh/walkmeshes.h" +#include "graphics/window.h" #include "resource/resourceprovider.h" #include "resource/services.h" #include "scene/services.h" diff --git a/src/engine/game/game.cpp b/src/engine/game/game.cpp index ddef4ac3..57e2d8f8 100644 --- a/src/engine/game/game.cpp +++ b/src/engine/game/game.cpp @@ -26,6 +26,7 @@ #include "../graphics/pbribl.h" #include "../graphics/renderbuffer.h" #include "../graphics/walkmesh/walkmeshes.h" +#include "../graphics/window.h" #include "../scene/pipeline/world.h" #include "../video/bikreader.h" diff --git a/src/engine/graphics/font.h b/src/engine/graphics/font.h index a8627c06..bdf6f806 100644 --- a/src/engine/graphics/font.h +++ b/src/engine/graphics/font.h @@ -17,20 +17,12 @@ #pragma once +#include "types.h" + namespace reone { namespace graphics { -enum class TextGravity { - LeftCenter, - CenterBottom, - CenterCenter, - CenterTop, - RightBottom, - RightCenter, - RightTop -}; - class Context; class Meshes; class Shaders; diff --git a/src/engine/graphics/types.h b/src/engine/graphics/types.h index 20e04013..43079309 100644 --- a/src/engine/graphics/types.h +++ b/src/engine/graphics/types.h @@ -96,6 +96,16 @@ enum class BlendMode { Lighten }; +enum class TextGravity { + LeftCenter, + CenterBottom, + CenterCenter, + CenterTop, + RightBottom, + RightCenter, + RightTop +}; + struct TextureUnits { static constexpr int diffuseMap { 0 }; static constexpr int lightmap { 1 }; diff --git a/src/engine/gui/control/control.cpp b/src/engine/gui/control/control.cpp index be35510e..b6bc415d 100644 --- a/src/engine/gui/control/control.cpp +++ b/src/engine/gui/control/control.cpp @@ -23,10 +23,13 @@ #include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/renderbuffer.h" +#include "../../graphics/services.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/texture/textures.h" #include "../../graphics/textutil.h" #include "../../graphics/window.h" +#include "../../resource/gffstruct.h" +#include "../../resource/services.h" #include "../../resource/strings.h" #include "../gui.h" diff --git a/src/engine/gui/control/control.h b/src/engine/gui/control/control.h index 7b7c02dc..4a99bda9 100644 --- a/src/engine/gui/control/control.h +++ b/src/engine/gui/control/control.h @@ -17,18 +17,30 @@ #pragma once -#include "../../graphics/font.h" -#include "../../graphics/framebuffer.h" #include "../../graphics/texture/texture.h" -#include "../../resource/format/gffreader.h" -#include "../../scene/node/model.h" +#include "../../graphics/types.h" #include "../../scene/pipeline/control.h" #include "../../scene/scenegraph.h" + #include "../types.h" namespace reone { +namespace resource { + +class GffStruct; + +} + +namespace graphics { + +class Font; +class Texture; + +} + namespace gui { + class GUI; /** diff --git a/src/engine/gui/control/imagebutton.cpp b/src/engine/gui/control/imagebutton.cpp index cf2701aa..42c3378e 100644 --- a/src/engine/gui/control/imagebutton.cpp +++ b/src/engine/gui/control/imagebutton.cpp @@ -22,6 +22,10 @@ #include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/renderbuffer.h" +#include "../../graphics/services.h" +#include "../../graphics/shader/shaders.h" +#include "../../graphics/texture/texture.h" +#include "../../graphics/window.h" #include "../gui.h" diff --git a/src/engine/gui/control/listbox.cpp b/src/engine/gui/control/listbox.cpp index b94ab16a..cd5ada8a 100644 --- a/src/engine/gui/control/listbox.cpp +++ b/src/engine/gui/control/listbox.cpp @@ -18,10 +18,12 @@ #include "listbox.h" #include "../../common/log.h" +#include "../../graphics/font.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/renderbuffer.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/textutil.h" +#include "../../resource/gffstruct.h" #include "../../resource/resources.h" #include "../gui.h" diff --git a/src/engine/gui/control/progressbar.cpp b/src/engine/gui/control/progressbar.cpp index 118f438c..0e157c80 100644 --- a/src/engine/gui/control/progressbar.cpp +++ b/src/engine/gui/control/progressbar.cpp @@ -21,7 +21,12 @@ #include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/renderbuffer.h" +#include "../../graphics/services.h" +#include "../../graphics/shader/shaders.h" +#include "../../graphics/texture/texture.h" #include "../../graphics/texture/textures.h" +#include "../../graphics/window.h" +#include "../../resource/gffstruct.h" #include "../gui.h" diff --git a/src/engine/gui/control/scrollbar.cpp b/src/engine/gui/control/scrollbar.cpp index 2a5b9b0b..16ab97fa 100644 --- a/src/engine/gui/control/scrollbar.cpp +++ b/src/engine/gui/control/scrollbar.cpp @@ -21,8 +21,12 @@ #include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/renderbuffer.h" +#include "../../graphics/services.h" #include "../../graphics/shader/shaders.h" +#include "../../graphics/texture/texture.h" #include "../../graphics/texture/textures.h" +#include "../../graphics/window.h" +#include "../../resource/gffstruct.h" #include "../../resource/resources.h" #include "../gui.h" diff --git a/src/engine/gui/gui.cpp b/src/engine/gui/gui.cpp index 3c0ff461..ddaf9d5a 100644 --- a/src/engine/gui/gui.cpp +++ b/src/engine/gui/gui.cpp @@ -17,13 +17,19 @@ #include "gui.h" +#include "../common/guardutil.h" #include "../common/log.h" #include "../graphics/context.h" #include "../graphics/mesh/mesh.h" #include "../graphics/mesh/meshes.h" +#include "../graphics/services.h" #include "../graphics/shader/shaders.h" +#include "../graphics/texture/texture.h" #include "../graphics/texture/textures.h" +#include "../graphics/window.h" +#include "../resource/gffstruct.h" #include "../resource/resources.h" +#include "../resource/services.h" using namespace std; using namespace std::placeholders; diff --git a/src/engine/gui/gui.h b/src/engine/gui/gui.h index 1117e49e..d56cb62b 100644 --- a/src/engine/gui/gui.h +++ b/src/engine/gui/gui.h @@ -17,23 +17,32 @@ #pragma once -#include "../audio/services.h" -#include "../graphics/fonts.h" -#include "../graphics/mesh/meshes.h" -#include "../graphics/services.h" -#include "../graphics/shader/shaders.h" -#include "../graphics/texture/textures.h" -#include "../graphics/window.h" -#include "../resource/format/gffreader.h" -#include "../resource/resources.h" -#include "../resource/services.h" -#include "../resource/strings.h" -#include "../resource/types.h" +#include "../graphics/options.h" #include "control/control.h" namespace reone { +namespace resource { + +class GffStruct; +class ResourceServices; + +} + +namespace audio { + +class AudioServices; + +} + +namespace graphics { + +class GraphicsServices; +class Texture; + +} + namespace gui { constexpr int kDefaultResolutionX = 640; diff --git a/src/engine/gui/scenebuilder.cpp b/src/engine/gui/scenebuilder.cpp index 1958f06b..4dd424f9 100644 --- a/src/engine/gui/scenebuilder.cpp +++ b/src/engine/gui/scenebuilder.cpp @@ -19,6 +19,7 @@ #include "../scene/node/camera.h" #include "../scene/node/mesh.h" +#include "../scene/node/model.h" #include "../scene/scenegraph.h" using namespace std; diff --git a/src/engine/gui/scenebuilder.h b/src/engine/gui/scenebuilder.h index be236997..9a550192 100644 --- a/src/engine/gui/scenebuilder.h +++ b/src/engine/gui/scenebuilder.h @@ -18,13 +18,22 @@ #pragma once #include "../graphics/options.h" -#include "../graphics/services.h" - -#include "../scene/node/model.h" -#include "../scene/scenegraph.h" namespace reone { +namespace graphics { + +class GraphicsServices; + +} + +namespace scene { + +class ModelSceneNode; +class SceneGraph; + +} + namespace gui { /**