Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dev/src/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ const GPUTask& olc::Draw::TexturedPolygon(const olc::Structure structure, const
)));
}

const GPUTask& olc::Draw::String(const olc::vf2d& pos, const std::string& text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
const GPUTask& olc::Draw::String(const olc::vf2d& pos, std::string_view text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
{
PrepareTargetForHW();

Expand Down Expand Up @@ -949,7 +949,7 @@ const GPUTask& olc::Draw::String(const olc::vf2d& pos, const std::string& text,
return Batch(task);
}

const GPUTask& olc::Draw::StringProp(const olc::vf2d& pos, const std::string& text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
const GPUTask& olc::Draw::StringProp(const olc::vf2d& pos, std::string_view text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
{
PrepareTargetForHW();

Expand Down Expand Up @@ -979,7 +979,7 @@ const GPUTask& olc::Draw::StringProp(const olc::vf2d& pos, const std::string& te
return Batch(task);
}

olc::vf2d olc::Draw::GetTextSize(const std::string& text, const bool bProportional, const olc::vf2d& scale, olc::Font& font)
olc::vf2d olc::Draw::GetTextSize(std::string_view text, const bool bProportional, const olc::vf2d& scale, olc::Font& font)
{
olc::vf2d size = { 0, font.fLineHeight * scale.y };
olc::vf2d pos = { 0, font.fLineHeight * scale.y };
Expand Down
6 changes: 3 additions & 3 deletions dev/src/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -778,22 +778,22 @@ namespace olc
// Draws a string at specified location in monospace font
const GPUTask& String(
const olc::vf2d& pos,
const std::string& text,
std::string_view text,
const olc::Pixel col = olc::Colour::WHITE,
const olc::vf2d& scale = { 1.0f, 1.0f },
olc::Font& font = olc::fontClassicPGE);

// Draws a string at specified location in proportional font
const GPUTask& StringProp(
const olc::vf2d& pos,
const std::string& text,
std::string_view text,
const olc::Pixel col = olc::Colour::WHITE,
const olc::vf2d& scale = { 1.0f, 1.0f },
olc::Font& font = olc::fontClassicPGE);

// Returns the bounding box size of a string in pixels
olc::vf2d GetTextSize(
const std::string& text,
std::string_view text,
const bool bProportional = false,
const olc::vf2d& scale = { 1.0f, 1.0f },
olc::Font& font = olc::fontClassicPGE);
Expand Down
12 changes: 6 additions & 6 deletions olcPixelGameEngine3.h
Original file line number Diff line number Diff line change
Expand Up @@ -3454,22 +3454,22 @@ namespace olc
// Draws a string at specified location in monospace font
const GPUTask& String(
const olc::vf2d& pos,
const std::string& text,
std::string_view text,
const olc::Pixel col = olc::Colour::WHITE,
const olc::vf2d& scale = { 1.0f, 1.0f },
olc::Font& font = olc::fontClassicPGE);

// Draws a string at specified location in proportional font
const GPUTask& StringProp(
const olc::vf2d& pos,
const std::string& text,
std::string_view text,
const olc::Pixel col = olc::Colour::WHITE,
const olc::vf2d& scale = { 1.0f, 1.0f },
olc::Font& font = olc::fontClassicPGE);

// Returns the bounding box size of a string in pixels
olc::vf2d GetTextSize(
const std::string& text,
std::string_view text,
const bool bProportional = false,
const olc::vf2d& scale = { 1.0f, 1.0f },
olc::Font& font = olc::fontClassicPGE);
Expand Down Expand Up @@ -18936,7 +18936,7 @@ const GPUTask& olc::Draw::TexturedPolygon(const olc::Structure structure, const
)));
}

const GPUTask& olc::Draw::String(const olc::vf2d& pos, const std::string& text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
const GPUTask& olc::Draw::String(const olc::vf2d& pos, std::string_view text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
{
PrepareTargetForHW();

Expand Down Expand Up @@ -18967,7 +18967,7 @@ const GPUTask& olc::Draw::String(const olc::vf2d& pos, const std::string& text,
return Batch(task);
}

const GPUTask& olc::Draw::StringProp(const olc::vf2d& pos, const std::string& text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
const GPUTask& olc::Draw::StringProp(const olc::vf2d& pos, std::string_view text, const olc::Pixel col, const olc::vf2d& scale, olc::Font& font)
{
PrepareTargetForHW();

Expand Down Expand Up @@ -18997,7 +18997,7 @@ const GPUTask& olc::Draw::StringProp(const olc::vf2d& pos, const std::string& te
return Batch(task);
}

olc::vf2d olc::Draw::GetTextSize(const std::string& text, const bool bProportional, const olc::vf2d& scale, olc::Font& font)
olc::vf2d olc::Draw::GetTextSize(std::string_view text, const bool bProportional, const olc::vf2d& scale, olc::Font& font)
{
olc::vf2d size = { 0, font.fLineHeight * scale.y };
olc::vf2d pos = { 0, font.fLineHeight * scale.y };
Expand Down
Loading