|
|
|
@ -865,6 +865,7 @@ namespace olc |
|
|
|
|
olc::DecalMode mode = olc::DecalMode::NORMAL; |
|
|
|
|
olc::DecalStructure structure = olc::DecalStructure::FAN; |
|
|
|
|
uint32_t points = 0; |
|
|
|
|
bool depthEnabled = false; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct LayerDesc |
|
|
|
@ -1090,6 +1091,7 @@ namespace olc |
|
|
|
|
// Draws a multiline string as a decal, with tiniting and scaling
|
|
|
|
|
void DrawStringDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f }); |
|
|
|
|
void DrawStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f }); |
|
|
|
|
void DrawRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE); |
|
|
|
|
// Draws a single shaded filled rectangle as a decal
|
|
|
|
|
void FillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE); |
|
|
|
|
// Draws a corner shaded rectangle as a decal
|
|
|
|
@ -1169,6 +1171,7 @@ namespace olc |
|
|
|
|
std::string sAppName; |
|
|
|
|
|
|
|
|
|
private: // Inner mysterious workings
|
|
|
|
|
bool depthEnabled = false; |
|
|
|
|
olc::Sprite* pDrawTarget = nullptr; |
|
|
|
|
Pixel::Mode nPixelMode = Pixel::NORMAL; |
|
|
|
|
float fBlendFactor = 1.0f; |
|
|
|
@ -2698,6 +2701,7 @@ namespace olc |
|
|
|
|
di.pos.resize(elements); |
|
|
|
|
di.uv.resize(elements); |
|
|
|
|
di.w.resize(elements); |
|
|
|
|
di.z.resize(elements); |
|
|
|
|
di.tint.resize(elements); |
|
|
|
|
di.points = elements; |
|
|
|
|
for (uint32_t i = 0; i < elements; i++) |
|
|
|
@ -2756,6 +2760,7 @@ namespace olc |
|
|
|
|
} |
|
|
|
|
di.mode = nDecalMode; |
|
|
|
|
di.structure = nDecalStructure; |
|
|
|
|
di.depthEnabled = true; |
|
|
|
|
vLayers[nTargetLayer].vecDecalInstance.push_back(di); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2849,7 +2854,18 @@ namespace olc |
|
|
|
|
di.mode = olc::DecalMode::WIREFRAME; |
|
|
|
|
vLayers[nTargetLayer].vecDecalInstance.push_back(di); |
|
|
|
|
} |
|
|
|
|
void PixelGameEngine::DrawRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col) |
|
|
|
|
{ |
|
|
|
|
auto m = nDecalMode; |
|
|
|
|
SetDecalMode(olc::DecalMode::WIREFRAME); |
|
|
|
|
olc::vf2d vNewSize = size;// (size - olc::vf2d(0.375f, 0.375f)).ceil();
|
|
|
|
|
std::array<olc::vf2d, 4> points = { { {pos}, {pos.x, pos.y + vNewSize.y}, {pos + vNewSize}, {pos.x + vNewSize.x, pos.y} } }; |
|
|
|
|
std::array<olc::vf2d, 4> uvs = { {{0,0},{0,0},{0,0},{0,0}} }; |
|
|
|
|
std::array<olc::Pixel, 4> cols = { {col, col, col, col} }; |
|
|
|
|
DrawExplicitDecal(nullptr, points.data(), uvs.data(), cols.data(), 4); |
|
|
|
|
SetDecalMode(m); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
void PixelGameEngine::FillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col) |
|
|
|
|
{ |
|
|
|
|
olc::vf2d vNewSize = (size - olc::vf2d(0.375f, 0.375f)).ceil(); |
|
|
|
@ -4164,7 +4180,9 @@ namespace olc |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
glEnable(GL_DEPTH_TEST); |
|
|
|
|
if (decal.depthEnabled) { |
|
|
|
|
glEnable(GL_DEPTH_TEST); |
|
|
|
|
} |
|
|
|
|
glDepthFunc(GL_LESS); |
|
|
|
|
if (nDecalMode == DecalMode::WIREFRAME) |
|
|
|
|
glBegin(GL_LINE_LOOP); |
|
|
|
|