From 3e67e3a91ac797791fabdf4ec730ef8d1a8f6990 Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 20 Jun 2011 17:36:29 +0200 Subject: fixed a lyt::Pane def bug, added CharWriter and TextWriter --- include/game.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/game.h b/include/game.h index f713d0a..7c8b4e2 100755 --- a/include/game.h +++ b/include/game.h @@ -455,7 +455,7 @@ namespace lyt { u8 origin; u8 flag; - char name[0x14]; + char name[0x11]; char userdata[8]; u8 _D5; @@ -1157,6 +1157,78 @@ private: +namespace nw4r { + namespace ut { + class CharWriter { + public: + CharWriter(); + ~CharWriter(); + + void SetupGX(); + + void SetFontSize(float w, float h); + void SetFontSize(float v); + float GetFontWidth() const; + float GetFontHeight() const; + float GetFontAscent() const; + float GetFontDescent() const; + + // returns width + float Print(ushort character); + + void PrintGlyph(float, float, float, /* nw4r::ut::Glyph const & */ void*); + + void UpdateVertexColor(); + + private: + void SetupGXWithColorMapping(Color c1, Color c2); + + public: + Color colors[8]; // todo: document + u32 modeOfSomeKind; + float scaleX; + float scaleY; + float posX; + float posY; + float posZ; + GXTexFilter minFilt; + GXTexFilter magFilt; + u16 completelyUnknown; + u8 alpha; + u8 isFixedWidth; + float fixedWidthValue; + /* ResFont* */ void *font; + }; + + // actually TextWriterBase, but ... + class TextWriter : public CharWriter { + public: + TextWriter(); + ~TextWriter(); + + float GetLineHeight() const; + + // left out most of these to avoid all the format string vararg bullshit + float CalcStringWidth(wchar_t const *string, int length) const; + + float Print(wchar_t const *string, int length); + + float CalcLineWidth(wchar_t const *string, int length); + + float GetLineSpace() const; + + bool IsDrawFlagSet(ulong, ulong) const; + + float _4C; + float charSpace; + float somethingRelatedToLineHeight; + u32 _58; + u32 drawFlag; + void *tagProcessorMaybe; + }; + } +} + // More layout crap // This file REALLY needs to be reorganised. -- cgit v1.2.3