Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragonrster committed Apr 30, 2023
2 parents 76ea7de + 60a7ce1 commit b6bcdce
Show file tree
Hide file tree
Showing 49 changed files with 469 additions and 498 deletions.
4 changes: 2 additions & 2 deletions src/PowderToyRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ int main(int argc, char *argv[])
else
{
int w = Graphics::TextSize("Save file invalid").X + 15, x = (XRES-w)/2, y = (YRES-24)/2;
ren->drawrect(x, y, w, 24, 192, 192, 192, 255);
ren->BlendText({ x+8, y+8 }, "Save file invalid", RGBA<uint8_t>(192, 192, 240, 255));
ren->DrawRect(RectSized(Vec2{ x, y }, Vec2{ w, 24 }), 0xC0C0C0_rgb);
ren->BlendText({ x+8, y+8 }, "Save file invalid", 0xC0C0F0_rgb .WithAlpha(255));
}

ren->RenderBegin();
Expand Down
17 changes: 8 additions & 9 deletions src/debug/DebugLines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,25 @@ void DebugLines::Draw()
ui::Point drawPoint1 = controller->PointTranslate(view->GetLineStartCoords()), drawPoint2 = controller->PointTranslate(view->GetLineFinishCoords());
if (view->GetDrawSnap())
drawPoint2 = view->lineSnapCoords(drawPoint1, drawPoint2);
//g->draw_line(drawPoint1.X, drawPoint1.Y, drawPoint2.X, drawPoint2.Y, 255, 0, 255, 255);

g->draw_line(0, drawPoint1.Y, XRES, drawPoint1.Y, 255, 255, 255, 120);
g->draw_line(drawPoint1.X, 0, drawPoint1.X, YRES, 255, 255, 255, 120);
g->BlendLine({ 0, drawPoint1.Y }, { XRES, drawPoint1.Y }, 0xFFFFFF_rgb .WithAlpha(120));
g->BlendLine({ drawPoint1.X, 0 }, { drawPoint1.X, YRES }, 0xFFFFFF_rgb .WithAlpha(120));

g->draw_line(0, drawPoint2.Y, XRES, drawPoint2.Y, 255, 255, 255, 120);
g->draw_line(drawPoint2.X, 0, drawPoint2.X, YRES, 255, 255, 255, 120);
g->BlendLine({ 0, drawPoint2.Y }, { XRES, drawPoint2.Y }, 0xFFFFFF_rgb .WithAlpha(120));
g->BlendLine({ drawPoint2.X, 0 }, { drawPoint2.X, YRES }, 0xFFFFFF_rgb .WithAlpha(120));

String info;
info = String::Build(drawPoint2.X, " x ", drawPoint2.Y);
g->BlendTextOutline({ drawPoint2.X+(drawPoint2.X>drawPoint1.X?3:-(g->TextSize(info).X-1)-3), drawPoint2.Y+(drawPoint2.Y<drawPoint1.Y?-10:3) }, info, RGBA<uint8_t>(255, 255, 255, 200));
g->BlendTextOutline({ drawPoint2.X+(drawPoint2.X>drawPoint1.X?3:-(g->TextSize(info).X-1)-3), drawPoint2.Y+(drawPoint2.Y<drawPoint1.Y?-10:3) }, info, 0xFFFFFF_rgb .WithAlpha(200));

info = String::Build(drawPoint1.X, " x ", drawPoint1.Y);
g->BlendTextOutline({ drawPoint1.X+(drawPoint2.X<drawPoint1.X?3:-(g->TextSize(info).X-1)-2), drawPoint1.Y+(drawPoint2.Y>drawPoint1.Y?-10:3) }, info, RGBA<uint8_t>(255, 255, 255, 200));
g->BlendTextOutline({ drawPoint1.X+(drawPoint2.X<drawPoint1.X?3:-(g->TextSize(info).X-1)-2), drawPoint1.Y+(drawPoint2.Y>drawPoint1.Y?-10:3) }, info, 0xFFFFFF_rgb .WithAlpha(200));

info = String::Build(std::abs(drawPoint2.X-drawPoint1.X));
g->BlendTextOutline({ (drawPoint1.X+drawPoint2.X)/2-(g->TextSize(info).X-1)/2, drawPoint1.Y+(drawPoint2.Y>drawPoint1.Y?-10:3) }, info, RGBA<uint8_t>(255, 255, 255, 200));
g->BlendTextOutline({ (drawPoint1.X+drawPoint2.X)/2-(g->TextSize(info).X-1)/2, drawPoint1.Y+(drawPoint2.Y>drawPoint1.Y?-10:3) }, info, 0xFFFFFF_rgb .WithAlpha(200));

info = String::Build(std::abs(drawPoint2.Y-drawPoint1.Y));
g->BlendTextOutline({ drawPoint1.X+(drawPoint2.X<drawPoint1.X?3:-(g->TextSize(info).X-1)-2), (drawPoint1.Y+drawPoint2.Y)/2-3 }, info, RGBA<uint8_t>(255, 255, 255, 200));
g->BlendTextOutline({ drawPoint1.X+(drawPoint2.X<drawPoint1.X?3:-(g->TextSize(info).X-1)-2), (drawPoint1.Y+drawPoint2.Y)/2-3 }, info, 0xFFFFFF_rgb .WithAlpha(200));
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/debug/DebugParts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ void DebugParts::Draw()
for (int i = 0; i < NPART; i++)
{
if (sim->parts[i].type)
g->AddPixel({ x, y }, RGBA<uint8_t>(255, 255, 255, 180));
g->AddPixel({ x, y }, 0xFFFFFF_rgb .WithAlpha(180));
else
g->AddPixel({ x, y }, RGBA<uint8_t>(0, 0, 0, 180));
g->AddPixel({ x, y }, 0x000000_rgb .WithAlpha(180));

if (i == sim->parts_lastActiveIndex)
{
Expand All @@ -38,17 +38,17 @@ void DebugParts::Draw()
x = 0;
}
}
g->draw_line(0, lpy, XRES, lpy, 0, 255, 120, 255);
g->draw_line(lpx, 0, lpx, YRES, 0, 255, 120, 255);
g->AddPixel({ lpx, lpy }, RGBA<uint8_t>(255, 50, 50, 220));
g->DrawLine({ 0, lpy }, { XRES, lpy }, 0x00FF78_rgb);
g->DrawLine({ lpx, 0 }, { lpx, YRES }, 0x00FF78_rgb);
g->AddPixel({ lpx, lpy }, 0xFF3232_rgb .WithAlpha(220));

g->AddPixel({ lpx+1, lpy }, RGBA<uint8_t>(255, 50, 50, 120));
g->AddPixel({ lpx-1, lpy }, RGBA<uint8_t>(255, 50, 50, 120));
g->AddPixel({ lpx, lpy+1 }, RGBA<uint8_t>(255, 50, 50, 120));
g->AddPixel({ lpx, lpy-1 }, RGBA<uint8_t>(255, 50, 50, 120));
g->AddPixel({ lpx+1, lpy }, 0xFF3232_rgb .WithAlpha(120));
g->AddPixel({ lpx-1, lpy }, 0xFF3232_rgb .WithAlpha(120));
g->AddPixel({ lpx, lpy+1 }, 0xFF3232_rgb .WithAlpha(120));
g->AddPixel({ lpx, lpy-1 }, 0xFF3232_rgb .WithAlpha(120));

g->fillrect(7, YRES-26, g->TextSize(info).X + 4, 14, 0, 0, 0, 180);
g->BlendText({ 10, YRES-22 }, info, RGBA<uint8_t>(255, 255, 255, 255));
g->BlendFilledRect(RectSized(Vec2{ 7, YRES-26}, Vec2{ g->TextSize(info).X + 4, 14}), 0x000000_rgb .WithAlpha(180));
g->BlendText({ 10, YRES-22 }, info, 0xFFFFFF_rgb .WithAlpha(255));
}

DebugParts::~DebugParts()
Expand Down
20 changes: 10 additions & 10 deletions src/debug/ElementPopulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void ElementPopulationDebug::Draw()
halfValString = String::Build(maxAverage/2);


g->fillrect(xStart-5, yBottom - 263, bars+10+Graphics::TextSize(maxValString).X+9, 255 + 13, 0, 0, 0, 180);
g->BlendFilledRect(RectSized(Vec2{ xStart-5, yBottom - 263 }, Vec2{ bars+10+Graphics::TextSize(maxValString).X+9, 255 + 13 }), 0x000000_rgb .WithAlpha(180));

bars = 0;
for(int i = 0; i < PT_NUM; i++)
Expand All @@ -57,28 +57,28 @@ void ElementPopulationDebug::Draw()

RGB<uint8_t> colour = sim->elements[i].Colour;

g->draw_line(xStart+barX, yBottom+3, xStart+barX, yBottom+2, colour.Red, colour.Green, colour.Blue, 255);
g->DrawLine({ xStart+barX, yBottom+3 }, { xStart+barX, yBottom+2 }, colour);
if(sim->elementCount[i])
{
if(barSize > 256)
{
barSize = 256;
g->blendpixel(xStart+barX, yBottom-barSize-3, colour.Red, colour.Green, colour.Blue, 255);
g->blendpixel(xStart+barX, yBottom-barSize-5, colour.Red, colour.Green, colour.Blue, 255);
g->blendpixel(xStart+barX, yBottom-barSize-7, colour.Red, colour.Green, colour.Blue, 255);
g->DrawPixel({ xStart+barX, yBottom-barSize-3 }, colour);
g->DrawPixel({ xStart+barX, yBottom-barSize-5 }, colour);
g->DrawPixel({ xStart+barX, yBottom-barSize-7 }, colour);
} else {

g->draw_line(xStart+barX, yBottom-barSize-3, xStart+barX, yBottom-barSize-2, 255, 255, 255, 180);
g->BlendLine({ xStart+barX, yBottom-barSize-3 }, { xStart+barX, yBottom-barSize-2 }, 0xFFFFFF_rgb .WithAlpha(180));
}
g->draw_line(xStart+barX, yBottom-barSize, xStart+barX, yBottom, colour.Red, colour.Green, colour.Blue, 255);
g->DrawLine({ xStart+barX, yBottom-barSize }, { xStart+barX, yBottom }, colour);
}
bars++;
}
}

g->BlendText({ xStart + bars + 5, yBottom-5 }, "0", RGBA<uint8_t>(255, 255, 255, 255));
g->BlendText({ xStart + bars + 5, yBottom-132 }, halfValString, RGBA<uint8_t>(255, 255, 255, 255));
g->BlendText({ xStart + bars + 5, yBottom-260 }, maxValString, RGBA<uint8_t>(255, 255, 255, 255));
g->BlendText({ xStart + bars + 5, yBottom-5 }, "0", 0xFFFFFF_rgb .WithAlpha(255));
g->BlendText({ xStart + bars + 5, yBottom-132 }, halfValString, 0xFFFFFF_rgb .WithAlpha(255));
g->BlendText({ xStart + bars + 5, yBottom-260 }, maxValString, 0xFFFFFF_rgb .WithAlpha(255));
}

ElementPopulationDebug::~ElementPopulationDebug()
Expand Down
Loading

0 comments on commit b6bcdce

Please sign in to comment.