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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TiledCollisionEditor/Tiles/tilemap-3-normal.png b/TiledCollisionEditor/Tiles/tilemap-3-normal.png
new file mode 100644
index 0000000..ddd413e
Binary files /dev/null and b/TiledCollisionEditor/Tiles/tilemap-3-normal.png differ
diff --git a/TiledCollisionEditor/font.png b/TiledCollisionEditor/font.png
new file mode 100644
index 0000000..a29f329
Binary files /dev/null and b/TiledCollisionEditor/font.png differ
diff --git a/TiledCollisionEditor/font2.png b/TiledCollisionEditor/font2.png
new file mode 100644
index 0000000..daeb4e6
Binary files /dev/null and b/TiledCollisionEditor/font2.png differ
diff --git a/TiledCollisionEditor/font3.png b/TiledCollisionEditor/font3.png
new file mode 100644
index 0000000..348a508
Binary files /dev/null and b/TiledCollisionEditor/font3.png differ
diff --git a/TiledCollisionEditor/main.cpp b/TiledCollisionEditor/main.cpp
index fec3c58..6751bce 100644
--- a/TiledCollisionEditor/main.cpp
+++ b/TiledCollisionEditor/main.cpp
@@ -6,7 +6,7 @@
using namespace olc;
using namespace olc::utils;
-const std::string TILESET_DIR="./assets/Tiles/";
+const std::string TILESET_DIR="./Tiles/";
class TiledCollisionEditor : public olc::PixelGameEngine
{
@@ -29,7 +29,7 @@ public:
public:
bool OnUserCreate() override
{
- SetFontSprite("assets/font.png");
+ SetFontSprite("font3.png");
std::string tilesetFilename=TILESET_DIR+"Basic Tileset.tsx";
Tileset&tileset=tilesets[tilesetFilename]=TSXParser{tilesetFilename}.GetData();
@@ -44,7 +44,7 @@ public:
bool OnUserUpdate(float fElapsedTime) override
{
Clear(VERY_DARK_BLUE);
-
+/*
view.HandlePanAndZoom();
const Tileset&tileset=tilesets[activeTileset];
@@ -62,17 +62,17 @@ public:
}
for(auto&[objName,obj]:tileset.objects){
- view.FillRectDecal(obj.bounds.pos,vf2d{2.f,float(obj.bounds.size.y)},YELLOW);
- view.FillRectDecal(obj.bounds.pos,vf2d{float(obj.bounds.size.x),2},YELLOW);
- view.FillRectDecal(obj.bounds.pos+obj.bounds.size,vf2d{-2.f,-float(obj.bounds.size.y)},YELLOW);
- view.FillRectDecal(obj.bounds.pos+obj.bounds.size,vf2d{-float(obj.bounds.size.x),-2.f},YELLOW);
+ view.DrawLineDecal(obj.bounds.pos,obj.bounds.pos+vf2d{2.f,float(obj.bounds.size.y)},YELLOW);
+ view.DrawLineDecal(obj.bounds.pos,obj.bounds.pos+vf2d{float(obj.bounds.size.x),2},YELLOW);
+ view.DrawLineDecal(obj.bounds.pos+obj.bounds.size,obj.bounds.pos+obj.bounds.size+vf2d{-2.f,-float(obj.bounds.size.y)},YELLOW);
+ view.DrawLineDecal(obj.bounds.pos+obj.bounds.size,obj.bounds.pos+obj.bounds.size+vf2d{-float(obj.bounds.size.x),-2.f},YELLOW);
vi2d nameTextSize=GetTextSizeProp(objName)*0.25f;
view.GradientFillRectDecal(obj.bounds.pos,nameTextSize+vf2d{2,2},RED,{255,0,0,64},{255,0,0,64},RED);
view.DrawStringPropDecal(obj.bounds.pos+vf2d{1.25f,1.25f},objName,BLACK,vf2d{0.25f,0.25f});
view.DrawStringPropDecal(obj.bounds.pos+vf2d{1,1},objName,WHITE,vf2d{0.25f,0.25f});
- if(geom2d::contains(obj.bounds,GetMousePos())){
+ if(geom2d::contains(obj.bounds,view.ScreenToWorld(GetMousePos()))){
selectedObj=objName;
}
}
@@ -127,13 +127,13 @@ public:
view.DrawPolygonDecal(nullptr,points,uvs,cols);
}
}
-
- /* Font test.
- DrawStringDecal({0,0},"the quick brown fox jumps over the lazy dog",WHITE,{1.5f,1.5f});
- DrawStringDecal({0,18},"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG",WHITE,{1.5f,1.5f});
- DrawStringPropDecal({0,36},"the quick brown fox jumps over the lazy dog",WHITE,{1.5f,1.5f});
- DrawStringPropDecal({0,54},"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG",WHITE,{1.5f,1.5f});
*/
+ //Font test.
+ DrawStringDecal({0,0},"the quick brown fox jumps over the lazy dog 1234567890 !@#$%^&*()-=_+[]{}\\;':\",./<>?~`",WHITE,{1.5f,1.5f});
+ DrawStringDecal({0,18},"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 1234567890 !@#$%^&*()-=_+[]{}\\;':\",./<>?~`",WHITE,{1.5f,1.5f});
+ DrawStringPropDecal({0,36},"the quick brown fox jumps over the lazy dog 1234567890 !@#$%^&*()-=_+[]{}\\;':\",./<>?~`",WHITE,{1.5f,1.5f});
+ DrawStringPropDecal({0,54},"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 1234567890 !@#$%^&*()-=_+[]{}\\;':\",./<>?~`",WHITE,{1.5f,1.5f});
+
return true;
}
diff --git a/TiledCollisionEditor/pixelGameEngine.h b/TiledCollisionEditor/pixelGameEngine.h
index 8e17d03..043373d 100644
--- a/TiledCollisionEditor/pixelGameEngine.h
+++ b/TiledCollisionEditor/pixelGameEngine.h
@@ -3303,18 +3303,18 @@ namespace olc
{
if (c == '\n')
{
- spos.x = 0; spos.y += 8.0f * scale.y;
+ spos.x = 0; spos.y += 16.0f * scale.y;
}
else if (c == '\t')
{
- spos.x += 8.0f * float(nTabSizeInSpaces) * scale.x;
+ spos.x += 16.0f * float(nTabSizeInSpaces) * scale.x;
}
else
{
int32_t ox = (c - 32) % 16;
int32_t oy = (c - 32) / 16;
- DrawPartialDecal(pos + spos, fontRenderable.Decal(), {float(ox) * 8.0f, float(oy) * 8.0f}, {8.0f, 8.0f}, scale, col);
- spos.x += 8.0f * scale.x;
+ DrawPartialDecal(pos + spos, fontRenderable.Decal(), {float(ox) * 16.0f, float(oy) * 16.0f}, {16.0f, 16.0f}, scale, col);
+ spos.x += 16.0f * scale.x;
}
}
}
@@ -3326,17 +3326,17 @@ namespace olc
{
if (c == '\n')
{
- spos.x = 0; spos.y += 8.0f * scale.y;
+ spos.x = 0; spos.y += 16.0f * scale.y;
}
else if (c == '\t')
{
- spos.x += 8.0f * float(nTabSizeInSpaces) * scale.x;
+ spos.x += 16.0f * float(nTabSizeInSpaces) * scale.x;
}
else
{
int32_t ox = (c - 32) % 16;
int32_t oy = (c - 32) / 16;
- DrawPartialDecal(pos + spos, fontRenderable.Decal(), { float(ox) * 8.0f + float(vFontSpacing[c - 32].x), float(oy) * 8.0f }, { float(vFontSpacing[c - 32].y), 8.0f }, scale, col);
+ DrawPartialDecal(pos + spos, fontRenderable.Decal(), { float(ox) * 16.0f + float(vFontSpacing[c - 32].x), float(oy) * 16.0f }, { float(vFontSpacing[c - 32].y), 16.0f }, scale, col);
spos.x += float(vFontSpacing[c - 32].y) * scale.x;
}
}
@@ -3349,18 +3349,18 @@ namespace olc
{
if (c == '\n')
{
- spos.x = center.x; spos.y -= 8.0f;
+ spos.x = center.x; spos.y -= 16.0f;
}
else if (c == '\t')
{
- spos.x += 8.0f * float(nTabSizeInSpaces) * scale.x;
+ spos.x += 16.0f * float(nTabSizeInSpaces) * scale.x;
}
else
{
int32_t ox = (c - 32) % 16;
int32_t oy = (c - 32) / 16;
- DrawPartialRotatedDecal(pos, fontRenderable.Decal(), fAngle, spos, { float(ox) * 8.0f, float(oy) * 8.0f }, { 8.0f, 8.0f }, scale, col);
- spos.x -= 8.0f;
+ DrawPartialRotatedDecal(pos, fontRenderable.Decal(), fAngle, spos, { float(ox) * 16.0f, float(oy) * 16.0f }, { 16.0f, 16.0f }, scale, col);
+ spos.x -= 16.0f;
}
}
}
@@ -3372,17 +3372,17 @@ namespace olc
{
if (c == '\n')
{
- spos.x = center.x; spos.y -= 8.0f;
+ spos.x = center.x; spos.y -= 16.0f;
}
else if (c == '\t')
{
- spos.x += 8.0f * float(nTabSizeInSpaces) * scale.x;
+ spos.x += 16.0f * float(nTabSizeInSpaces) * scale.x;
}
else
{
int32_t ox = (c - 32) % 16;
int32_t oy = (c - 32) / 16;
- DrawPartialRotatedDecal(pos, fontRenderable.Decal(), fAngle, spos, { float(ox) * 8.0f + float(vFontSpacing[c - 32].x), float(oy) * 8.0f }, { float(vFontSpacing[c - 32].y), 8.0f }, scale, col);
+ DrawPartialRotatedDecal(pos, fontRenderable.Decal(), fAngle, spos, { float(ox) * 16.0f + float(vFontSpacing[c - 32].x), float(oy) * 16.0f }, { float(vFontSpacing[c - 32].y), 16.0f }, scale, col);
spos.x -= float(vFontSpacing[c - 32].y);
}
}
@@ -3629,11 +3629,11 @@ namespace olc
// Draw the console buffer
SetDecalMode(olc::DecalMode::NORMAL);
for (int32_t nLine = 0; nLine < vConsoleSize.y; nLine++)
- DrawStringDecal(olc::vf2d( 1, 1 + float(nLine) ) * vConsoleCharacterScale * 8.0f, sConsoleLines[nLine], olc::WHITE, vConsoleCharacterScale);
+ DrawStringDecal(olc::vf2d( 1, 1 + float(nLine) ) * vConsoleCharacterScale * 16.0f, sConsoleLines[nLine], olc::WHITE, vConsoleCharacterScale);
// Draw Input State
- FillRectDecal(olc::vf2d(1 + float((TextEntryGetCursor() + 1)), 1 + float((vConsoleSize.y - 1))) * vConsoleCharacterScale * 8.0f, olc::vf2d(8, 8) * vConsoleCharacterScale, olc::DARK_CYAN);
- DrawStringDecal(olc::vf2d(1, 1 + float((vConsoleSize.y - 1))) * vConsoleCharacterScale * 8.0f, std::string(">") + TextEntryGetString(), olc::YELLOW, vConsoleCharacterScale);
+ FillRectDecal(olc::vf2d(1 + float((TextEntryGetCursor() + 1)), 1 + float((vConsoleSize.y - 1))) * vConsoleCharacterScale * 16.0f, olc::vf2d(8, 8) * vConsoleCharacterScale, olc::DARK_CYAN);
+ DrawStringDecal(olc::vf2d(1, 1 + float((vConsoleSize.y - 1))) * vConsoleCharacterScale * 16.0f, std::string(">") + TextEntryGetString(), olc::YELLOW, vConsoleCharacterScale);
}
@@ -4071,12 +4071,12 @@ namespace olc
fontRenderable.Decal()->Update();
constexpr std::array vSpacing = { {
- 0x03,0x16,0x34,0x16,0x16,0x08,0x16,0x43,0x34,0x14,0x16,0x16,0x13,0x16,0x33,0x08,
- 0x08,0x17,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x24,0x15,0x06,0x07,0x16,0x17,
- 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x17,0x08,0x08,0x17,0x08,0x08,0x08,
- 0x08,0x08,0x08,0x08,0x17,0x08,0x08,0x08,0x08,0x17,0x08,0x33,0x08,0x23,0x16,0x08,
- 0x13,0x16,0x16,0x17,0x16,0x16,0x15,0x17,0x17,0x33,0x15,0x17,0x23,0x08,0x17,0x16,
- 0x07,0x07,0x24,0x17,0x24,0x17,0x16,0x08,0x23,0x17,0x17,0x25,0x32,0x15,0x07,0x00, } };
+ 0x03,0x02,0x04,0x03,0x06,0x0B,0x0A,0x03,0x04,0x04,0x04,0x06,0x03,0x03,0x03,0x05,
+ 0x06,0x05,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02,0x03,0x05,0x06,0x05,0x05,
+ 0x05,0x07,0x06,0x06,0x06,0x05,0x05,0x06,0x06,0x02,0x05,0x06,0x05,0x08,0x06,0x06,
+ 0x06,0x06,0x06,0x06,0x06,0x06,0x07,0x08,0x06,0x06,0x05,0x06,0x05,0x07,0x05,0x06,
+ 0x03,0x06,0x05,0x05,0x05,0x05,0x04,0x05,0x05,0x02,0x03,0x05,0x02,0x08,0x05,0x05,
+ 0x05,0x05,0x04,0x05,0x04,0x05,0x06,0x08,0x05,0x05,0x05,0x03,0x06,0x03,0x07,0x08, } };
for (auto c : vSpacing) vFontSpacing.push_back({ c >> 4, c & 15 });