Rise
The Vieneo Province
Loading...
Searching...
No Matches
TextHelper.h
Go to the documentation of this file.
1#pragma once
3#include <cstdarg>
5{
6public:
9 void End(){if(sprite)sprite->End();}
10 void SetInsertionPos(int left,int top){x=left;y=top;}
12 HRESULT DrawTextLine(const wchar_t* text)
13 {
14 if(!font)return E_UNEXPECTED;RECT rectangle{x,y,0,0};
15 const INT result=font->DrawTextW(sprite,text,-1,&rectangle,DT_NOCLIP,color);y+=height;return result ? S_OK : E_FAIL;
16 }
17 HRESULT DrawFormattedTextLine(const wchar_t* format,...)
18 {
19 wchar_t text[2048];va_list arguments;va_start(arguments,format);vswprintf_s(text,format,arguments);va_end(arguments);return DrawTextLine(text);
20 }
21private:
24 int height,x=0,y=0;
26};
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
INT DrawTextW(RenderSprite *sprite, const wchar_t *text, INT count, RECT *rectangle, DWORD flags, PackedColor color)
HRESULT Begin(DWORD flags)
Rendering::RenderFont * font
Definition TextHelper.h:22
void SetForegroundColor(Rendering::PackedColor value)
Definition TextHelper.h:11
void SetInsertionPos(int left, int top)
Definition TextHelper.h:10
HRESULT DrawTextLine(const wchar_t *text)
Definition TextHelper.h:12
RiseTextHelper(Rendering::RenderFont *font, Rendering::RenderSprite *sprite, int height)
Definition TextHelper.h:7
Rendering::RenderSprite * sprite
Definition TextHelper.h:23
HRESULT DrawFormattedTextLine(const wchar_t *format,...)
Definition TextHelper.h:17
Rendering::PackedColor color
Definition TextHelper.h:25
constexpr DWORD AlphaBlend
uint32_t PackedColor