Skip to content
Merged
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
2 changes: 1 addition & 1 deletion dev/cmake/Helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function(add_example EXAMPLE_NAME)
${WAYLAND_EGL_LIBRARIES}
${WAYLAND_CURSOR_LIBRARIES}
${EGL_LIBRARIES}
OpenGL::GL
OpenGL::OpenGL
PNG::PNG
Threads::Threads
)
Expand Down
8 changes: 4 additions & 4 deletions dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_Pixels.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_Polygons.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand All @@ -164,8 +164,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_Camera2D_Tiles.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_Touch.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
Expand Down
26 changes: 21 additions & 5 deletions dev/src/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,26 @@ GPUTask olc::Draw::TaskDrawLine(const std::vector<olc::vf2d>& vPoints, const olc

}

GPUTask olc::Draw::TaskDrawPoints(const std::vector<olc::vf2d>& vPoints, const std::vector<olc::Pixel>& vColours, const olc::Pixel tint)
{
GPUTask task;
task.structure = olc::Structure::Point;
task.vertexBuffer.resize(vPoints.size());
for (size_t i = 0; i < vPoints.size(); i++)
{
task.vertexBuffer[i] = { { vPoints[i].x, vPoints[i].y, 1.0f, 1.0f }, vColours[i],{ 0, 0 },{ 0, 0 },{ 0, 0 },{ 0, 0 } };
}
task.blendmode = blendMode;
task.tint = tint;
return task;
}

GPUTask olc::Draw::TaskDrawPolygon(olc::Structure structure, const std::vector<olc::vf2d>& vPoints, const std::vector<olc::Pixel>& vColours, const olc::Pixel tint)
{
olc_IgnoreUnused(structure);
return TaskDrawLine(vPoints, vColours, tint, false, true);
if (structure == olc::Structure::Point)
return TaskDrawPoints(vPoints, vColours, tint);
else
return TaskDrawLine(vPoints, vColours, tint, false, true);
}

GPUTask olc::Draw::TaskDrawPolygon(olc::Structure structure, const std::vector<olc::vf2d>& vPoints, const olc::Pixel colour, const olc::Pixel tint)
Expand Down Expand Up @@ -918,7 +934,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 +965,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 +995,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
11 changes: 8 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 Expand Up @@ -975,6 +975,11 @@ namespace olc
const olc::Pixel tint = olc::Colour::WHITE,
const bool constrain = true,
const bool looped = false);

GPUTask TaskDrawPoints(
const std::vector<olc::vf2d>& vPoints,
const std::vector<olc::Pixel>& vColours,
const olc::Pixel tint = olc::Colour::WHITE);

GPUTask TaskDrawPolygon(
olc::Structure structure,
Expand Down
2 changes: 2 additions & 0 deletions dev/src/gpu_opengl33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ out vec4 oCol;
R"(
void main()
{
gl_PointSize = 1.0; // Required for emscripten

if (pgeDrawType == 2) // 3D
{
gl_Position = pgeMVP * vec4(aPos.x, aPos.y, aPos.z, 1.0);
Expand Down
6 changes: 5 additions & 1 deletion dev/src/host_apple_macos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ namespace olc::host {
if (!this->OnSystemThreadStart())
{
// PGE->OnContextStart() failed, or user aborted OnUserCreate()
return;
StopSystem();

}

// Main system loop
Expand Down Expand Up @@ -346,6 +347,9 @@ namespace olc::host {

bool Host_Apple_MacOS::StopSystem()
{
// Clear any pending tasks/messages on the main thread
bSkipFrame = ExecutePendingMainThreadTasks();

dispatch_sync(dispatch_get_main_queue(), ^{
// clean up and close application
if (pMacOSOpenGLRenderer)
Expand Down
5 changes: 5 additions & 0 deletions dev/src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ namespace olc
return region({ 0,0 }, this->Size()).flipH();
}

olc::ImageRegion Image::flipD()
{
return olc::ImageRegion(*this, { 0,0 }, { 0,1 }, { 1, 0 }, { 1,1 });
}

void Image::BindGPU()
{
onGPU = true;
Expand Down
1 change: 1 addition & 0 deletions dev/src/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ namespace olc
olc::ImageRegion region(const olc::vf2d& vTL, const olc::vf2d& vTR, const olc::vf2d& vBL, const olc::vf2d& vBR);
olc::ImageRegion flipV();
olc::ImageRegion flipH();
olc::ImageRegion flipD();

public: // Make friendly private later
void BindGPU();
Expand Down
Loading
Loading