Update PGE header
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
adc9296171
commit
c1ab45ff3f
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -8,7 +8,7 @@
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/a.out",
|
||||
"program": "${workspaceFolder}/C++ProjectTemplate",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${fileDirname}",
|
||||
|
Binary file not shown.
BIN
a.out
BIN
a.out
Binary file not shown.
@ -3,7 +3,7 @@
|
||||
olcPixelGameEngine.h
|
||||
|
||||
+-------------------------------------------------------------+
|
||||
| OneLoneCoder Pixel Game Engine v2.19 |
|
||||
| OneLoneCoder Pixel Game Engine v2.20 |
|
||||
| "What do you need? Pixels... Lots of Pixels..." - javidx9 |
|
||||
+-------------------------------------------------------------+
|
||||
|
||||
@ -187,6 +187,8 @@
|
||||
AlterEgo...........Final Fantasy XII - The Zodiac Age
|
||||
SlicEnDicE.........Noita, Inside
|
||||
TGD................Voucher Gift
|
||||
Dragoneye..........Lucas Arts Adventure Game Pack
|
||||
Anonymous Pirate...Return To Monkey Island
|
||||
|
||||
Special thanks to my Patreons too - I wont name you on here, but I've
|
||||
certainly enjoyed my tea and flapjacks :D
|
||||
@ -297,8 +299,15 @@
|
||||
+ConsoleClear() - Clears built in command console output
|
||||
+ConsoleOut() - Stream strings to command console output
|
||||
+ConsoleCaptureStdOut() - Capture std::cout by redirecting to built-in console
|
||||
+IsConsoleShowing() - Returns true if console is currently active
|
||||
+OnConsoleCommand() - Override is called when command is entered into built in console
|
||||
2.20: +DrawRectDecal() - Keeps OneSketchyGuy quiet
|
||||
+GetScreenSize()
|
||||
+olc::Sprite::Size() - returns size of sprite in vector format
|
||||
|
||||
SIG Updates:
|
||||
The following additions are included in Sig's version of the PGE header (this is a sig version)
|
||||
+GetAnyKey() - Returns when a key is activated
|
||||
+GetAnyKeyPress() - Returns when a key is pressed down (and if a keyboard key, which key it was)
|
||||
|
||||
!! 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 !!
|
||||
@ -378,7 +387,7 @@ int main()
|
||||
#include <cstring>
|
||||
#pragma endregion
|
||||
|
||||
#define PGE_VER 219
|
||||
#define PGE_VER 220
|
||||
|
||||
// O------------------------------------------------------------------------------O
|
||||
// | COMPILER CONFIGURATION ODDITIES |
|
||||
@ -771,6 +780,7 @@ namespace olc
|
||||
Pixel* GetData();
|
||||
olc::Sprite* Duplicate();
|
||||
olc::Sprite* Duplicate(const olc::vi2d& vPos, const olc::vi2d& vSize);
|
||||
olc::vi2d Size() const;
|
||||
std::vector<olc::Pixel> pColData;
|
||||
Mode modeSample = Mode::NORMAL;
|
||||
|
||||
@ -982,6 +992,8 @@ namespace olc
|
||||
const olc::vi2d& GetPixelSize() const;
|
||||
// Gets actual pixel scale
|
||||
const olc::vi2d& GetScreenPixelSize() const;
|
||||
// Gets "screen" size
|
||||
const olc::vi2d& GetScreenSize() const;
|
||||
|
||||
public: // CONFIGURATION ROUTINES
|
||||
// Layer targeting functions
|
||||
@ -1076,6 +1088,7 @@ namespace olc
|
||||
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 });
|
||||
// Draws a single shaded filled rectangle as a decal
|
||||
void DrawRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE);
|
||||
void FillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE);
|
||||
// Draws a corner shaded rectangle as a decal
|
||||
void GradientFillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel colTL, const olc::Pixel colBL, const olc::Pixel colBR, const olc::Pixel colTR);
|
||||
@ -1086,7 +1099,6 @@ namespace olc
|
||||
|
||||
// Draws a line in Decal Space
|
||||
void DrawLineDecal(const olc::vf2d& pos1, const olc::vf2d& pos2, Pixel p = olc::WHITE);
|
||||
void DrawRectDecal(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 });
|
||||
void DrawRotatedStringPropDecal(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 });
|
||||
// Clears entire draw target to Pixel
|
||||
@ -1114,7 +1126,6 @@ namespace olc
|
||||
std::string TextEntryGetString() const;
|
||||
int32_t TextEntryGetCursor() const;
|
||||
bool IsTextEntryEnabled() const;
|
||||
void SetFPSDisplay(bool display);
|
||||
|
||||
|
||||
|
||||
@ -1152,7 +1163,6 @@ namespace olc
|
||||
#endif
|
||||
public: // Branding
|
||||
std::string sAppName;
|
||||
Renderable fontRenderable;
|
||||
|
||||
private: // Inner mysterious workings
|
||||
olc::Sprite* pDrawTarget = nullptr;
|
||||
@ -1178,8 +1188,8 @@ namespace olc
|
||||
float fFrameTimer = 1.0f;
|
||||
float fLastElapsed = 0.0f;
|
||||
int nFrameCount = 0;
|
||||
bool showFPS = true;
|
||||
bool bSuspendTextureTransfer = false;
|
||||
Renderable fontRenderable;
|
||||
std::vector<LayerDesc> vLayers;
|
||||
uint8_t nTargetLayer = 0;
|
||||
uint32_t nLastFPS = 0;
|
||||
@ -1511,6 +1521,11 @@ namespace olc
|
||||
return spr;
|
||||
}
|
||||
|
||||
olc::vi2d olc::Sprite::Size() const
|
||||
{
|
||||
return { width, height };
|
||||
}
|
||||
|
||||
// O------------------------------------------------------------------------------O
|
||||
// | olc::Decal IMPLEMENTATION |
|
||||
// O------------------------------------------------------------------------------O
|
||||
@ -1947,6 +1962,9 @@ namespace olc
|
||||
const olc::vi2d& PixelGameEngine::GetScreenPixelSize() const
|
||||
{ return vScreenPixelSize; }
|
||||
|
||||
const olc::vi2d& PixelGameEngine::GetScreenSize() const
|
||||
{ return vScreenSize; }
|
||||
|
||||
const olc::vi2d& PixelGameEngine::GetWindowMouse() const
|
||||
{ return vMouseWindowPos; }
|
||||
|
||||
@ -2670,7 +2688,12 @@ namespace olc
|
||||
|
||||
void PixelGameEngine::DrawLineDecal(const olc::vf2d& pos1, const olc::vf2d& pos2, Pixel p)
|
||||
{
|
||||
DecalInstance di;
|
||||
auto m = nDecalMode;
|
||||
nDecalMode = olc::DecalMode::WIREFRAME;
|
||||
DrawPolygonDecal(nullptr, { pos1, pos2 }, { {0, 0}, {0,0} }, p);
|
||||
nDecalMode = m;
|
||||
|
||||
/*DecalInstance di;
|
||||
di.decal = nullptr;
|
||||
di.points = uint32_t(2);
|
||||
di.pos.resize(di.points);
|
||||
@ -2686,19 +2709,26 @@ namespace olc
|
||||
di.tint[1] = p;
|
||||
di.w[1] = 1.0f;
|
||||
di.mode = olc::DecalMode::WIREFRAME;
|
||||
vLayers[nTargetLayer].vecDecalInstance.push_back(di);
|
||||
di.structure = nDecalStructure;
|
||||
vLayers[nTargetLayer].vecDecalInstance.push_back(di);*/
|
||||
}
|
||||
|
||||
void PixelGameEngine::DrawRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col) {
|
||||
DrawLineDecal(pos,{pos.x+size.x,pos.y},col);
|
||||
DrawLineDecal({pos.x,pos.y},{pos.x,pos.y+size.y},col);
|
||||
DrawLineDecal({pos.x,pos.y+size.y},{pos.x+size.x,pos.y+size.y},col);
|
||||
DrawLineDecal({pos.x+size.x,pos.y},{pos.x+size.x,pos.y+size.y},col);
|
||||
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();
|
||||
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} };
|
||||
@ -3211,9 +3241,6 @@ namespace olc
|
||||
bool PixelGameEngine::IsTextEntryEnabled() const
|
||||
{ return bTextEntryEnable; }
|
||||
|
||||
void PixelGameEngine::SetFPSDisplay(bool display)
|
||||
{ showFPS=display; }
|
||||
|
||||
|
||||
void PixelGameEngine::UpdateTextEntry()
|
||||
{
|
||||
@ -3481,11 +3508,12 @@ namespace olc
|
||||
}
|
||||
if (pressed) {
|
||||
if (keyboard) {GetAnyKeyPress((olc::Key)key);}
|
||||
else {GetAnyKeyPress(olc::Key::NONE);}}
|
||||
else {GetAnyKeyPress(olc::Key::NONE);}
|
||||
}
|
||||
};
|
||||
|
||||
ScanHardware(pKeyboardState, pKeyOldState, pKeyNewState, 256);
|
||||
ScanHardware(pMouseState, pMouseOldState, pMouseNewState, nMouseButtons,false);
|
||||
ScanHardware(pMouseState, pMouseOldState, pMouseNewState, nMouseButtons, false);
|
||||
|
||||
// Cache mouse coordinates so they remain consistent during frame
|
||||
vMousePos = vMousePosCache;
|
||||
@ -3555,21 +3583,16 @@ namespace olc
|
||||
// Present Graphics to screen
|
||||
renderer->DisplayFrame();
|
||||
|
||||
if (showFPS) {
|
||||
// Update Title Bar
|
||||
fFrameTimer += fElapsedTime;
|
||||
nFrameCount++;
|
||||
if (fFrameTimer >= 1.0f)
|
||||
{
|
||||
nLastFPS = nFrameCount;
|
||||
fFrameTimer -= 1.0f;
|
||||
std::string sTitle = "OneLoneCoder.com - Pixel Game Engine - " + sAppName + " - FPS: " + std::to_string(nFrameCount);
|
||||
platform->SetWindowTitle(sTitle);
|
||||
nFrameCount = 0;
|
||||
}
|
||||
} else {
|
||||
std::string sTitle = "OneLoneCoder.com - Pixel Game Engine - " + sAppName;
|
||||
// Update Title Bar
|
||||
fFrameTimer += fElapsedTime;
|
||||
nFrameCount++;
|
||||
if (fFrameTimer >= 1.0f)
|
||||
{
|
||||
nLastFPS = nFrameCount;
|
||||
fFrameTimer -= 1.0f;
|
||||
std::string sTitle = "OneLoneCoder.com - Pixel Game Engine - " + sAppName + " - FPS: " + std::to_string(nFrameCount);
|
||||
platform->SetWindowTitle(sTitle);
|
||||
nFrameCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
2
sig
2
sig
@ -1,4 +1,4 @@
|
||||
export AUTO_UPDATE=true
|
||||
export AUTO_UPDATE=false
|
||||
|
||||
source utils/define.sh
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user