소스 검색

Moved Colors to a separate file, updated includes

Ivan Savenko 2 년 전
부모
커밋
3fef2a5e1f

+ 2 - 0
client/CMakeLists.txt

@@ -54,6 +54,7 @@ set(client_SRCS
 	render/CFadeAnimation.cpp
 	render/Canvas.cpp
 	render/ColorFilter.cpp
+	render/Colors.cpp
 	render/Graphics.cpp
 	render/IFont.cpp
 
@@ -161,6 +162,7 @@ set(client_HEADERS
 	render/CFadeAnimation.h
 	render/Canvas.h
 	render/ColorFilter.h
+	render/Colors.h
 	render/Graphics.h
 	render/ICursor.h
 	render/IFont.h

+ 1 - 0
client/CPlayerInterface.cpp

@@ -67,6 +67,7 @@
 #include "../lib/CGameState.h"
 #include "gui/NotificationHandler.h"
 #include "adventureMap/CInGameConsole.h"
+#include "renderSDL/SDL_Extensions.h"
 
 #include <SDL_events.h>
 

+ 1 - 0
client/adventureMap/CAdvMapInt.cpp

@@ -30,6 +30,7 @@
 #include "../gui/CGuiHandler.h"
 #include "../widgets/TextControls.h"
 #include "../widgets/Buttons.h"
+#include "../CMT.h"
 
 #include "../../CCallback.h"
 #include "../../lib/CConfigHandler.h"

+ 1 - 1
client/adventureMap/CInGameConsole.cpp

@@ -11,7 +11,7 @@
 #include "StdInc.h"
 #include "CInGameConsole.h"
 
-#include "../renderSDL/SDL_Extensions.h"
+#include "../render/Colors.h"
 #include "../CGameInfo.h"
 #include "../CMusicHandler.h"
 #include "../CPlayerInterface.h"

+ 1 - 0
client/adventureMap/CMinimap.cpp

@@ -17,6 +17,7 @@
 #include "../CGameInfo.h"
 #include "../CPlayerInterface.h"
 #include "../gui/CGuiHandler.h"
+#include "../render/Colors.h"
 #include "../renderSDL/SDL_PixelAccess.h"
 
 #include "../../CCallback.h"

+ 1 - 0
client/adventureMap/CResDataBar.cpp

@@ -12,6 +12,7 @@
 
 #include "../CGameInfo.h"
 #include "../CPlayerInterface.h"
+#include "../render/Colors.h"
 #include "../renderSDL/SDL_Extensions.h"
 #include "../gui/CGuiHandler.h"
 #include "../widgets/Images.h"

+ 1 - 0
client/adventureMap/mapHandler.cpp

@@ -13,6 +13,7 @@
 
 #include "../render/CAnimation.h"
 #include "../render/CFadeAnimation.h"
+#include "../render/Colors.h"
 #include "../renderSDL/SDL_Extensions.h"
 #include "../CGameInfo.h"
 #include "../render/Graphics.h"

+ 1 - 0
client/battle/BattleInterfaceClasses.cpp

@@ -33,6 +33,7 @@
 #include "../windows/CSpellWindow.h"
 #include "../render/CAnimation.h"
 #include "../adventureMap/CInGameConsole.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../CCallback.h"
 #include "../../lib/CStack.h"

+ 2 - 1
client/battle/BattleStacksController.cpp

@@ -26,8 +26,9 @@
 #include "../CMusicHandler.h"
 #include "../CGameInfo.h"
 #include "../gui/CGuiHandler.h"
-#include "../renderSDL/SDL_Extensions.h"
+#include "../render/Colors.h"
 #include "../render/Canvas.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../CCallback.h"
 #include "../../lib/spells/ISpellMechanics.h"

+ 1 - 0
client/battle/BattleWindow.cpp

@@ -28,6 +28,7 @@
 #include "../render/CAnimation.h"
 #include "../render/Canvas.h"
 #include "../adventureMap/CInGameConsole.h"
+#include "../CMT.h"
 
 #include "../../CCallback.h"
 #include "../../lib/CGeneralTextHandler.h"

+ 1 - 0
client/gui/CGuiHandler.cpp

@@ -15,6 +15,7 @@
 #include "CursorHandler.h"
 
 #include "../CGameInfo.h"
+#include "../render/Colors.h"
 #include "../renderSDL/SDL_Extensions.h"
 #include "../CMT.h"
 #include "../CPlayerInterface.h"

+ 18 - 17
client/mainmenu/CMainMenu.cpp

@@ -16,25 +16,9 @@
 #include "../lobby/CBonusSelection.h"
 #include "../lobby/CSelectionBase.h"
 #include "../lobby/CLobbyScreen.h"
-
-#include "../../lib/filesystem/Filesystem.h"
-#include "../../lib/filesystem/CCompressedStream.h"
-
 #include "../gui/CursorHandler.h"
-
-#include "../CGameInfo.h"
-#include "../../lib/CGeneralTextHandler.h"
-#include "../../lib/JsonNode.h"
-#include "../CMusicHandler.h"
-#include "../CVideoHandler.h"
-#include "../../lib/serializer/Connection.h"
-#include "../../lib/serializer/CTypeList.h"
-#include "../../lib/VCMIDirs.h"
-#include "../../lib/mapping/CMap.h"
+#include "../CMT.h"
 #include "../windows/GUIClasses.h"
-#include "../CPlayerInterface.h"
-#include "../../CCallback.h"
-#include "../Client.h"
 #include "../gui/CGuiHandler.h"
 #include "../widgets/CComponent.h"
 #include "../widgets/Buttons.h"
@@ -43,6 +27,23 @@
 #include "../widgets/TextControls.h"
 #include "../windows/InfoWindows.h"
 #include "../CServerHandler.h"
+
+#include "../CGameInfo.h"
+#include "../CMusicHandler.h"
+#include "../CVideoHandler.h"
+#include "../CPlayerInterface.h"
+#include "../Client.h"
+
+#include "../../CCallback.h"
+
+#include "../../lib/CGeneralTextHandler.h"
+#include "../../lib/JsonNode.h"
+#include "../../lib/serializer/Connection.h"
+#include "../../lib/serializer/CTypeList.h"
+#include "../../lib/filesystem/Filesystem.h"
+#include "../../lib/filesystem/CCompressedStream.h"
+#include "../../lib/VCMIDirs.h"
+#include "../../lib/mapping/CMap.h"
 #include "../../lib/CStopWatch.h"
 #include "../../lib/NetPacksLobby.h"
 #include "../../lib/CThreadHelper.h"

+ 1 - 0
client/mainmenu/CPrologEpilogVideo.cpp

@@ -16,6 +16,7 @@
 #include "../CVideoHandler.h"
 #include "../gui/CGuiHandler.h"
 #include "../widgets/TextControls.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../lib/mapping/CCampaignHandler.h"
 

+ 26 - 0
client/render/Colors.cpp

@@ -0,0 +1,26 @@
+/*
+ * IFont.cpp, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+#include "StdInc.h"
+#include "Colors.h"
+
+#include <SDL_pixels.h>
+
+const SDL_Color Colors::YELLOW = { 229, 215, 123, SDL_ALPHA_OPAQUE };
+const SDL_Color Colors::WHITE = { 255, 243, 222, SDL_ALPHA_OPAQUE };
+const SDL_Color Colors::METALLIC_GOLD = { 173, 142, 66, SDL_ALPHA_OPAQUE };
+const SDL_Color Colors::GREEN = { 0, 255, 0, SDL_ALPHA_OPAQUE };
+const SDL_Color Colors::ORANGE = { 232, 184, 32, SDL_ALPHA_OPAQUE };
+const SDL_Color Colors::BRIGHT_YELLOW = { 242, 226, 110, SDL_ALPHA_OPAQUE };
+const SDL_Color Colors::DEFAULT_KEY_COLOR = {0, 255, 255, SDL_ALPHA_OPAQUE};
+const SDL_Color Colors::RED = {255, 0, 0, SDL_ALPHA_OPAQUE};
+const SDL_Color Colors::PURPLE = {255, 75, 125, SDL_ALPHA_OPAQUE};
+const SDL_Color Colors::BLACK = {0, 0, 0, SDL_ALPHA_OPAQUE};
+const SDL_Color Colors::TRANSPARENCY = {0, 0, 0, SDL_ALPHA_TRANSPARENT};

+ 50 - 0
client/render/Colors.h

@@ -0,0 +1,50 @@
+/*
+ * ICursor.h, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+#pragma once
+
+struct SDL_Color;
+
+/**
+ * The colors class defines color constants of type SDL_Color.
+ */
+class Colors
+{
+public:
+	/** the h3 yellow color, typically used for headlines */
+	static const SDL_Color YELLOW;
+
+	/** the standard h3 white color */
+	static const SDL_Color WHITE;
+
+	/** the metallic gold color used mostly as a border around buttons */
+	static const SDL_Color METALLIC_GOLD;
+
+	/** green color used for in-game console */
+	static const SDL_Color GREEN;
+
+	/** the h3 orange color, used for blocked buttons */
+	static const SDL_Color ORANGE;
+
+	/** the h3 bright yellow color, used for selection border */
+	static const SDL_Color BRIGHT_YELLOW;
+
+	/** default key color for all 8 & 24 bit graphics */
+	static const SDL_Color DEFAULT_KEY_COLOR;
+
+	/// Selected creature card
+	static const SDL_Color RED;
+
+	/// Minimap border
+	static const SDL_Color PURPLE;
+
+	static const SDL_Color BLACK;
+
+	static const SDL_Color TRANSPARENCY;
+};

+ 2 - 1
client/renderSDL/CTrueTypeFont.cpp

@@ -10,7 +10,8 @@
 #include "StdInc.h"
 #include "CTrueTypeFont.h"
 
-#include "SDL_Extensions.h"
+#include "../render/Colors.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../lib/JsonNode.h"
 #include "../../lib/CGeneralTextHandler.h"

+ 2 - 1
client/renderSDL/CursorHardware.cpp

@@ -11,8 +11,9 @@
 #include "StdInc.h"
 #include "CursorHardware.h"
 
-#include "SDL_Extensions.h"
+#include "../render/Colors.h"
 #include "../render/IImage.h"
+#include "SDL_Extensions.h"
 
 #include <SDL_render.h>
 #include <SDL_events.h>

+ 2 - 2
client/renderSDL/CursorSoftware.cpp

@@ -11,9 +11,9 @@
 #include "StdInc.h"
 #include "CursorSoftware.h"
 
-#include "SDL_Extensions.h"
-
+#include "../render/Colors.h"
 #include "../render/IImage.h"
+#include "SDL_Extensions.h"
 
 #include <SDL_render.h>
 #include <SDL_events.h>

+ 1 - 12
client/renderSDL/SDL_Extensions.cpp

@@ -13,6 +13,7 @@
 #include "SDL_PixelAccess.h"
 
 #include "../render/Graphics.h"
+#include "../render/Colors.h"
 
 #include <SDL_render.h>
 
@@ -24,18 +25,6 @@
 #include "ios/utils.h"
 #endif
 
-const SDL_Color Colors::YELLOW = { 229, 215, 123, SDL_ALPHA_OPAQUE };
-const SDL_Color Colors::WHITE = { 255, 243, 222, SDL_ALPHA_OPAQUE };
-const SDL_Color Colors::METALLIC_GOLD = { 173, 142, 66, SDL_ALPHA_OPAQUE };
-const SDL_Color Colors::GREEN = { 0, 255, 0, SDL_ALPHA_OPAQUE };
-const SDL_Color Colors::ORANGE = { 232, 184, 32, SDL_ALPHA_OPAQUE };
-const SDL_Color Colors::BRIGHT_YELLOW = { 242, 226, 110, SDL_ALPHA_OPAQUE };
-const SDL_Color Colors::DEFAULT_KEY_COLOR = {0, 255, 255, SDL_ALPHA_OPAQUE};
-const SDL_Color Colors::RED = {255, 0, 0, SDL_ALPHA_OPAQUE};
-const SDL_Color Colors::PURPLE = {255, 75, 125, SDL_ALPHA_OPAQUE};
-const SDL_Color Colors::BLACK = {0, 0, 0, SDL_ALPHA_OPAQUE};
-const SDL_Color Colors::TRANSPARENCY = {0, 0, 0, SDL_ALPHA_TRANSPARENT};
-
 Rect CSDL_Ext::genRect(const int & hh, const int & ww, const int & xx, const int & yy)
 {
 	Rect ret;

+ 0 - 38
client/renderSDL/SDL_Extensions.h

@@ -32,44 +32,6 @@ class Point;
 
 VCMI_LIB_NAMESPACE_END
 
-/**
- * The colors class defines color constants of type SDL_Color.
- */
-class Colors
-{
-public:
-	/** the h3 yellow color, typically used for headlines */
-	static const SDL_Color YELLOW;
-
-	/** the standard h3 white color */
-	static const SDL_Color WHITE;
-
-	/** the metallic gold color used mostly as a border around buttons */
-	static const SDL_Color METALLIC_GOLD;
-
-	/** green color used for in-game console */
-	static const SDL_Color GREEN;
-
-	/** the h3 orange color, used for blocked buttons */
-	static const SDL_Color ORANGE;
-
-	/** the h3 bright yellow color, used for selection border */
-	static const SDL_Color BRIGHT_YELLOW;
-
-	/** default key color for all 8 & 24 bit graphics */
-	static const SDL_Color DEFAULT_KEY_COLOR;
-
-	/// Selected creature card
-	static const SDL_Color RED;
-
-	/// Minimap border
-	static const SDL_Color PURPLE;
-
-	static const SDL_Color BLACK;
-
-	static const SDL_Color TRANSPARENCY;
-};
-
 namespace CSDL_Ext
 {
 

+ 1 - 0
client/widgets/Buttons.cpp

@@ -21,6 +21,7 @@
 #include "../gui/CGuiHandler.h"
 #include "../windows/InfoWindows.h"
 #include "../render/CAnimation.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../lib/CConfigHandler.h"
 #include "../../lib/CGeneralTextHandler.h"

+ 1 - 1
client/widgets/Buttons.h

@@ -10,7 +10,7 @@
 #pragma once
 
 #include "../gui/CIntObject.h"
-#include "../renderSDL/SDL_Extensions.h"
+#include "../render/Colors.h"
 #include "../../lib/FunctionList.h"
 
 #include <SDL_pixels.h>

+ 1 - 0
client/widgets/CArtifactHolder.cpp

@@ -19,6 +19,7 @@
 #include "../windows/CHeroWindow.h"
 #include "../windows/CSpellWindow.h"
 #include "../windows/GUIClasses.h"
+#include "../renderSDL/SDL_Extensions.h"
 #include "../CPlayerInterface.h"
 #include "../CGameInfo.h"
 

+ 3 - 3
client/widgets/CGarrisonInt.cpp

@@ -14,11 +14,11 @@
 #include "TextControls.h"
 
 #include "../gui/CGuiHandler.h"
-
-#include "../CGameInfo.h"
-#include "../CPlayerInterface.h"
+#include "../renderSDL/SDL_Extensions.h"
 #include "../windows/CCreatureWindow.h"
 #include "../windows/GUIClasses.h"
+#include "../CGameInfo.h"
+#include "../CPlayerInterface.h"
 
 #include "../../CCallback.h"
 

+ 2 - 0
client/widgets/TextControls.cpp

@@ -17,6 +17,8 @@
 #include "../gui/CGuiHandler.h"
 #include "../windows/CMessage.h"
 #include "../adventureMap/CInGameConsole.h"
+#include "../renderSDL/SDL_Extensions.h"
+
 #include "../../lib/CGeneralTextHandler.h"
 
 #ifdef VCMI_ANDROID

+ 1 - 1
client/widgets/TextControls.h

@@ -11,7 +11,7 @@
 
 #include "../gui/CIntObject.h"
 #include "../gui/TextAlignment.h"
-#include "../renderSDL/SDL_Extensions.h"
+#include "../render/Colors.h"
 #include "../render/Graphics.h"
 #include "../../lib/FunctionList.h"
 

+ 1 - 0
client/windows/CCreatureWindow.cpp

@@ -22,6 +22,7 @@
 #include "../widgets/TextControls.h"
 #include "../widgets/ObjectLists.h"
 #include "../gui/CGuiHandler.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../CCallback.h"
 #include "../../lib/CStack.h"

+ 1 - 0
client/windows/CMessage.cpp

@@ -20,6 +20,7 @@
 #include "../widgets/TextControls.h"
 #include "../render/CAnimation.h"
 #include "../render/IImage.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include <SDL_surface.h>
 

+ 1 - 0
client/windows/CQuestLog.cpp

@@ -18,6 +18,7 @@
 #include "../adventureMap/CAdvMapInt.h"
 #include "../widgets/Buttons.h"
 #include "../adventureMap/CMinimap.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../CCallback.h"
 #include "../../lib/CArtHandler.h"

+ 1 - 0
client/windows/CSpellWindow.cpp

@@ -28,6 +28,7 @@
 #include "../widgets/TextControls.h"
 #include "../adventureMap/CAdvMapInt.h"
 #include "../render/CAnimation.h"
+#include "../renderSDL/SDL_Extensions.h"
 
 #include "../../CCallback.h"