2022-08-28 09:40:27 -04:00
|
|
|
#pragma once
|
|
|
|
|
2023-04-06 19:50:37 -04:00
|
|
|
#include <SDL.h>
|
2022-05-09 01:50:09 -04:00
|
|
|
|
2022-08-22 02:15:25 -04:00
|
|
|
#include <bgfx/bgfx.h>
|
|
|
|
|
2022-08-18 12:17:43 -04:00
|
|
|
#include <Common.h>
|
|
|
|
#include <Environment.h>
|
2022-05-09 01:50:09 -04:00
|
|
|
|
|
|
|
namespace ADVect::Graphics {
|
2022-08-27 03:04:39 -04:00
|
|
|
bool Init(u16 width, u16 height);
|
2022-08-21 16:24:13 -04:00
|
|
|
void Shutdown();
|
2022-08-22 02:15:25 -04:00
|
|
|
|
|
|
|
enum MarkupStyle {
|
|
|
|
TEXT_NONE = 0,
|
|
|
|
TEXT_BOLD = 1 << 0,
|
|
|
|
TEXT_ITALIC = 1 << 1,
|
|
|
|
TEXT_UNDERLINE = 1 << 2,
|
|
|
|
TEXT_STRIKETHROUGH = 1 << 3,
|
|
|
|
TEXT_OVERLINE = 1 << 4
|
|
|
|
};
|
|
|
|
|
2022-08-27 03:04:39 -04:00
|
|
|
struct ImageTexture {
|
|
|
|
i32 w, h, channels;
|
|
|
|
u8* buffer;
|
|
|
|
bgfx::TextureHandle tx;
|
|
|
|
};
|
|
|
|
ImageTexture* GetImageTextureFromFile(const std::string& file);
|
|
|
|
|
|
|
|
void DrawTexture(const bgfx::TextureHandle& tex, i32 pos_x, i32 pos_y, u32 w, u32 h, u64 state, const bgfx::ProgramHandle& pg);
|
|
|
|
void DrawTextureImage(const bgfx::TextureHandle& tex, i32 pos_x, i32 pos_y, u32 w, u32 h);
|
|
|
|
void DrawTextureImage(const ImageTexture& img, i32 pos_x, i32 pos_y);
|
2022-08-28 09:40:27 -04:00
|
|
|
void DrawTextureImageAlpha(const ImageTexture& img, i32 pos_x, i32 pos_y, f32 alpha);
|
2022-08-22 02:15:25 -04:00
|
|
|
void DrawTextureStencilAlpha(const bgfx::TextureHandle& tex, i32 pos_x, i32 pos_y, u32 w, u32 h);
|
2023-04-06 19:56:40 -04:00
|
|
|
|
|
|
|
template <bool DoRender = true, bool Walk = true>
|
|
|
|
void RenderGlyph(NVL::Char c, std::conditional_t<Walk, i32&, i32> pos_x, std::conditional_t<Walk, i32&, i32> pos_y, u32 col, u32 style_flags);
|
|
|
|
template <bool DoRender = true, bool Walk = true>
|
|
|
|
void RenderString(const NVL::String& s, std::conditional_t<Walk, i32&, i32> pos_x, std::conditional_t<Walk, i32&, i32> pos_y, u32 col, u32 style_flags);
|
|
|
|
template <bool DoRender = true, bool Walk = true>
|
|
|
|
void RenderString(NVL::String::const_iterator cbegin, NVL::String::const_iterator cend, std::conditional_t<Walk, i32&, i32> pos_x, std::conditional_t<Walk, i32&, i32> pos_y, u32 col, u32 style_flags);
|
|
|
|
|
|
|
|
i32 RenderSubstringBox(const NVL::String& s, i32& pos_x, i32& pos_y, i32 reset_x, u32 w, u32 col, u32 style_flags = TEXT_NONE, size_t s_end = NVL::String::npos);
|
|
|
|
void RenderSubstringMarkupBox(const NVL::Environment::MarkupString& ms, i32 pos_x, i32 pos_y, u32 w, u32 col, size_t end = NVL::String::npos);
|
2022-05-09 01:50:09 -04:00
|
|
|
}
|