From a6d821e61060c41b39dd9f85cf3b068515f62665 Mon Sep 17 00:00:00 2001 From: Jordy Vieira Date: Sat, 12 Sep 2020 12:21:17 -0300 Subject: [PATCH] Add missing headers --- apps/freeablo/fagui/menu/menuscreen.h | 111 +++++++++++----------- apps/freeablo/farender/fontinfo.h | 129 +++++++++++++------------- 2 files changed, 121 insertions(+), 119 deletions(-) diff --git a/apps/freeablo/fagui/menu/menuscreen.h b/apps/freeablo/fagui/menu/menuscreen.h index 001471e58..b55c0df1b 100644 --- a/apps/freeablo/fagui/menu/menuscreen.h +++ b/apps/freeablo/fagui/menu/menuscreen.h @@ -1,56 +1,57 @@ #pragma once -#include -#include -#include - -struct nk_context; - -namespace Engine -{ - enum class KeyboardInputAction; -} - -namespace FAGui -{ - class MenuHandler; - enum class MenuFontColor; - - class MenuScreen - { - protected: - enum class [[nodiscard]] DrawFunctionResult{ - executeAction, - setActive, - noAction, - }; - enum class [[nodiscard]] ActionResult{ - stopDrawing, - continueDrawing, - }; - class MenuItem - { - public: - std::function drawFunction; - std::function action; - }; - - public: - explicit MenuScreen(MenuHandler& menu); - virtual ~MenuScreen(); - virtual void update(nk_context* ctx) = 0; - void notify(Engine::KeyboardInputAction action); - - protected: - static void menuText(nk_context* ctx, const char* text, MenuFontColor color, int fontSize, uint32_t textAlignment); - ActionResult drawMenuItems(nk_context* ctx); - ActionResult executeActive(); - ActionResult applyInputAction(Engine::KeyboardInputAction action); - - protected: - MenuHandler& mMenuHandler; - std::function mRejectAction; - std::vector mMenuItems; - std::queue mInputActions; - int mActiveItemIndex = 0; - }; -} +#include +#include +#include +#include + +struct nk_context; + +namespace Engine +{ + enum class KeyboardInputAction; +} + +namespace FAGui +{ + class MenuHandler; + enum class MenuFontColor; + + class MenuScreen + { + protected: + enum class [[nodiscard]] DrawFunctionResult{ + executeAction, + setActive, + noAction, + }; + enum class [[nodiscard]] ActionResult{ + stopDrawing, + continueDrawing, + }; + class MenuItem + { + public: + std::function drawFunction; + std::function action; + }; + + public: + explicit MenuScreen(MenuHandler& menu); + virtual ~MenuScreen(); + virtual void update(nk_context* ctx) = 0; + void notify(Engine::KeyboardInputAction action); + + protected: + static void menuText(nk_context* ctx, const char* text, MenuFontColor color, int fontSize, uint32_t textAlignment); + ActionResult drawMenuItems(nk_context* ctx); + ActionResult executeActive(); + ActionResult applyInputAction(Engine::KeyboardInputAction action); + + protected: + MenuHandler& mMenuHandler; + std::function mRejectAction; + std::vector mMenuItems; + std::queue mInputActions; + int mActiveItemIndex = 0; + }; +} diff --git a/apps/freeablo/farender/fontinfo.h b/apps/freeablo/farender/fontinfo.h index 1fe06d6aa..508ec3ff3 100644 --- a/apps/freeablo/farender/fontinfo.h +++ b/apps/freeablo/farender/fontinfo.h @@ -1,65 +1,66 @@ -#pragma once -#include "fa_nuklear.h" +#pragma once +#include "fa_nuklear.h" #include - -namespace DiabloExe -{ - class FontData; -} - -namespace FARender -{ - class CelFontInfo - { - private: - using self = CelFontInfo; - - public: - static const int charCount = 256; - nk_user_font nkFont; - - private: - std::array widthPx; - std::array uvLeft, uvWidth; - int mSpacing; - - private: - void initByFontData(const DiabloExe::FontData& fontData, int textureWidthPx, int spacing); - static float getWidth(nk_handle handle, float h, const char* s, int len); - static void queryGlyph(nk_handle handle, float font_height, struct nk_user_font_glyph* glyph, nk_rune codepoint, nk_rune next_codepoint); - friend class Renderer; - }; - - struct PcxFontInitData - { - int32_t fontSize; - int32_t textureWidth; - int32_t textureHeight; - int32_t spacingX; - int32_t spacingY; - enum class LayoutOrder - { - horizontal, - vertical - } fontDirection; - }; - - class PcxFontInfo - { - private: - using self = PcxFontInfo; - - public: - nk_user_font nkFont; - - private: - static const int charCount = 256; - std::array mGlyphs; - - private: - void init(const std::string& binPath, const PcxFontInitData& fontInitData); - static float getWidth(nk_handle handle, float h, const char* s, int len); - static void queryGlyph(nk_handle handle, float font_height, struct nk_user_font_glyph* glyph, nk_rune codepoint, nk_rune next_codepoint); - friend class Renderer; - }; -} +#include + +namespace DiabloExe +{ + class FontData; +} + +namespace FARender +{ + class CelFontInfo + { + private: + using self = CelFontInfo; + + public: + static const int charCount = 256; + nk_user_font nkFont; + + private: + std::array widthPx; + std::array uvLeft, uvWidth; + int mSpacing; + + private: + void initByFontData(const DiabloExe::FontData& fontData, int textureWidthPx, int spacing); + static float getWidth(nk_handle handle, float h, const char* s, int len); + static void queryGlyph(nk_handle handle, float font_height, struct nk_user_font_glyph* glyph, nk_rune codepoint, nk_rune next_codepoint); + friend class Renderer; + }; + + struct PcxFontInitData + { + int32_t fontSize; + int32_t textureWidth; + int32_t textureHeight; + int32_t spacingX; + int32_t spacingY; + enum class LayoutOrder + { + horizontal, + vertical + } fontDirection; + }; + + class PcxFontInfo + { + private: + using self = PcxFontInfo; + + public: + nk_user_font nkFont; + + private: + static const int charCount = 256; + std::array mGlyphs; + + private: + void init(const std::string& binPath, const PcxFontInitData& fontInitData); + static float getWidth(nk_handle handle, float h, const char* s, int len); + static void queryGlyph(nk_handle handle, float font_height, struct nk_user_font_glyph* glyph, nk_rune codepoint, nk_rune next_codepoint); + friend class Renderer; + }; +}