Update to PGE v2.25.
This commit is contained in:
parent
7dc8d19dca
commit
c8b6273b48
@ -790,6 +790,7 @@
|
||||
<ClCompile Include="Wolf.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
<None Include="ClassDiagram2.cd" />
|
||||
<None Include="cpp.hint" />
|
||||
<None Include="CREDITS" />
|
||||
|
@ -858,6 +858,7 @@
|
||||
<None Include="CREDITS">
|
||||
<Filter>Documentation</Filter>
|
||||
</None>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="InitialConcept.txt">
|
||||
|
@ -60,13 +60,13 @@ namespace CharacterMenuWindow{
|
||||
const std::function<int()>calcFunc;
|
||||
};
|
||||
const static std::array<AttributeData,7>displayAttrs{
|
||||
AttributeData{"Health",[&]()->int{return game->GetPlayer()->GetMaxHealth();}},
|
||||
AttributeData{"Attack",[&]()->int{return game->GetPlayer()->GetAttack();}},
|
||||
AttributeData{"Defense",[&]()->int{return game->GetPlayer()->GetStat("Defense");}},
|
||||
AttributeData{"Move Spd %",[&]()->int{return ceil(game->GetPlayer()->GetMoveSpdMult()*100);}},
|
||||
AttributeData{"CDR",[&]()->int{return ceil(game->GetPlayer()->GetCooldownReductionPct()*100);}},
|
||||
AttributeData{"Crit Rate",[&]()->int{return ceil(game->GetPlayer()->GetCritRatePct()*100);}},
|
||||
AttributeData{"Crit Dmg",[&]()->int{return ceil(game->GetPlayer()->GetCritDmgPct()*100);}},
|
||||
AttributeData{"Health",[]()->int{return game->GetPlayer()->GetMaxHealth();}},
|
||||
AttributeData{"Attack",[]()->int{return game->GetPlayer()->GetAttack();}},
|
||||
AttributeData{"Defense",[]()->int{return game->GetPlayer()->GetStat("Defense");}},
|
||||
AttributeData{"Move Spd %",[]()->int{return ceil(game->GetPlayer()->GetMoveSpdMult()*100);}},
|
||||
AttributeData{"CDR",[]()->int{return ceil(game->GetPlayer()->GetCooldownReductionPct()*100);}},
|
||||
AttributeData{"Crit Rate",[]()->int{return ceil(game->GetPlayer()->GetCritRatePct()*100);}},
|
||||
AttributeData{"Crit Dmg",[]()->int{return ceil(game->GetPlayer()->GetCritDmgPct()*100);}},
|
||||
};
|
||||
const static std::array<std::string,8>slotNames{"Helmet","Weapon","Armor","Gloves","Pants","Shoes","Ring 1","Ring 2"};
|
||||
template<class T>
|
||||
|
1334
Adventures in Lestoria/ClassDiagram.cd
Normal file
1334
Adventures in Lestoria/ClassDiagram.cd
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,3 +9,5 @@ do we need a minimap? (maybe with fog of war?) Maybe polling that once testing w
|
||||
should gemstones dropp from boss stages aswell? (Maybe lower droprate?)
|
||||
|
||||
Toggle for displaying error messages
|
||||
|
||||
Low health warning
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 5
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 8113
|
||||
#define VERSION_BUILD 8114
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -3,7 +3,7 @@
|
||||
olcPixelGameEngine.h
|
||||
|
||||
+-------------------------------------------------------------+
|
||||
| OneLoneCoder Pixel Game Engine v2.24 |
|
||||
| OneLoneCoder Pixel Game Engine v2.25 |
|
||||
| "What do you need? Pixels... Lots of Pixels..." - javidx9 |
|
||||
+-------------------------------------------------------------+
|
||||
|
||||
@ -323,6 +323,7 @@ Fix Pixel -= operator (thanks Au Lit)
|
||||
2.23: Fixed Emscripten host sizing errors - Thanks Moros
|
||||
Fixed v2d_generic.clamp() function
|
||||
2.24: Fix FillTexturedTriangle() to remove const-ref
|
||||
2.25: +DrawPolygonDecal(pos, tex, w, col)
|
||||
|
||||
!! Apple Platforms will not see these updates immediately - Sorry, I dont have a mac to test... !!
|
||||
!! Volunteers willing to help appreciated, though PRs are manually integrated with credit !!
|
||||
@ -407,7 +408,7 @@ return 0;
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
#pragma endregion
|
||||
|
||||
#define PGE_VER 224
|
||||
#define PGE_VER 225
|
||||
|
||||
// O------------------------------------------------------------------------------O
|
||||
// | COMPILER CONFIGURATION ODDITIES |
|
||||
@ -591,6 +592,7 @@ namespace olc
|
||||
// O------------------------------------------------------------------------------O
|
||||
// | olc::Pixel - Represents a 32-Bit RGBA colour |
|
||||
// O------------------------------------------------------------------------------O
|
||||
#if !defined(OLC_IGNORE_PIXEL)
|
||||
struct Pixel
|
||||
{
|
||||
union
|
||||
@ -636,7 +638,7 @@ namespace olc
|
||||
BLUE(0, 0, 255), DARK_BLUE(0, 0, 128), VERY_DARK_BLUE(0, 0, 64),
|
||||
MAGENTA(255, 0, 255), DARK_MAGENTA(128, 0, 128), VERY_DARK_MAGENTA(64, 0, 64),
|
||||
WHITE(255, 255, 255), BLACK(0, 0, 0), BLANK(0, 0, 0, 0);
|
||||
|
||||
#endif
|
||||
// Thanks to scripticuk and others for updating the key maps
|
||||
// NOTE: The GLUT platform will need updating, open to contributions ;)
|
||||
enum Key
|
||||
@ -907,10 +909,12 @@ namespace olc
|
||||
std::vector<olc::vf2d> pos;
|
||||
std::vector<olc::vf2d> uv;
|
||||
std::vector<float> w;
|
||||
std::vector<float> z;
|
||||
std::vector<olc::Pixel> tint;
|
||||
olc::DecalMode mode = olc::DecalMode::NORMAL;
|
||||
olc::DecalStructure structure = olc::DecalStructure::FAN;
|
||||
uint32_t points = 0;
|
||||
bool depth = false;
|
||||
};
|
||||
|
||||
struct LayerDesc
|
||||
@ -1204,6 +1208,7 @@ namespace olc
|
||||
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<float>& depth, const std::vector<olc::vf2d>& uv, const olc::Pixel tint = olc::WHITE);
|
||||
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& tint);
|
||||
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& colours, const olc::Pixel tint);
|
||||
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<float>& depth, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& colours, const olc::Pixel tint);
|
||||
// Draws a line in Decal Space
|
||||
void DrawLineDecal(const olc::vf2d& pos1, const olc::vf2d& pos2, Pixel p = olc::WHITE);
|
||||
void DrawRotatedStringDecal(const olc::vf2d& pos, const std::string& sText, const float fAngle, const olc::vf2d& center = { 0.0f, 0.0f }, const olc::Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f });
|
||||
@ -1289,6 +1294,7 @@ namespace olc
|
||||
|
||||
// Draws a vector of vertices, interprted as individual triangles
|
||||
void LW3D_DrawTriangles(olc::Decal* decal, const std::vector<std::array<float,3>>& pos, const std::vector<olc::vf2d>& tex, const std::vector<olc::Pixel>& col);
|
||||
void LW3D_DrawWarpedDecal(olc::Decal* decal, const std::vector<std::array<float, 3>>& pos, const olc::Pixel& tint);
|
||||
|
||||
void LW3D_ModelTranslate(const float x, const float y, const float z);
|
||||
|
||||
@ -1602,6 +1608,7 @@ namespace olc
|
||||
// O------------------------------------------------------------------------------O
|
||||
// | olc::Pixel IMPLEMENTATION |
|
||||
// O------------------------------------------------------------------------------O
|
||||
#if !defined(OLC_IGNORE_PIXEL)
|
||||
Pixel::Pixel()
|
||||
{ r = 0; g = 0; b = 0; a = nDefaultAlpha; }
|
||||
|
||||
@ -1712,7 +1719,7 @@ namespace olc
|
||||
|
||||
Pixel PixelLerp(const olc::Pixel& p1, const olc::Pixel& p2, float t)
|
||||
{ return (p2 * t) + p1 * (1.0f - t); }
|
||||
|
||||
#endif
|
||||
// O------------------------------------------------------------------------------O
|
||||
// | olc::Sprite IMPLEMENTATION |
|
||||
// O------------------------------------------------------------------------------O
|
||||
@ -3247,9 +3254,7 @@ namespace olc
|
||||
vLayers[nTargetLayer].vecDecalInstance.push_back(di);
|
||||
}
|
||||
|
||||
#ifdef OLC_ENABLE_EXPERIMENTAL
|
||||
// Lightweight 3D
|
||||
void PixelGameEngine::LW3D_DrawTriangles(olc::Decal* decal, const std::vector<std::array<float, 3>>& pos, const std::vector<olc::vf2d>& tex, const std::vector<olc::Pixel>& col)
|
||||
void PixelGameEngine::DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<float>& depth, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& colours, const olc::Pixel tint)
|
||||
{
|
||||
DecalInstance di;
|
||||
di.decal = decal;
|
||||
@ -3259,15 +3264,84 @@ namespace olc
|
||||
di.w.resize(di.points);
|
||||
di.tint.resize(di.points);
|
||||
for (uint32_t i = 0; i < di.points; i++)
|
||||
{
|
||||
di.pos[i] = { (pos[i].x * vInvScreenSize.x) * 2.0f - 1.0f, ((pos[i].y * vInvScreenSize.y) * 2.0f - 1.0f) * -1.0f };
|
||||
di.uv[i] = uv[i];
|
||||
di.tint[i] = colours[i] * tint;
|
||||
di.w[i] = depth[i];
|
||||
}
|
||||
di.mode = nDecalMode;
|
||||
di.structure = nDecalStructure;
|
||||
vLayers[nTargetLayer].vecDecalInstance.push_back(di);
|
||||
}
|
||||
|
||||
#ifdef OLC_ENABLE_EXPERIMENTAL
|
||||
// Lightweight 3D
|
||||
void PixelGameEngine::LW3D_DrawTriangles(olc::Decal* decal, const std::vector<std::array<float, 3>>& pos, const std::vector<olc::vf2d>& tex, const std::vector<olc::Pixel>& col)
|
||||
{
|
||||
DecalInstance di;
|
||||
di.decal = decal;
|
||||
di.points = uint32_t(pos.size());
|
||||
di.pos.resize(di.points);
|
||||
di.uv.resize(di.points);
|
||||
di.w.resize(di.points);
|
||||
di.z.resize(di.points);
|
||||
di.tint.resize(di.points);
|
||||
for (uint32_t i = 0; i < di.points; i++)
|
||||
{
|
||||
di.pos[i] = { pos[i][0], pos[i][1] };
|
||||
di.w[i] = pos[i][2];
|
||||
di.z[i] = pos[i][2];
|
||||
di.uv[i] = tex[i];
|
||||
di.tint[i] = col[i];
|
||||
}
|
||||
di.mode = DecalMode::MODEL3D;
|
||||
di.mode = nDecalMode;
|
||||
di.structure = DecalStructure::LIST;
|
||||
di.depth = true;
|
||||
vLayers[nTargetLayer].vecDecalInstance.push_back(di);
|
||||
}
|
||||
void PixelGameEngine::LW3D_DrawWarpedDecal(olc::Decal* decal, const std::vector<std::array<float, 3>>& pos, const olc::Pixel& tint)
|
||||
{
|
||||
// Thanks Nathan Reed, a brilliant article explaining whats going on here
|
||||
// http://www.reedbeta.com/blog/quadrilateral-interpolation-part-1/
|
||||
DecalInstance di;
|
||||
di.points = 4;
|
||||
di.decal = decal;
|
||||
di.tint = { tint, tint, tint, tint };
|
||||
di.w = { 1, 1, 1, 1 };
|
||||
di.z = { 1, 1, 1, 1 };
|
||||
di.pos.resize(4);
|
||||
di.uv = { { 0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f} };
|
||||
olc::vf2d center;
|
||||
float rd = ((pos[2][0] - pos[0][0]) * (pos[3][1] - pos[1][1]) - (pos[3][0] - pos[1][0]) * (pos[2][1] - pos[0][1]));
|
||||
if (rd != 0)
|
||||
{
|
||||
rd = 1.0f / rd;
|
||||
float rn = ((pos[3][0] - pos[1][0]) * (pos[0][1] - pos[1][1]) - (pos[3][1] - pos[1][1]) * (pos[0][0] - pos[1][0])) * rd;
|
||||
float sn = ((pos[2][0] - pos[0][0]) * (pos[0][1] - pos[1][1]) - (pos[2][1] - pos[0][1]) * (pos[0][0] - pos[1][0])) * rd;
|
||||
if (!(rn < 0.f || rn > 1.f || sn < 0.f || sn > 1.f))
|
||||
{
|
||||
center.x = pos[0][0] + rn * (pos[2][0] - pos[0][0]);
|
||||
center.y = pos[0][1] + rn * (pos[2][1] - pos[0][1]);
|
||||
}
|
||||
float d[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
d[i] = std::sqrt((pos[i][0] - center.x) * (pos[i][0] - center.x) + (pos[i][1] - center.y) * (pos[i][1] - center.y));
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
float q = d[i] == 0.0f ? 1.0f : (d[i] + d[(i + 2) & 3]) / d[(i + 2) & 3];
|
||||
di.uv[i] *= q;
|
||||
di.w[i] *= q;
|
||||
di.z[i] = pos[i][2];
|
||||
di.pos[i] = { (pos[i][0] * vInvScreenSize.x) * 2.0f - 1.0f, ((pos[i][1] * vInvScreenSize.y) * 2.0f - 1.0f) * -1.0f };
|
||||
}
|
||||
di.mode = nDecalMode;
|
||||
di.structure = nDecalStructure;
|
||||
di.depth = true;
|
||||
vLayers[nTargetLayer].vecDecalInstance.push_back(di);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PixelGameEngine::DrawLineDecal(const olc::vf2d& pos1, const olc::vf2d& pos2, Pixel p)
|
||||
@ -5284,7 +5358,6 @@ namespace olc
|
||||
switch (mode)
|
||||
{
|
||||
case olc::DecalMode::NORMAL:
|
||||
case olc::DecalMode::MODEL3D:
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
case olc::DecalMode::ADDITIVE:
|
||||
@ -5337,58 +5410,18 @@ namespace olc
|
||||
else
|
||||
glBindTexture(GL_TEXTURE_2D, decal.decal->id);
|
||||
|
||||
if (nDecalMode == DecalMode::MODEL3D)
|
||||
if (decal.depth)
|
||||
{
|
||||
#ifdef OLC_ENABLE_EXPERIMENTAL
|
||||
glMatrixMode(GL_PROJECTION); glPushMatrix();
|
||||
glMatrixMode(GL_MODELVIEW); glPushMatrix();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1, 1000);
|
||||
|
||||
#pragma comment (lib, "winmm.lib")
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, -40, -200);
|
||||
glRotatef(float(clock()) * 0.1f, 1, 0, 0);
|
||||
glRotatef(float(clock()) * 0.1f * 2, 0, 1, 0);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
|
||||
// Render as 3D Spatial Entity
|
||||
for (uint32_t n = 0; n < decal.points; n++)
|
||||
{
|
||||
glColor4ub(decal.tint[n].r, decal.tint[n].g, decal.tint[n].b, decal.tint[n].a);
|
||||
glTexCoord2f(decal.uv[n].x, decal.uv[n].y);
|
||||
glVertex3f(decal.pos[n].x, decal.pos[n].y, decal.w[n]);
|
||||
glTexCoord4f(decal.uv[n].x, decal.uv[n].y, 0.0f, decal.w[n]);
|
||||
glVertex3f(decal.pos[n].x, decal.pos[n].y, decal.z[n]);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
glMatrixMode(GL_PROJECTION); glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW); glPopMatrix();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nDecalMode == DecalMode::WIREFRAME)
|
||||
glBegin(GL_LINE_LOOP);
|
||||
else
|
||||
{
|
||||
if(decal.structure == olc::DecalStructure::FAN)
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
else if(decal.structure == olc::DecalStructure::STRIP)
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
else if(decal.structure == olc::DecalStructure::LIST)
|
||||
glBegin(GL_TRIANGLES);
|
||||
}
|
||||
|
||||
// Render as 2D Spatial entity
|
||||
for (uint32_t n = 0; n < decal.points; n++)
|
||||
@ -5397,12 +5430,15 @@ namespace olc
|
||||
glTexCoord4f(decal.uv[n].x, decal.uv[n].y, 0.0f, decal.w[n]);
|
||||
glVertex2f(decal.pos[n].x, decal.pos[n].y);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
glEnd();
|
||||
|
||||
if (decal.depth)
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t CreateTexture(const uint32_t width, const uint32_t height, const bool filtered, const bool clamp) override
|
||||
|
BIN
ClassDiagram.png
Normal file
BIN
ClassDiagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 388 KiB |
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user