# Drawing
# Description
The Drawing namespace provides functionality for drawing various graphics and text on the game interface, used for visualizing information display and debugging.
# How to Use
// Draw text on screen
Drawing::DrawText(Vector2(100, 100), "Hello World", MAKE_COLOR(255, 255, 255, 255));
// Draw a circle
Drawing::DrawCircle(myHero.GetPosition(), 300.0f, MAKE_COLOR(255, 0, 0, 255));
// Draw a line
Drawing::DrawLine(startPos, endPos, 2.0f, MAKE_COLOR(0, 255, 0, 255));
# DrawText
void DrawText(Vector2 const& pos, const char* text, int color, int fontSize = 14)
Draws text on the screen.
Parameter | Type | Description |
---|---|---|
pos | Vector2 const& | Screen coordinates of the text starting position |
text | const char* | Text content to display |
color | int | Text color (RGBA format) |
fontSize | int | Font size, defaults to 14 |
// Draw white text at screen coordinates (100,100)
Drawing::DrawText(Vector2(100, 100), "Hello World", MAKE_COLOR(255, 255, 255, 255));
// Draw larger red text
Drawing::DrawText(Vector2(200, 200), "Warning!", MAKE_COLOR(255, 0, 0, 255), 20);
# DrawLine
void DrawLine(Vector3 const& start, Vector3 const& end, float thickness, int color)
Draws a line in the game world.
Parameter | Type | Description |
---|---|---|
start | Vector3 const& | Starting coordinates of the line |
end | Vector3 const& | Ending coordinates of the line |
thickness | float | Line thickness |
color | int | Line color (RGBA format) |
// Draw a red line from hero position to target position
Vector3 heroPos = myHero.GetPosition();
Vector3 targetPos = enemy.GetPosition();
Drawing::DrawLine(heroPos, targetPos, 2.0f, MAKE_COLOR(255, 0, 0, 255));
// Draw a thick blue line
Drawing::DrawLine(Vector3(0, 0, 0), Vector3(1000, 0, 1000), 5.0f, MAKE_COLOR(0, 0, 255, 255));
# DrawCircle
void DrawCircle(Vector3 const& center, float radius, int color, float thickness = 2.0f)
Draws a circle in the game world.
Parameter | Type | Description |
---|---|---|
center | Vector3 const& | Center coordinates of the circle |
radius | float | Radius of the circle |
color | int | Circle color (RGBA format) |
thickness | float | Thickness of the circle border, defaults to 2.0 |
// Draw a green circle around the hero, representing skill range
Vector3 heroPos = myHero.GetPosition();
Drawing::DrawCircle(heroPos, 300.0f, MAKE_COLOR(0, 255, 0, 255));
// Draw a red circle with thick border
Drawing::DrawCircle(heroPos, 500.0f, MAKE_COLOR(255, 0, 0, 255), 4.0f);
# DrawRectangle
void DrawRectangle(Vector2 const& start, Vector2 const& end, int color, float thickness = 1.0f)
Draws a rectangle on the screen.
Parameter | Type | Description |
---|---|---|
start | Vector2 const& | Screen coordinates of the top-left corner of the rectangle |
end | Vector2 const& | Screen coordinates of the bottom-right corner of the rectangle |
color | int | Rectangle color (RGBA format) |
thickness | float | Thickness of the rectangle border, defaults to 1.0 |
// Draw a blue rectangle
Drawing::DrawRectangle(Vector2(100, 100), Vector2(300, 200), MAKE_COLOR(0, 0, 255, 255));
// Draw a yellow rectangle with thick border
Drawing::DrawRectangle(Vector2(400, 300), Vector2(600, 500), MAKE_COLOR(255, 255, 0, 255), 3.0f);
# DrawFilledRectangle
void DrawFilledRectangle(Vector2 const& start, Vector2 const& end, int color)
Draws a filled rectangle on the screen.
Parameter | Type | Description |
---|---|---|
start | Vector2 const& | Screen coordinates of the top-left corner of the rectangle |
end | Vector2 const& | Screen coordinates of the bottom-right corner of the rectangle |
color | int | Fill color of the rectangle (RGBA format) |
// Draw a semi-transparent red filled rectangle
Drawing::DrawFilledRectangle(Vector2(200, 200), Vector2(400, 300), MAKE_COLOR(255, 0, 0, 128));
// Draw an opaque green filled rectangle
Drawing::DrawFilledRectangle(Vector2(500, 400), Vector2(700, 500), MAKE_COLOR(0, 255, 0, 255));
# DrawImage
void DrawImage(const char* imagePath, Vector2 const& position, Vector2 const& size)
Draws an image on the screen.
Parameter | Type | Description |
---|---|---|
imagePath | const char* | Path to the image file |
position | Vector2 const& | Screen coordinates of the top-left corner of the image |
size | Vector2 const& | Width and height of the image |
// Draw an icon
Drawing::DrawImage("images/icon.png", Vector2(100, 100), Vector2(32, 32));
// Draw a larger image
Drawing::DrawImage("images/background.png", Vector2(0, 0), Vector2(1920, 1080));
← Damage EventManager →