Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
BlamRendering::DirectX::Drawing Namespace Reference

Namespace containing functions to handle the drawing of Direct2D primitives. More...

Namespaces

 Widgets
 Multi-purpose widgets drawn with Direct2D.
 

Functions

BLAM HRESULT DrawRect (D2D1_COLOR_F outline_color, D2D1_COLOR_F fill_color, D2D1_RECT_F rect, float thickness, StackItemDrawMode mode)
 Draws a rectangle. More...
 
BLAM HRESULT DrawRect (D2D1_COLOR_F color, D2D1_RECT_F rect, float thickness)
 Draws a rectangle. More...
 
BLAM HRESULT DrawRect (float r, float g, float b, D2D1_RECT_F rect, float thickness)
 Draws a rectangle. More...
 
BLAM HRESULT DWDrawText (std::wstring text, std::wstring font, float size, D2D1_RECT_F area, D2D1_COLOR_F color)
 Draws a string using DirectWrite. More...
 
BLAM HRESULT DWDrawText (std::wstring text, std::wstring font, float size, float left, float bottom, float right, float top, float r, float g, float b)
 Draws a string using DirectWrite. More...
 
BLAM HRESULT DWDrawText (std::wstring text, std::wstring font_name, float size, int x, int y, D2D1_COLOR_F color, IDWriteFontCollection *font_collection, bool auto_calculate_area, D2D1_RECT_F area)
 Draws a string using DirectWrite. More...
 
BLAM HRESULT DrawBitmapFromResource (int res_id, const char *res_type, D2D1_RECT_F area, int width, int height)
 Draws a bitmap pulled from an application resource. More...
 
BLAM HRESULT DrawEllipse (D2D1_COLOR_F outline_color, D2D1_COLOR_F fill_color, D2D1_ELLIPSE ellipse, float thickness, StackItemDrawMode mode)
 Draws an ellipse. More...
 
BLAM HRESULT DrawRoundedRect (D2D1_COLOR_F outline_color, D2D1_COLOR_F fill_color, D2D1_ROUNDED_RECT rounded_rect, float thickness, StackItemDrawMode mode)
 Draws a rounded rectangle. More...
 
BLAM HRESULT DrawLine (D2D1_COLOR_F color, D2D1_POINT_2F start_point, D2D1_POINT_2F end_point, float thickness)
 Draws a line. More...
 
BLAM HRESULT DrawBitmapText (BlamRendering::RenderStack::BitmapText *text_object, Blam::Content::Fonts::Font *font, bool replace_color_codes)
 Draws the specified text using a Bitmap-based Blamite Font. More...
 

Detailed Description

Namespace containing functions to handle the drawing of Direct2D primitives.

Function Documentation

◆ DrawBitmapFromResource()

HRESULT BlamRendering::DirectX::Drawing::DrawBitmapFromResource ( int  res_id,
const char *  res_type,
D2D1_RECT_F  area,
int  width,
int  height 
)

Draws a bitmap pulled from an application resource.

Parameters
res_id- The ID of the resource.
res_type- The type of the resource.
area- The area to draw the bitmap within.
width- The width of the bitmap. Currently unused.
height- The height of the bitmap. Currently unused.
Todo:
Remove unused parameters: width, height
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DrawBitmapText()

HRESULT BlamRendering::DirectX::Drawing::DrawBitmapText ( BlamRendering::RenderStack::BitmapText text_object,
Blam::Content::Fonts::Font font,
bool  replace_color_codes 
)

Draws the specified text using a Bitmap-based Blamite Font.

Note
Bitmap based fonts will automatically use integer scaling when the scale factor is set to an integer.
Parameters
text_object- A pointer to the BitmapText render stack object.
font- A pointer to the font to use.
replace_color_codes- Whether or not to replace any instances of color code templates with 0xB00B in order to allow multicolored text.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DrawEllipse()

HRESULT BlamRendering::DirectX::Drawing::DrawEllipse ( D2D1_COLOR_F  outline_color,
D2D1_COLOR_F  fill_color,
D2D1_ELLIPSE  ellipse,
float  thickness,
StackItemDrawMode  mode 
)

Draws an ellipse.

Parameters
outline_color- The color for the ellipse's border.
fill_color- The color for the ellipse's interior.
ellipse- The area of the ellipse.
thickness- The thickness of the ellipse's border.
mode- The drawing mode to use.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DrawLine()

HRESULT BlamRendering::DirectX::Drawing::DrawLine ( D2D1_COLOR_F  color,
D2D1_POINT_2F  start_point,
D2D1_POINT_2F  end_point,
float  thickness 
)

Draws a line.

Parameters
color- The color for the line.
start_point- The starting point of the line.
end_point- The ending point of the line.
thickness- The thickness of the line.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DrawRect() [1/3]

HRESULT BlamRendering::DirectX::Drawing::DrawRect ( D2D1_COLOR_F  color,
D2D1_RECT_F  rect,
float  thickness 
)

Draws a rectangle.

Parameters
color- The color for the rectangle's border and interior.
rect- The area of the rectangle.
thickness- The thickness of the rectangle's border.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DrawRect() [2/3]

HRESULT BlamRendering::DirectX::Drawing::DrawRect ( D2D1_COLOR_F  outline_color,
D2D1_COLOR_F  fill_color,
D2D1_RECT_F  rect,
float  thickness,
StackItemDrawMode  mode 
)

Draws a rectangle.

Parameters
outline_color- The color for the rectangle's border.
fill_color- The color for the rectangle's interior.
rect- The area of the rectangle.
thickness- The thickness of the rectangle's border.
mode- The drawing mode to use.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DrawRect() [3/3]

HRESULT BlamRendering::DirectX::Drawing::DrawRect ( float  r,
float  g,
float  b,
D2D1_RECT_F  rect,
float  thickness 
)

Draws a rectangle.

Parameters
r- The Red color for the rectangle's border and interior.
g- The Green color for the rectangle's border and interior.
b- The Blue color for the rectangle's border and interior.
rect- The area of the rectangle.
thickness- The thickness of the rectangle's border.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DrawRoundedRect()

HRESULT BlamRendering::DirectX::Drawing::DrawRoundedRect ( D2D1_COLOR_F  outline_color,
D2D1_COLOR_F  fill_color,
D2D1_ROUNDED_RECT  rounded_rect,
float  thickness,
StackItemDrawMode  mode 
)

Draws a rounded rectangle.

Parameters
outline_color- The color for the rectangle's border.
fill_color- The color for the rectangle's interior.
rounded_rect- The area of the rounded rectangle.
thickness- The thickness of the rectangle's border.
mode- The drawing mode to use.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DWDrawText() [1/3]

HRESULT BlamRendering::DirectX::Drawing::DWDrawText ( std::wstring  text,
std::wstring  font,
float  size,
D2D1_RECT_F  area,
D2D1_COLOR_F  color 
)

Draws a string using DirectWrite.

Parameters
text- The text to draw.
font- The name of the font to use. Can be the name of any installed system font.
size- The size to draw the text at.
area- The area to draw the text within.
color- The color to use for the text.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DWDrawText() [2/3]

HRESULT BlamRendering::DirectX::Drawing::DWDrawText ( std::wstring  text,
std::wstring  font,
float  size,
float  left,
float  bottom,
float  right,
float  top,
float  r,
float  g,
float  b 
)

Draws a string using DirectWrite.

Parameters
text- The text to draw.
font- The name of the font to use. Can be the name of any installed system font.
size- The size to draw the text at.
left- The left edge of the area.
bottom- The bottom edge of the area.
right- The right edge of the area.
top- The top edge of the area.
r- The Red color for the text color.
g- The Green color for the text color.
b- The Blue color for the text color.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.

◆ DWDrawText() [3/3]

HRESULT BlamRendering::DirectX::Drawing::DWDrawText ( std::wstring  text,
std::wstring  font_name,
float  size,
int  x,
int  y,
D2D1_COLOR_F  color,
IDWriteFontCollection *  font_collection,
bool  auto_calculate_area,
D2D1_RECT_F  area 
)

Draws a string using DirectWrite.

Parameters
text- The text to draw.
font- The name of the font to use. Can be the name of any installed system font.
size- The size to draw the text at.
x- The X coordinate at which to draw the text. Only used if auto_calculate_area is set to true.
y- The Y coordinate at which to draw the text. Only used if auto_calculate_area is set to true.
color- The color to use for the text.
font_collection- Pointer to the custom font collection containing the desired font.
auto_calculate_area- Whether or not to automatically calculate the text area.
area- The area to draw the text within. Only used if auto_calculate_area is set to false.
Returns
S_OK if the item was drawn successfully, otherwise returns an error code.