Rise
The Vieneo Province
Text.h
Go to the documentation of this file.
1 #pragma once
2 /*
3 A format specifier follows this prototype:
4 %[flags][width][.precision][length]specifier
5 
6 Where the specifier character at the end is the most significant component, since it defines the type and the interpretation of its corresponding argument:
7 specifier Output Example
8 d or i Signed decimal integer 392
9 u Unsigned decimal integer 7235
10 o Unsigned octal 610
11 x Unsigned hexadecimal integer 7fa
12 X Unsigned hexadecimal integer (uppercase) 7FA
13 f Decimal floating point 392.65
14 e Scientific notation (mantissa/exponent), lowercase 3.9265e+2
15 E Scientific notation (mantissa/exponent), uppercase 3.9265E+2
16 g Use the shortest representation: %e or %f 392.65
17 G Use the shortest representation: %E or %f 392.65
18 a Hexadecimal floating point, lowercase -0xc.90fep-2
19 A Hexadecimal floating point, uppercase -0XC.90FEP-2
20 c Character a
21 s String of characters sample
22 p Pointer address b8000000
23 % A % followed by another % character will write a single % to the stream.
24 
25 The format specifier can also contain sub-specifiers: flags, width, .precision and modifiers (in that order), which are optional and follow these specifications:
26 
27 flags description
28 - Left-justify within the given field width; Right justification is the default (see width sub-specifier).
29 + Forces to preceed the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.
30 (space) If no sign is going to be written, a blank space is inserted before the value.
31 # Used with o, x or X specifiers the value is preceeded with 0, 0x or 0X respectively for values different than zero.
32  Used with a, A, e, E, f, F, g or G it forces the written output to contain a decimal point even if no more digits follow. By default, if no digits follow, no decimal point is written.
33 0 Left-pads the number with zeroes (0) instead of spaces when padding is specified (see width sub-specifier).
34 
35 width description
36 (number) Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger.
37 
38 .precision description
39 .number For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.
40 For a, A, e, E, f and F specifiers: this is the number of digits to be printed after the decimal point (by default, this is 6).
41 For g and G specifiers: This is the maximum number of significant digits to be printed.
42 For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.
43 If the period is specified without an explicit value for precision, 0 is assumed.
44 */
45 
46 #include "../Logger.h"
47 #include "DeviceObject.h"
48 #include "../Bus.h"
49 
50 class Text
51 {
52  RECT rect;
53  Logger* logger = nullptr;
54  Bus* bus = nullptr;
55  DeviceObject* pDevice = nullptr;
56  //ID3DX10Font* pFont = nullptr;
57  ID3DXFont* pFont = nullptr;
58  D3DXMATRIX transform;
59 
60 public:
61  // config items
62  int x, y;
63  float z;
64  D3DXCOLOR color;
65  int width = 0, height = 0;
66  int flags = DT_NOCLIP | DT_SINGLELINE | DT_EXPANDTABS;
67  std::string formattedText;
68  std::string elementName;
69  int font = 0;
70 
71  Text(Logger* prmLogger, Bus* prmBus, DeviceObject* prmpDevice, ID3DXFont* prmFont, int prmX, int prmY, int prmWidth, int prmHeight);
72  void Draw(WCHAR* str);
73 };
Definition: Text.h:50
D3DXCOLOR color
Definition: Text.h:64
int x
Definition: Text.h:62
int width
Definition: Text.h:65
RECT rect
Definition: Text.h:52
Definition: Logger.h:9
int font
Definition: Text.h:69
Bus * bus
Definition: Text.h:54
DeviceObject * pDevice
Definition: Text.h:55
Definition: Bus.h:16
void Draw(WCHAR *str)
Definition: Text.cpp:35
std::string formattedText
Definition: Text.h:67
float z
Definition: Text.h:63
std::string elementName
Definition: Text.h:68
int height
Definition: Text.h:65
ID3DXFont * pFont
Definition: Text.h:57
D3DXMATRIX transform
Definition: Text.h:58
Logger * logger
Definition: Text.h:53
int flags
Definition: Text.h:66
int y
Definition: Text.h:62
Text(Logger *prmLogger, Bus *prmBus, DeviceObject *prmpDevice, ID3DXFont *prmFont, int prmX, int prmY, int prmWidth, int prmHeight)
Definition: Text.cpp:3