Browse Source

Move `UiFlags` and `UiPanels` into their own files

The first breaks circular dependency between `DiabloUI` and `text_render`.
The latter one moves `UiPanels` to a more appropriate place.
pull/3611/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
c57644970f
  1. 51
      Source/DiabloUI/ui_flags.hpp
  2. 53
      Source/DiabloUI/ui_item.h
  3. 1
      Source/control.cpp
  4. 2
      Source/control.h
  5. 1
      Source/controls/modifier_hints.cpp
  6. 1
      Source/controls/plrctrls.cpp
  7. 1
      Source/controls/touch/renderers.cpp
  8. 3
      Source/debug.cpp
  9. 3
      Source/engine/render/text_render.hpp
  10. 1
      Source/error.cpp
  11. 1
      Source/gmenu.cpp
  12. 1
      Source/help.cpp
  13. 2
      Source/inv.cpp
  14. 2
      Source/items.cpp
  15. 2
      Source/items.h
  16. 1
      Source/minitext.cpp
  17. 1
      Source/objects.cpp
  18. 1
      Source/options.cpp
  19. 2
      Source/panels/charpanel.cpp
  20. 3
      Source/panels/spell_book.cpp
  21. 2
      Source/panels/spell_list.cpp
  22. 13
      Source/panels/ui_panels.hpp
  23. 1
      Source/plrmsg.cpp
  24. 2
      Source/quests.cpp
  25. 1
      Source/scrollrt.cpp
  26. 1
      Source/stores.h
  27. 1
      Source/utils/enum_traits.h
  28. 1
      Source/utils/language.cpp

51
Source/DiabloUI/ui_flags.hpp

@ -0,0 +1,51 @@
#pragma once
#include "utils/enum_traits.h"
namespace devilution {
enum class UiFlags {
// clang-format off
None = 0,
FontSize12 = 1 << 0,
FontSize24 = 1 << 1,
FontSize30 = 1 << 2,
FontSize42 = 1 << 3,
FontSize46 = 1 << 4,
FontSizeDialog = 1 << 5,
ColorUiGold = 1 << 6,
ColorUiSilver = 1 << 7,
ColorUiGoldDark = 1 << 8,
ColorUiSilverDark = 1 << 9,
ColorDialogWhite = 1 << 10,
ColorDialogYellow = 1 << 11,
ColorGold = 1 << 12,
ColorBlack = 1 << 13,
ColorWhite = 1 << 14,
ColorWhitegold = 1 << 15,
ColorRed = 1 << 16,
ColorBlue = 1 << 17,
ColorButtonface = 1 << 18,
ColorButtonpushed = 1 << 19,
AlignCenter = 1 << 20,
AlignRight = 1 << 21,
VerticalCenter = 1 << 22,
KerningFitSpacing = 1 << 23,
ElementDisabled = 1 << 24,
ElementHidden = 1 << 25,
PentaCursor = 1 << 26,
TextCursor = 1 << 27,
/** @brief Ensures that the if current element is active that the next element is also visible. */
NeedsNextElement = 1 << 28,
// clang-format on
};
use_enum_as_flags(UiFlags);
} // namespace devilution

53
Source/DiabloUI/ui_item.h

@ -6,6 +6,7 @@
#include <vector>
#include "DiabloUI/art.h"
#include "DiabloUI/ui_flags.hpp"
#include "utils/enum_traits.h"
#include "utils/stubs.h"
@ -22,58 +23,6 @@ enum class UiType {
Edit,
};
enum class UiFlags {
// clang-format off
None = 0,
FontSize12 = 1 << 0,
FontSize24 = 1 << 1,
FontSize30 = 1 << 2,
FontSize42 = 1 << 3,
FontSize46 = 1 << 4,
FontSizeDialog = 1 << 5,
ColorUiGold = 1 << 6,
ColorUiSilver = 1 << 7,
ColorUiGoldDark = 1 << 8,
ColorUiSilverDark = 1 << 9,
ColorDialogWhite = 1 << 10,
ColorDialogYellow = 1 << 11,
ColorGold = 1 << 12,
ColorBlack = 1 << 13,
ColorWhite = 1 << 14,
ColorWhitegold = 1 << 15,
ColorRed = 1 << 16,
ColorBlue = 1 << 17,
ColorButtonface = 1 << 18,
ColorButtonpushed = 1 << 19,
AlignCenter = 1 << 20,
AlignRight = 1 << 21,
VerticalCenter = 1 << 22,
KerningFitSpacing = 1 << 23,
ElementDisabled = 1 << 24,
ElementHidden = 1 << 25,
PentaCursor = 1 << 26,
TextCursor = 1 << 27,
/** @brief Ensures that the if current element is active that the next element is also visible. */
NeedsNextElement = 1 << 28,
// clang-format on
};
use_enum_as_flags(UiFlags);
enum class UiPanels {
Main,
Quest,
Character,
Spell,
Inventory,
};
class UiItemBase {
public:
UiItemBase(UiType type, SDL_Rect rect, UiFlags flags)

1
Source/control.cpp

@ -13,7 +13,6 @@
#include "DiabloUI/art.h"
#include "DiabloUI/art_draw.h"
#include "DiabloUI/diabloui.h"
#include "automap.h"
#include "controls/keymapper.hpp"
#include "cursor.h"

2
Source/control.h

@ -7,10 +7,12 @@
#include <cstdint>
#include "DiabloUI/ui_flags.hpp"
#include "engine.h"
#include "engine/point.hpp"
#include "engine/rectangle.hpp"
#include "engine/render/text_render.hpp"
#include "panels/ui_panels.hpp"
#include "spelldat.h"
#include "spells.h"
#include "utils/stdcompat/optional.hpp"

1
Source/controls/modifier_hints.cpp

@ -2,6 +2,7 @@
#include <cstddef>
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "controls/controller.h"
#include "controls/game_controls.h"

1
Source/controls/plrctrls.cpp

@ -20,6 +20,7 @@
#include "minitext.h"
#include "missiles.h"
#include "panels/spell_list.hpp"
#include "panels/ui_panels.hpp"
#include "stores.h"
#include "towners.h"
#include "trigs.h"

1
Source/controls/touch/renderers.cpp

@ -9,6 +9,7 @@
#include "init.h"
#include "inv.h"
#include "minitext.h"
#include "panels/ui_panels.hpp"
#include "stores.h"
#include "towners.h"
#include "utils/sdl_compat.h"

3
Source/debug.cpp

@ -8,6 +8,8 @@
#include <sstream>
#include <fmt/format.h>
#include "debug.h"
#include "automap.h"
@ -25,6 +27,7 @@
#include "spells.h"
#include "towners.h"
#include "utils/language.h"
#include "utils/log.hpp"
namespace devilution {

3
Source/engine/render/text_render.hpp

@ -6,12 +6,13 @@
#pragma once
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
#include <SDL.h>
#include "DiabloUI/ui_item.h"
#include "DiabloUI/ui_flags.hpp"
#include "engine.h"
#include "engine/cel_sprite.hpp"
#include "engine/rectangle.hpp"

1
Source/error.cpp

@ -8,6 +8,7 @@
#include "error.h"
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "engine/render/cel_render.hpp"
#include "engine/render/text_render.hpp"

1
Source/gmenu.cpp

@ -5,6 +5,7 @@
*/
#include "gmenu.h"
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "controls/axis_direction.h"
#include "controls/controller_motion.h"

1
Source/help.cpp

@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "engine/render/text_render.hpp"
#include "init.h"

2
Source/inv.cpp

@ -8,6 +8,7 @@
#include <algorithm>
#include <fmt/format.h>
#include "DiabloUI/ui_flags.hpp"
#include "controls/plrctrls.h"
#include "cursor.h"
#include "engine/cel_sprite.hpp"
@ -19,6 +20,7 @@
#include "inv_iterators.hpp"
#include "minitext.h"
#include "options.h"
#include "panels/ui_panels.hpp"
#include "plrmsg.h"
#include "stores.h"
#include "town.h"

2
Source/items.cpp

@ -15,6 +15,7 @@
#include <fmt/format.h>
#include "DiabloUI/ui_flags.hpp"
#include "cursor.h"
#include "doom.h"
#include "dx.h"
@ -28,6 +29,7 @@
#include "lighting.h"
#include "missiles.h"
#include "options.h"
#include "panels/ui_panels.hpp"
#include "player.h"
#include "stores.h"
#include "town.h"

2
Source/items.h

@ -7,7 +7,7 @@
#include <cstdint>
#include "DiabloUI/ui_item.h"
#include "DiabloUI/ui_flags.hpp"
#include "engine.h"
#include "engine/animationinfo.h"
#include "engine/point.hpp"

1
Source/minitext.cpp

@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "dx.h"
#include "engine.h"

1
Source/objects.cpp

@ -7,6 +7,7 @@
#include <climits>
#include <cstdint>
#include "DiabloUI/ui_flags.hpp"
#include "automap.h"
#include "control.h"
#include "cursor.h"

1
Source/options.cpp

@ -31,6 +31,7 @@
#include "qol/xpbar.h"
#include "utils/file_util.h"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/paths.h"
#include "utils/utf8.hpp"

2
Source/panels/charpanel.cpp

@ -5,10 +5,10 @@
#include "DiabloUI/art.h"
#include "DiabloUI/art_draw.h"
#include "control.h"
#include "engine/render/cel_render.hpp"
#include "engine/render/text_render.hpp"
#include "panels/ui_panels.hpp"
#include "player.h"
#include "utils/display.h"
#include "utils/language.h"

3
Source/panels/spell_book.cpp

@ -1,5 +1,7 @@
#include "panels/spell_book.hpp"
#include <fmt/format.h>
#include "control.h"
#include "engine/cel_sprite.hpp"
#include "engine/load_cel.hpp"
@ -9,6 +11,7 @@
#include "init.h"
#include "missiles.h"
#include "panels/spell_icons.hpp"
#include "panels/ui_panels.hpp"
#include "player.h"
#include "spelldat.h"
#include "utils/language.h"

2
Source/panels/spell_list.cpp

@ -1,5 +1,7 @@
#include "panels/spell_list.hpp"
#include <fmt/format.h>
#include "control.h"
#include "controls/keymapper.hpp"
#include "engine.h"

13
Source/panels/ui_panels.hpp

@ -0,0 +1,13 @@
#pragma once
namespace devilution {
enum class UiPanels {
Main,
Quest,
Character,
Spell,
Inventory,
};
} // namespace devilution

1
Source/plrmsg.cpp

@ -7,6 +7,7 @@
#include <fmt/format.h>
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "engine/render/text_render.hpp"
#include "inv.h"

2
Source/quests.cpp

@ -7,6 +7,7 @@
#include <fmt/format.h>
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "cursor.h"
#include "engine/load_file.hpp"
@ -19,6 +20,7 @@
#include "missiles.h"
#include "monster.h"
#include "options.h"
#include "panels/ui_panels.hpp"
#include "stores.h"
#include "towners.h"
#include "trigs.h"

1
Source/scrollrt.cpp

@ -4,6 +4,7 @@
* Implementation of functionality for rendering the dungeons, monsters and calling other render routines.
*/
#include "DiabloUI/ui_flags.hpp"
#include "automap.h"
#include "controls/touch/renderers.h"
#include "cursor.h"

1
Source/stores.h

@ -5,6 +5,7 @@
*/
#pragma once
#include "DiabloUI/ui_flags.hpp"
#include "control.h"
#include "engine.h"
#include "engine/cel_sprite.hpp"

1
Source/utils/enum_traits.h

@ -6,6 +6,7 @@
#pragma once
#include <cstddef>
#include <type_traits>
namespace devilution {

1
Source/utils/language.cpp

@ -8,6 +8,7 @@
#include "engine/assets.hpp"
#include "options.h"
#include "utils/file_util.h"
#include "utils/log.hpp"
#include "utils/paths.h"
#include "utils/stdcompat/string_view.hpp"

Loading…
Cancel
Save