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.
This commit is contained in:
Gleb Mazovetskiy 2021-11-25 10:17:30 +00:00 committed by Anders Jenbo
commit c57644970f
28 changed files with 99 additions and 56 deletions

View file

@ -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

View file

@ -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)

View file

@ -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"

View file

@ -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"

View file

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

View file

@ -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"

View file

@ -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"

View file

@ -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 {

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

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

View file

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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

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

View file

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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

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

View file

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

View file

@ -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"