Fix some deprecation warnings

Namely:

 - [[deprecated("Use DrawPixel/BlendPixel")]]
 - [[deprecated("Use DrawLine/BlendLine")]]
 - [[deprecated("Use DrawRect/BlendRect")]]
 - [[deprecated("Use DrawFilledRect/BlendFilledRect")]]
This commit is contained in:
Tamás Bálint Misius 2023-04-30 12:19:02 +02:00
parent 9fbb780728
commit 410dc71f42
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
47 changed files with 316 additions and 344 deletions

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
else else
{ {
int w = Graphics::TextSize("Save file invalid").X + 15, x = (XRES-w)/2, y = (YRES-24)/2; 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->DrawRect(RectSized(Vec2{ x, y }, Vec2{ w, 24 }), RGB<uint8_t>(192, 192, 192));
ren->BlendText({ x+8, y+8 }, "Save file invalid", RGBA<uint8_t>(192, 192, 240, 255)); ren->BlendText({ x+8, y+8 }, "Save file invalid", RGBA<uint8_t>(192, 192, 240, 255));
} }

View File

@ -21,13 +21,12 @@ void DebugLines::Draw()
ui::Point drawPoint1 = controller->PointTranslate(view->GetLineStartCoords()), drawPoint2 = controller->PointTranslate(view->GetLineFinishCoords()); ui::Point drawPoint1 = controller->PointTranslate(view->GetLineStartCoords()), drawPoint2 = controller->PointTranslate(view->GetLineFinishCoords());
if (view->GetDrawSnap()) if (view->GetDrawSnap())
drawPoint2 = view->lineSnapCoords(drawPoint1, drawPoint2); 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->BlendLine({ 0, drawPoint1.Y }, { XRES, drawPoint1.Y }, RGBA<uint8_t>(255, 255, 255, 120));
g->draw_line(drawPoint1.X, 0, drawPoint1.X, YRES, 255, 255, 255, 120); g->BlendLine({ drawPoint1.X, 0 }, { drawPoint1.X, YRES }, RGBA<uint8_t>(255, 255, 255, 120));
g->draw_line(0, drawPoint2.Y, XRES, drawPoint2.Y, 255, 255, 255, 120); g->BlendLine({ 0, drawPoint2.Y }, { XRES, drawPoint2.Y }, RGBA<uint8_t>(255, 255, 255, 120));
g->draw_line(drawPoint2.X, 0, drawPoint2.X, YRES, 255, 255, 255, 120); g->BlendLine({ drawPoint2.X, 0 }, { drawPoint2.X, YRES }, RGBA<uint8_t>(255, 255, 255, 120));
String info; String info;
info = String::Build(drawPoint2.X, " x ", drawPoint2.Y); info = String::Build(drawPoint2.X, " x ", drawPoint2.Y);

View File

@ -38,8 +38,8 @@ void DebugParts::Draw()
x = 0; x = 0;
} }
} }
g->draw_line(0, lpy, XRES, lpy, 0, 255, 120, 255); g->DrawLine({ 0, lpy }, { XRES, lpy }, RGB<uint8_t>(0, 255, 120));
g->draw_line(lpx, 0, lpx, YRES, 0, 255, 120, 255); g->DrawLine({ lpx, 0 }, { lpx, YRES }, RGB<uint8_t>(0, 255, 120));
g->AddPixel({ lpx, lpy }, RGBA<uint8_t>(255, 50, 50, 220)); g->AddPixel({ lpx, lpy }, RGBA<uint8_t>(255, 50, 50, 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));
@ -47,7 +47,7 @@ void DebugParts::Draw()
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, lpy-1 }, RGBA<uint8_t>(255, 50, 50, 120)); g->AddPixel({ lpx, lpy-1 }, RGBA<uint8_t>(255, 50, 50, 120));
g->fillrect(7, YRES-26, g->TextSize(info).X + 4, 14, 0, 0, 0, 180); g->BlendFilledRect(RectSized(Vec2{ 7, YRES-26}, Vec2{ g->TextSize(info).X + 4, 14}), RGBA<uint8_t>(0, 0, 0, 180));
g->BlendText({ 10, YRES-22 }, info, RGBA<uint8_t>(255, 255, 255, 255)); g->BlendText({ 10, YRES-22 }, info, RGBA<uint8_t>(255, 255, 255, 255));
} }

View File

@ -44,7 +44,7 @@ void ElementPopulationDebug::Draw()
halfValString = String::Build(maxAverage/2); 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 }), RGBA<uint8_t>(0, 0, 0, 180));
bars = 0; bars = 0;
for(int i = 0; i < PT_NUM; i++) for(int i = 0; i < PT_NUM; i++)
@ -57,20 +57,20 @@ void ElementPopulationDebug::Draw()
RGB<uint8_t> colour = sim->elements[i].Colour; 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(sim->elementCount[i])
{ {
if(barSize > 256) if(barSize > 256)
{ {
barSize = 256; barSize = 256;
g->blendpixel(xStart+barX, yBottom-barSize-3, colour.Red, colour.Green, colour.Blue, 255); g->DrawPixel({ xStart+barX, yBottom-barSize-3 }, colour);
g->blendpixel(xStart+barX, yBottom-barSize-5, colour.Red, colour.Green, colour.Blue, 255); g->DrawPixel({ xStart+barX, yBottom-barSize-5 }, colour);
g->blendpixel(xStart+barX, yBottom-barSize-7, colour.Red, colour.Green, colour.Blue, 255); g->DrawPixel({ xStart+barX, yBottom-barSize-7 }, colour);
} else { } 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 }, RGBA<uint8_t>(255, 255, 255, 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++; bars++;
} }

View File

@ -59,13 +59,4 @@ struct RasterDrawMethods
static String::const_iterator TextFit(String const &, int width); static String::const_iterator TextFit(String const &, int width);
void Clear(); void Clear();
[[deprecated("Use DrawPixel/BlendPixel")]]
void blendpixel(int x, int y, int r, int g, int b, int a);
[[deprecated("Use DrawLine/BlendLine")]]
void draw_line(int x1, int y1, int x2, int y2, int r, int g, int b, int a);
[[deprecated("Use DrawRect/BlendRect")]]
void drawrect(int x, int y, int w, int h, int r, int g, int b, int a);
[[deprecated("Use DrawFilledRect/BlendFilledRect")]]
void fillrect(int x, int y, int w, int h, int r, int g, int b, int a);
}; };

View File

@ -400,40 +400,4 @@ String::const_iterator RasterDrawMethods<Derived>::TextFit(String const &str, in
return str.end(); return str.end();
} }
template<typename Derived>
void RasterDrawMethods<Derived>::blendpixel(int x, int y, int r, int g, int b, int a)
{
if (a == 0xFF)
DrawPixel(Vec2(x, y), RGB<uint8_t>(r, g, b));
else
BlendPixel(Vec2(x, y), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::draw_line(int x1, int y1, int x2, int y2, int r, int g, int b, int a)
{
if (a == 0xFF)
DrawLine(Vec2(x1, y1), Vec2(x2, y2), RGB<uint8_t>(r, g, b));
else
BlendLine(Vec2(x1, y1), Vec2(x2, y2), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::drawrect(int x, int y, int w, int h, int r, int g, int b, int a)
{
if (a == 0xFF)
DrawRect(RectSized(Vec2(x, y), Vec2(w, h)), RGB<uint8_t>(r, g, b));
else
BlendRect(RectSized(Vec2(x, y), Vec2(w, h)), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::fillrect(int x, int y, int w, int h, int r, int g, int b, int a)
{
if (a == 0xFF)
DrawFilledRect(RectSized(Vec2(x, y), Vec2(w, h)), RGB<uint8_t>(r, g, b));
else
BlendFilledRect(RectSized(Vec2(x, y), Vec2(w, h)), RGBA<uint8_t>(r, g, b, a));
}
#undef clipRect #undef clipRect

View File

@ -151,7 +151,7 @@ void Renderer::DrawSigns()
{ {
String text = currentSign.getDisplayText(sim, x, y, w, h); String text = currentSign.getDisplayText(sim, x, y, w, h);
DrawFilledRect(RectSized(Vec2{ x + 1, y + 1 }, Vec2{ w, h - 1 }), 0x000000_rgb); DrawFilledRect(RectSized(Vec2{ x + 1, y + 1 }, Vec2{ w, h - 1 }), 0x000000_rgb);
drawrect(x, y, w+1, h, 192, 192, 192, 255); DrawRect(RectSized(Vec2{ x, y }, Vec2{ w+1, h }), RGB<uint8_t>(192, 192, 192));
BlendText({ x+3, y+4 }, text, RGBA<uint8_t>(255, 255, 255, 255)); BlendText({ x+3, y+4 }, text, RGBA<uint8_t>(255, 255, 255, 255));
if (currentSign.ju != sign::None) if (currentSign.ju != sign::None)
@ -162,7 +162,7 @@ void Renderer::DrawSigns()
int dy = (currentSign.y > 18) ? -1 : 1; int dy = (currentSign.y > 18) ? -1 : 1;
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
{ {
blendpixel(x, y, 192, 192, 192, 255); DrawPixel({ x, y }, RGB<uint8_t>(192, 192, 192));
x += dx; x += dx;
y += dy; y += dy;
} }
@ -188,9 +188,9 @@ void Renderer::render_parts()
for (nx=0; nx<XRES; nx++) for (nx=0; nx<XRES; nx++)
{ {
if (ny%(4*gridSize) == 0) if (ny%(4*gridSize) == 0)
blendpixel(nx, ny, 100, 100, 100, 80); BlendPixel({ nx, ny }, RGBA<uint8_t>(100, 100, 100, 80));
if (nx%(4*gridSize) == 0 && ny%(4*gridSize) != 0) if (nx%(4*gridSize) == 0 && ny%(4*gridSize) != 0)
blendpixel(nx, ny, 100, 100, 100, 80); BlendPixel({ nx, ny }, RGBA<uint8_t>(100, 100, 100, 80));
} }
} }
foundElements = 0; foundElements = 0;
@ -398,7 +398,7 @@ void Renderer::render_parts()
if (t==PT_SOAP) if (t==PT_SOAP)
{ {
if ((parts[i].ctype&3) == 3 && parts[i].tmp >= 0 && parts[i].tmp < NPART) if ((parts[i].ctype&3) == 3 && parts[i].tmp >= 0 && parts[i].tmp < NPART)
draw_line(nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), colr, colg, colb, cola); BlendLine({ nx, ny }, { int(parts[parts[i].tmp].x+0.5f), int(parts[parts[i].tmp].y+0.5f) }, RGBA<uint8_t>(colr, colg, colb, cola));
} }
} }
if(pixel_mode & PSPEC_STICKMAN) if(pixel_mode & PSPEC_STICKMAN)
@ -486,23 +486,23 @@ void Renderer::render_parts()
//head //head
if(t==PT_FIGH) if(t==PT_FIGH)
{ {
draw_line(nx, ny+2, nx+2, ny, colr, colg, colb, 255); DrawLine({ nx, ny+2 }, { nx+2, ny }, RGB<uint8_t>(colr, colg, colb));
draw_line(nx+2, ny, nx, ny-2, colr, colg, colb, 255); DrawLine({ nx+2, ny }, { nx, ny-2 }, RGB<uint8_t>(colr, colg, colb));
draw_line(nx, ny-2, nx-2, ny, colr, colg, colb, 255); DrawLine({ nx, ny-2 }, { nx-2, ny }, RGB<uint8_t>(colr, colg, colb));
draw_line(nx-2, ny, nx, ny+2, colr, colg, colb, 255); DrawLine({ nx-2, ny }, { nx, ny+2 }, RGB<uint8_t>(colr, colg, colb));
} }
else else
{ {
draw_line(nx-2, ny+2, nx+2, ny+2, colr, colg, colb, 255); DrawLine({ nx-2, ny+2 }, { nx+2, ny+2 }, RGB<uint8_t>(colr, colg, colb));
draw_line(nx-2, ny-2, nx+2, ny-2, colr, colg, colb, 255); DrawLine({ nx-2, ny-2 }, { nx+2, ny-2 }, RGB<uint8_t>(colr, colg, colb));
draw_line(nx-2, ny-2, nx-2, ny+2, colr, colg, colb, 255); DrawLine({ nx-2, ny-2 }, { nx-2, ny+2 }, RGB<uint8_t>(colr, colg, colb));
draw_line(nx+2, ny-2, nx+2, ny+2, colr, colg, colb, 255); DrawLine({ nx+2, ny-2 }, { nx+2, ny+2 }, RGB<uint8_t>(colr, colg, colb));
} }
//legs //legs
draw_line(nx, ny+3, int(cplayer->legs[0]), int(cplayer->legs[1]), legr, legg, legb, 255); DrawLine({ nx, ny+3 }, { int(cplayer->legs[ 0]), int(cplayer->legs[ 1]) }, RGB<uint8_t>(legr, legg, legb));
draw_line(int(cplayer->legs[0]), int(cplayer->legs[1]), int(cplayer->legs[4]), int(cplayer->legs[5]), legr, legg, legb, 255); DrawLine({ int(cplayer->legs[0]), int(cplayer->legs[1]) }, { int(cplayer->legs[ 4]), int(cplayer->legs[ 5]) }, RGB<uint8_t>(legr, legg, legb));
draw_line(nx, ny+3, int(cplayer->legs[8]), int(cplayer->legs[9]), legr, legg, legb, 255); DrawLine({ nx, ny+3 }, { int(cplayer->legs[ 8]), int(cplayer->legs[ 9]) }, RGB<uint8_t>(legr, legg, legb));
draw_line(int(cplayer->legs[8]), int(cplayer->legs[9]), int(cplayer->legs[12]), int(cplayer->legs[13]), legr, legg, legb, 255); DrawLine({ int(cplayer->legs[8]), int(cplayer->legs[9]) }, { int(cplayer->legs[12]), int(cplayer->legs[13]) }, RGB<uint8_t>(legr, legg, legb));
if (cplayer->rocketBoots) if (cplayer->rocketBoots)
{ {
for (int leg=0; leg<2; leg++) for (int leg=0; leg<2; leg++)
@ -510,18 +510,18 @@ void Renderer::render_parts()
int nx = int(cplayer->legs[leg*8+4]), ny = int(cplayer->legs[leg*8+5]); int nx = int(cplayer->legs[leg*8+4]), ny = int(cplayer->legs[leg*8+5]);
int colr = 255, colg = 0, colb = 255; int colr = 255, colg = 0, colb = 255;
if (((int)(cplayer->comm)&0x04) == 0x04 || (((int)(cplayer->comm)&0x01) == 0x01 && leg==0) || (((int)(cplayer->comm)&0x02) == 0x02 && leg==1)) if (((int)(cplayer->comm)&0x04) == 0x04 || (((int)(cplayer->comm)&0x01) == 0x01 && leg==0) || (((int)(cplayer->comm)&0x02) == 0x02 && leg==1))
blendpixel(nx, ny, 0, 255, 0, 255); DrawPixel({ nx, ny }, RGB<uint8_t>(0, 255, 0));
else else
blendpixel(nx, ny, 255, 0, 0, 255); DrawPixel({ nx, ny }, RGB<uint8_t>(255, 0, 0));
blendpixel(nx+1, ny, colr, colg, colb, 223); BlendPixel({ nx+1, ny }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx-1, ny, colr, colg, colb, 223); BlendPixel({ nx-1, ny }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx, ny+1, colr, colg, colb, 223); BlendPixel({ nx, ny+1 }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx, ny-1, colr, colg, colb, 223); BlendPixel({ nx, ny-1 }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx+1, ny-1, colr, colg, colb, 112); BlendPixel({ nx+1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, 112));
blendpixel(nx-1, ny-1, colr, colg, colb, 112); BlendPixel({ nx-1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, 112));
blendpixel(nx+1, ny+1, colr, colg, colb, 112); BlendPixel({ nx+1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, 112));
blendpixel(nx-1, ny+1, colr, colg, colb, 112); BlendPixel({ nx-1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, 112));
} }
} }
} }
@ -531,7 +531,7 @@ void Renderer::render_parts()
} }
if(pixel_mode & PMODE_BLEND) if(pixel_mode & PMODE_BLEND)
{ {
blendpixel(nx, ny, colr, colg, colb, cola); BlendPixel({ nx, ny }, RGBA<uint8_t>(colr, colg, colb, cola));
} }
if(pixel_mode & PMODE_ADD) if(pixel_mode & PMODE_ADD)
{ {
@ -541,15 +541,15 @@ void Renderer::render_parts()
{ {
video[{ nx, ny }] = RGB<uint8_t>(colr, colg, colb).Pack(); video[{ nx, ny }] = RGB<uint8_t>(colr, colg, colb).Pack();
blendpixel(nx+1, ny, colr, colg, colb, 223); BlendPixel({ nx+1, ny }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx-1, ny, colr, colg, colb, 223); BlendPixel({ nx-1, ny }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx, ny+1, colr, colg, colb, 223); BlendPixel({ nx, ny+1 }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx, ny-1, colr, colg, colb, 223); BlendPixel({ nx, ny-1 }, RGBA<uint8_t>(colr, colg, colb, 223));
blendpixel(nx+1, ny-1, colr, colg, colb, 112); BlendPixel({ nx+1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, 112));
blendpixel(nx-1, ny-1, colr, colg, colb, 112); BlendPixel({ nx-1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, 112));
blendpixel(nx+1, ny+1, colr, colg, colb, 112); BlendPixel({ nx+1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, 112));
blendpixel(nx-1, ny+1, colr, colg, colb, 112); BlendPixel({ nx-1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, 112));
} }
if(pixel_mode & PMODE_GLOW) if(pixel_mode & PMODE_GLOW)
{ {
@ -582,11 +582,11 @@ void Renderer::render_parts()
for (y=-3; y<4; y++) for (y=-3; y<4; y++)
{ {
if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2))
blendpixel(x+nx, y+ny, colr, colg, colb, 30); BlendPixel({ x+nx, y+ny }, RGBA<uint8_t>(colr, colg, colb, 30));
if (abs(x)+abs(y) <=3 && abs(x)+abs(y)) if (abs(x)+abs(y) <=3 && abs(x)+abs(y))
blendpixel(x+nx, y+ny, colr, colg, colb, 20); BlendPixel({ x+nx, y+ny }, RGBA<uint8_t>(colr, colg, colb, 20));
if (abs(x)+abs(y) == 2) if (abs(x)+abs(y) == 2)
blendpixel(x+nx, y+ny, colr, colg, colb, 10); BlendPixel({ x+nx, y+ny }, RGBA<uint8_t>(colr, colg, colb, 10));
} }
} }
} }
@ -606,16 +606,16 @@ void Renderer::render_parts()
{ {
flicker = float(rng()%20); flicker = float(rng()%20);
gradv = flicker + fabs(parts[i].vx)*17 + fabs(sim->parts[i].vy)*17; gradv = flicker + fabs(parts[i].vx)*17 + fabs(sim->parts[i].vy)*17;
blendpixel(nx, ny, colr, colg, colb, int((gradv*4)>255?255:(gradv*4)) ); BlendPixel({ nx, ny }, RGBA<uint8_t>(colr, colg, colb, int((gradv*4)>255?255:(gradv*4)) ));
blendpixel(nx+1, ny, colr, colg, colb,int( (gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx+1, ny }, RGBA<uint8_t>(colr, colg, colb,int( (gradv*2)>255?255:(gradv*2)) ));
blendpixel(nx-1, ny, colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx-1, ny }, RGBA<uint8_t>(colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ));
blendpixel(nx, ny+1, colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx, ny+1 }, RGBA<uint8_t>(colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ));
blendpixel(nx, ny-1, colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx, ny-1 }, RGBA<uint8_t>(colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ));
if (gradv>255) gradv=255; if (gradv>255) gradv=255;
blendpixel(nx+1, ny-1, colr, colg, colb, int(gradv)); BlendPixel({ nx+1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
blendpixel(nx-1, ny-1, colr, colg, colb, int(gradv)); BlendPixel({ nx-1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
blendpixel(nx+1, ny+1, colr, colg, colb, int(gradv)); BlendPixel({ nx+1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
blendpixel(nx-1, ny+1, colr, colg, colb, int(gradv)); BlendPixel({ nx-1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
for (x = 1; gradv>0.5; x++) { for (x = 1; gradv>0.5; x++) {
AddPixel({ nx+x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv))); AddPixel({ nx+x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
AddPixel({ nx-x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv))); AddPixel({ nx-x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
@ -628,16 +628,16 @@ void Renderer::render_parts()
{ {
flicker = float(rng()%20); flicker = float(rng()%20);
gradv = flicker + fabs(parts[i].vx)*17 + fabs(parts[i].vy)*17; gradv = flicker + fabs(parts[i].vx)*17 + fabs(parts[i].vy)*17;
blendpixel(nx, ny, colr, colg, colb, int((gradv*4)>255?255:(gradv*4)) ); BlendPixel({ nx, ny }, RGBA<uint8_t>(colr, colg, colb, int((gradv*4)>255?255:(gradv*4)) ));
blendpixel(nx+1, ny, colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx+1, ny }, RGBA<uint8_t>(colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ));
blendpixel(nx-1, ny, colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx-1, ny }, RGBA<uint8_t>(colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ));
blendpixel(nx, ny+1, colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx, ny+1 }, RGBA<uint8_t>(colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ));
blendpixel(nx, ny-1, colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ); BlendPixel({ nx, ny-1 }, RGBA<uint8_t>(colr, colg, colb, int((gradv*2)>255?255:(gradv*2)) ));
if (gradv>255) gradv=255; if (gradv>255) gradv=255;
blendpixel(nx+1, ny-1, colr, colg, colb, int(gradv)); BlendPixel({ nx+1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
blendpixel(nx-1, ny-1, colr, colg, colb, int(gradv)); BlendPixel({ nx-1, ny-1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
blendpixel(nx+1, ny+1, colr, colg, colb, int(gradv)); BlendPixel({ nx+1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
blendpixel(nx-1, ny+1, colr, colg, colb, int(gradv)); BlendPixel({ nx-1, ny+1 }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
for (x = 1; gradv>0.5; x++) { for (x = 1; gradv>0.5; x++) {
AddPixel({ nx+x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv))); AddPixel({ nx+x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
AddPixel({ nx-x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv))); AddPixel({ nx-x, ny }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
@ -758,7 +758,7 @@ void Renderer::draw_other() // EMP effect
for (j=0; j<YRES; j++) for (j=0; j<YRES; j++)
for (i=0; i<XRES; i++) for (i=0; i<XRES; i++)
{ {
blendpixel(i, j, r, g, b, a); BlendPixel({ i, j }, RGBA<uint8_t>(r, g, b, a));
} }
} }
} }
@ -778,9 +778,9 @@ void Renderer::draw_grav_zones()
for (j=0; j<CELL; j++)//draws the colors for (j=0; j<CELL; j++)//draws the colors
for (i=0; i<CELL; i++) for (i=0; i<CELL; i++)
if(i == j) if(i == j)
blendpixel(x*CELL+i, y*CELL+j, 255, 200, 0, 120); BlendPixel({ x*CELL+i, y*CELL+j }, RGBA<uint8_t>(255, 200, 0, 120));
else else
blendpixel(x*CELL+i, y*CELL+j, 32, 32, 32, 120); BlendPixel({ x*CELL+i, y*CELL+j }, RGBA<uint8_t>(32, 32, 32, 120));
} }
} }
} }
@ -1054,14 +1054,14 @@ void Renderer::DrawWalls()
for (int j = 0; j < CELL; j++) for (int j = 0; j < CELL; j++)
for (int i =0; i < CELL; i++) for (int i =0; i < CELL; i++)
if (i&j&1) if (i&j&1)
drawblob((x*CELL+i), (y*CELL+j), prgb.Red, prgb.Green, prgb.Blue); DrawBlob({ x*CELL+i, y*CELL+j }, prgb);
} }
else else
{ {
for (int j = 0; j < CELL; j++) for (int j = 0; j < CELL; j++)
for (int i = 0; i < CELL; i++) for (int i = 0; i < CELL; i++)
if (!(i&j&1)) if (!(i&j&1))
drawblob((x*CELL+i), (y*CELL+j), prgb.Red, prgb.Green, prgb.Blue); DrawBlob({ x*CELL+i, y*CELL+j }, prgb);
} }
} }
else if (wt == WL_WALLELEC) else if (wt == WL_WALLELEC)
@ -1070,9 +1070,9 @@ void Renderer::DrawWalls()
for (int i =0; i < CELL; i++) for (int i =0; i < CELL; i++)
{ {
if (!((y*CELL+j)%2) && !((x*CELL+i)%2)) if (!((y*CELL+j)%2) && !((x*CELL+i)%2))
drawblob((x*CELL+i), (y*CELL+j), prgb.Red, prgb.Green, prgb.Blue); DrawBlob({ x*CELL+i, y*CELL+j }, prgb);
else else
drawblob((x*CELL+i), (y*CELL+j), 0x80, 0x80, 0x80); DrawBlob({ x*CELL+i, y*CELL+j }, 0x808080_rgb);
} }
} }
else if (wt == WL_EHOLE) else if (wt == WL_EHOLE)
@ -1081,7 +1081,7 @@ void Renderer::DrawWalls()
{ {
for (int j = 0; j < CELL; j++) for (int j = 0; j < CELL; j++)
for (int i = 0; i < CELL; i++) for (int i = 0; i < CELL; i++)
drawblob((x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24); DrawBlob({ x*CELL+i, y*CELL+j }, 0x242424_rgb);
for (int j = 0; j < CELL; j += 2) for (int j = 0; j < CELL; j += 2)
for (int i = 0; i < CELL; i += 2) for (int i = 0; i < CELL; i += 2)
// looks bad if drawing black blobs // looks bad if drawing black blobs
@ -1091,30 +1091,30 @@ void Renderer::DrawWalls()
{ {
for (int j = 0; j < CELL; j += 2) for (int j = 0; j < CELL; j += 2)
for (int i = 0; i < CELL; i += 2) for (int i = 0; i < CELL; i += 2)
drawblob((x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24); DrawBlob({ x*CELL+i, y*CELL+j }, 0x242424_rgb);
} }
} }
break; break;
case 1: case 1:
for (int j = 0; j < CELL; j += 2) for (int j = 0; j < CELL; j += 2)
for (int i = (j>>1)&1; i < CELL; i += 2) for (int i = (j>>1)&1; i < CELL; i += 2)
drawblob((x*CELL+i), (y*CELL+j), prgb.Red, prgb.Green, prgb.Blue); DrawBlob({ x*CELL+i, y*CELL+j }, prgb);
break; break;
case 2: case 2:
for (int j = 0; j < CELL; j += 2) for (int j = 0; j < CELL; j += 2)
for (int i = 0; i < CELL; i+=2) for (int i = 0; i < CELL; i+=2)
drawblob((x*CELL+i), (y*CELL+j), prgb.Red, prgb.Green, prgb.Blue); DrawBlob({ x*CELL+i, y*CELL+j }, prgb);
break; break;
case 3: case 3:
for (int j = 0; j < CELL; j++) for (int j = 0; j < CELL; j++)
for (int i = 0; i < CELL; i++) for (int i = 0; i < CELL; i++)
drawblob((x*CELL+i), (y*CELL+j), prgb.Red, prgb.Green, prgb.Blue); DrawBlob({ x*CELL+i, y*CELL+j }, prgb);
break; break;
case 4: case 4:
for (int j = 0; j < CELL; j++) for (int j = 0; j < CELL; j++)
for (int i = 0; i < CELL; i++) for (int i = 0; i < CELL; i++)
if (i == j) if (i == j)
drawblob((x*CELL+i), (y*CELL+j), prgb.Red, prgb.Green, prgb.Blue); DrawBlob({ x*CELL+i, y*CELL+j }, prgb);
else if (i == j+1 || (i == 0 && j == CELL-1)) else if (i == j+1 || (i == 0 && j == CELL-1))
video[{ x * CELL + i, y * CELL + j }] = gc; video[{ x * CELL + i, y * CELL + j }] = gc;
else else

View File

@ -101,7 +101,7 @@ public:
void RenderEnd(); void RenderEnd();
void RenderZoom(); void RenderZoom();
void DrawBlob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); void DrawBlob(Vec2<int> pos, RGB<uint8_t> colour);
void DrawWalls(); void DrawWalls();
void DrawSigns(); void DrawSigns();
void render_gravlensing(const Video &source); void render_gravlensing(const Video &source);
@ -122,8 +122,6 @@ public:
VideoBuffer DumpFrame(); VideoBuffer DumpFrame();
void drawblob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb);
pixel GetPixel(Vec2<int> pos) const; pixel GetPixel(Vec2<int> pos) const;
//... //...
//Display mode modifiers //Display mode modifiers

View File

@ -71,8 +71,8 @@ void Renderer::RenderZoom()
pixel pix; pixel pix;
DrawFilledRect(RectSized(zoomWindowPosition, { zoomScopeSize * ZFACTOR, zoomScopeSize * ZFACTOR }), 0x000000_rgb); DrawFilledRect(RectSized(zoomWindowPosition, { zoomScopeSize * ZFACTOR, zoomScopeSize * ZFACTOR }), 0x000000_rgb);
drawrect(zoomWindowPosition.X-2, zoomWindowPosition.Y-2, zoomScopeSize*ZFACTOR+3, zoomScopeSize*ZFACTOR+3, 192, 192, 192, 255); DrawRect(RectSized(zoomWindowPosition - Vec2{ 2, 2 }, Vec2{ zoomScopeSize*ZFACTOR+3, zoomScopeSize*ZFACTOR+3 }), RGB<uint8_t>(192, 192, 192));
drawrect(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR+1, zoomScopeSize*ZFACTOR+1, 0, 0, 0, 255); DrawRect(RectSized(zoomWindowPosition - Vec2{ 1, 1 }, Vec2{ zoomScopeSize*ZFACTOR+1, zoomScopeSize*ZFACTOR+1 }), RGB<uint8_t>(0, 0, 0));
for (j=0; j<zoomScopeSize; j++) for (j=0; j<zoomScopeSize; j++)
for (i=0; i<zoomScopeSize; i++) for (i=0; i<zoomScopeSize; i++)
{ {
@ -97,17 +97,16 @@ void Renderer::RenderZoom()
} }
} }
void Renderer::DrawBlob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) void Renderer::DrawBlob(Vec2<int> pos, RGB<uint8_t> colour)
{ {
blendpixel(x+1, y, cr, cg, cb, 112); BlendPixel(pos + Vec2{ +1, 0 }, colour.WithAlpha(112));
blendpixel(x-1, y, cr, cg, cb, 112); BlendPixel(pos + Vec2{ -1, 0 }, colour.WithAlpha(112));
blendpixel(x, y+1, cr, cg, cb, 112); BlendPixel(pos + Vec2{ 0, 1 }, colour.WithAlpha(112));
blendpixel(x, y-1, cr, cg, cb, 112); BlendPixel(pos + Vec2{ 0, -1 }, colour.WithAlpha(112));
BlendPixel(pos + Vec2{ 1, -1 }, colour.WithAlpha(64));
blendpixel(x+1, y-1, cr, cg, cb, 64); BlendPixel(pos + Vec2{ -1, -1 }, colour.WithAlpha(64));
blendpixel(x-1, y-1, cr, cg, cb, 64); BlendPixel(pos + Vec2{ 1, 1 }, colour.WithAlpha(64));
blendpixel(x+1, y+1, cr, cg, cb, 64); BlendPixel(pos + Vec2{ -1, +1 }, colour.WithAlpha(64));
blendpixel(x-1, y+1, cr, cg, cb, 64);
} }
@ -159,19 +158,6 @@ void Renderer::prepare_alpha(int size, float intensity)
} }
void Renderer::drawblob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb)
{
blendpixel(x+1, y, cr, cg, cb, 112);
blendpixel(x-1, y, cr, cg, cb, 112);
blendpixel(x, y+1, cr, cg, cb, 112);
blendpixel(x, y-1, cr, cg, cb, 112);
blendpixel(x+1, y-1, cr, cg, cb, 64);
blendpixel(x-1, y-1, cr, cg, cb, 64);
blendpixel(x+1, y+1, cr, cg, cb, 64);
blendpixel(x-1, y+1, cr, cg, cb, 64);
}
pixel Renderer::GetPixel(Vec2<int> pos) const pixel Renderer::GetPixel(Vec2<int> pos) const
{ {
if (pos.X<0 || pos.Y<0 || pos.X>=VIDXRES || pos.Y>=VIDYRES) if (pos.X<0 || pos.Y<0 || pos.X>=VIDXRES || pos.Y>=VIDYRES)

View File

@ -255,10 +255,10 @@ void ColourPickerActivity::OnKeyPress(int key, int scan, bool repeat, bool shift
void ColourPickerActivity::OnDraw() void ColourPickerActivity::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->fillrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3, 0, 0, 0, currentAlpha); g->BlendFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), RGBA<uint8_t>(0, 0, 0, currentAlpha));
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
g->drawrect(Position.X+4, Position.Y+4, 258, 130, 180, 180, 180, 255); g->DrawRect(RectSized(Position + Vec2{ 4, 4 }, Vec2{ 258, 130 }), RGB<uint8_t>(180, 180, 180));
auto offset = Position + Vec2{ 5, 5 }; auto offset = Position + Vec2{ 5, 5 };
@ -278,7 +278,7 @@ void ColourPickerActivity::OnDraw()
int cg = 0; int cg = 0;
int cb = 0; int cb = 0;
HSV_to_RGB(hue, 255-saturation, currentValue, &cr, &cg, &cb); HSV_to_RGB(hue, 255-saturation, currentValue, &cr, &cg, &cb);
g->blendpixel(currx, (saturation/2)+offset.Y, cr, cg, cb, currentAlpha); g->BlendPixel({ currx, (saturation/2)+offset.Y }, RGBA<uint8_t>(cr, cg, cb, currentAlpha));
} }
} }
@ -291,10 +291,9 @@ void ColourPickerActivity::OnDraw()
HSV_to_RGB(hue, currentSaturation, currentValue, &red, &green, &blue); HSV_to_RGB(hue, currentSaturation, currentValue, &red, &green, &blue);
for (int ry = 0; ry < (hSlider->Size.Y / 2) - 1; ry++) for (int ry = 0; ry < (hSlider->Size.Y / 2) - 1; ry++)
{ {
g->blendpixel( g->BlendPixel(
rx + offset.X + hSlider->Position.X, offset + hSlider->Position + Vec2{ rx, ry },
ry + offset.Y + hSlider->Position.Y, RGBA<uint8_t>(red, green, blue, currentAlpha)
red, green, blue, currentAlpha
); );
} }
} }

View File

@ -110,9 +110,9 @@ void ConsoleView::NotifyCurrentCommandChanged(ConsoleModel * sender)
void ConsoleView::OnDraw() void ConsoleView::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->fillrect(Position.X, Position.Y, Size.X, Size.Y, 0, 0, 0, 110); g->BlendFilledRect(RectSized(Position, Size), RGBA<uint8_t>(0, 0, 0, 110));
g->draw_line(Position.X, Position.Y+Size.Y-16, Position.X+Size.X, Position.Y+Size.Y-16, 255, 255, 255, 160); g->BlendLine(Position + Vec2{ 0, Size.Y-16 }, Position + Size - Vec2{ 0, 16 }, RGBA<uint8_t>(255, 255, 255, 160));
g->draw_line(Position.X, Position.Y+Size.Y, Position.X+Size.X, Position.Y+Size.Y, 255, 255, 255, 200); g->BlendLine(Position + Vec2{ 0, Size.Y }, Position + Size, RGBA<uint8_t>(255, 255, 255, 200));
} }
void ConsoleView::OnTick(float dt) void ConsoleView::OnTick(float dt)

View File

@ -83,5 +83,5 @@ void ConfirmPrompt::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }

View File

@ -59,5 +59,5 @@ void ErrorMessage::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }

View File

@ -75,5 +75,5 @@ void InformationMessage::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }

View File

@ -53,7 +53,7 @@ void SaveIDMessage::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }
void SaveIDMessage::OnTryExit(ExitMethod method) void SaveIDMessage::OnTryExit(ExitMethod method)

View File

@ -94,5 +94,5 @@ void TextPrompt::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }

View File

@ -213,9 +213,12 @@ void ElementSearchActivity::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
g->drawrect(Position.X+searchField->Position.X, Position.Y+searchField->Position.Y+searchField->Size.Y+8, searchField->Size.X, Size.Y-(searchField->Position.Y+searchField->Size.Y+8)-23, 255, 255, 255, 180); g->BlendRect(
RectSized(Position + searchField->Position + Vec2{ 0, searchField->Size.Y+8 },
{ searchField->Size.X, Size.Y-(searchField->Position.Y+searchField->Size.Y+8)-23 }),
RGBA<uint8_t>(255, 255, 255, 180));
if (toolTipPresence && toolTip.length()) if (toolTipPresence && toolTip.length())
{ {
g->BlendText({ 10, Size.Y+70 }, toolTip, RGBA<uint8_t>(255, 255, 255, toolTipPresence>51?255:toolTipPresence*5)); g->BlendText({ 10, Size.Y+70 }, toolTip, RGBA<uint8_t>(255, 255, 255, toolTipPresence>51?255:toolTipPresence*5));

View File

@ -304,7 +304,7 @@ void FileBrowserActivity::OnDraw()
//Window Background+Outline //Window Background+Outline
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
} }
FileBrowserActivity::~FileBrowserActivity() FileBrowserActivity::~FileBrowserActivity()

View File

@ -479,26 +479,26 @@ void FontEditor::OnDraw()
std::array<std::array<char, MAX_WIDTH>, FONT_H> const &pixels = fontPixels[currentChar]; std::array<std::array<char, MAX_WIDTH>, FONT_H> const &pixels = fontPixels[currentChar];
int areaWidth = 8 + width * FONT_SCALE + 8; int areaWidth = 8 + width * FONT_SCALE + 8;
g->fillrect(0, 0, areaWidth, 8 + FONT_H * FONT_SCALE + 4 + FONT_H + 4, bgR, bgG, bgB, 255); g->DrawFilledRect(RectSized(Vec2{ 0, 0 }, Vec2{ areaWidth, 8 + FONT_H * FONT_SCALE + 4 + FONT_H + 4 }), RGB<uint8_t>(bgR, bgG, bgB));
for(int j = 0; j < FONT_H; j++) for(int j = 0; j < FONT_H; j++)
for(int i = 0; i < width; i++) for(int i = 0; i < width; i++)
g->fillrect(8 + i * FONT_SCALE, 8 + j * FONT_SCALE, FONT_SCALE - grid, FONT_SCALE - grid, fgR, fgG, fgB, pixels[j][i] * 255 / 3); g->BlendFilledRect(RectSized(Vec2{ 8 + i * FONT_SCALE, 8 + j * FONT_SCALE }, Vec2{ FONT_SCALE - grid, FONT_SCALE - grid }), RGBA<uint8_t>(fgR, fgG, fgB, pixels[j][i] * 255 / 3));
for(int j = 0; j < FONT_H; j++) for(int j = 0; j < FONT_H; j++)
for(int i = 0; i < width; i++) for(int i = 0; i < width; i++)
g->blendpixel(8 + i, 8 + FONT_H * FONT_SCALE + 4 + j, fgR, fgG, fgB, pixels[j][i] * 255 / 3); g->BlendPixel({ 8 + i, 8 + FONT_H * FONT_SCALE + 4 + j }, RGBA<uint8_t>(fgR, fgG, fgB, pixels[j][i] * 255 / 3));
if(rulers) if(rulers)
{ {
g->draw_line(0, 7 + 0 * FONT_SCALE , areaWidth - 1, 7 + 0 * FONT_SCALE, 128, 128, 128, 255); g->DrawLine({ 0, 7 + 0 * FONT_SCALE }, { areaWidth - 1, 7 + 0 * FONT_SCALE }, RGB<uint8_t>(128, 128, 128));
g->draw_line(0, 7 + 2 * FONT_SCALE , areaWidth - 1, 7 + 2 * FONT_SCALE, 128, 128, 128, 255); g->DrawLine({ 0, 7 + 2 * FONT_SCALE }, { areaWidth - 1, 7 + 2 * FONT_SCALE }, RGB<uint8_t>(128, 128, 128));
g->draw_line(0, 7 + 4 * FONT_SCALE , areaWidth - 1, 7 + 4 * FONT_SCALE, 128, 128, 128, 255); g->DrawLine({ 0, 7 + 4 * FONT_SCALE }, { areaWidth - 1, 7 + 4 * FONT_SCALE }, RGB<uint8_t>(128, 128, 128));
g->draw_line(0, 7 + 9 * FONT_SCALE , areaWidth - 1, 7 + 9 * FONT_SCALE, 128, 128, 128, 255); g->DrawLine({ 0, 7 + 9 * FONT_SCALE }, { areaWidth - 1, 7 + 9 * FONT_SCALE }, RGB<uint8_t>(128, 128, 128));
g->draw_line(0, 7 + 12 * FONT_SCALE , areaWidth - 1, 7 + 12 * FONT_SCALE, 128, 128, 128, 255); g->DrawLine({ 0, 7 + 12 * FONT_SCALE }, { areaWidth - 1, 7 + 12 * FONT_SCALE }, RGB<uint8_t>(128, 128, 128));
g->draw_line(7, 8, 7, 7 + FONT_H * FONT_SCALE, 128, 128, 128, 255); g->DrawLine({ 7, 8 }, { 7, 7 + FONT_H * FONT_SCALE }, RGB<uint8_t>(128, 128, 128));
g->draw_line(7 + width * FONT_SCALE, 8, 7 + width * FONT_SCALE, 7 + FONT_H * FONT_SCALE, 128, 128, 128, 255); g->DrawLine({ 7 + width * FONT_SCALE, 8}, { 7 + width * FONT_SCALE, 7 + FONT_H * FONT_SCALE }, RGB<uint8_t>(128, 128, 128));
} }
} }
else else

View File

@ -186,7 +186,7 @@ void GOLWindow::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
int width = Size.X - 60; int width = Size.X - 60;
for (int xx = 0; xx < width; ++xx) for (int xx = 0; xx < width; ++xx)
@ -197,7 +197,7 @@ void GOLWindow::OnDraw()
auto rr = int(highColour.Red * (1.f - f) + lowColour.Red * f); auto rr = int(highColour.Red * (1.f - f) + lowColour.Red * f);
auto gg = int(highColour.Green * (1.f - f) + lowColour.Green * f); auto gg = int(highColour.Green * (1.f - f) + lowColour.Green * f);
auto bb = int(highColour.Blue * (1.f - f) + lowColour.Blue * f); auto bb = int(highColour.Blue * (1.f - f) + lowColour.Blue * f);
g->blendpixel(Position.X + xx + 30, Position.Y + yy + 67, rr, gg, bb, 255); g->DrawPixel(Position + Vec2{ xx + 30, yy + 67 }, RGB<uint8_t>(rr, gg, bb));
} }
} }
} }

View File

@ -153,7 +153,7 @@ public:
drawn = true; drawn = true;
if(showSplit) if(showSplit)
g->draw_line(splitPosition+screenPos.X, screenPos.Y+1, splitPosition+screenPos.X, screenPos.Y+Size.Y-2, 180, 180, 180, 255); g->DrawLine(screenPos + Vec2{ splitPosition, 1 }, screenPos + Vec2{ splitPosition, Size.Y-2 }, RGB<uint8_t>(180, 180, 180));
} }
}; };
@ -1837,10 +1837,10 @@ void GameView::DoDraw()
255, 195, 145, 103, 69, 42, 23, 10, 3 255, 195, 145, 103, 69, 42, 23, 10, 3
} }; } };
auto *g = GetGraphics(); auto *g = GetGraphics();
for (auto x = 0U; x < fadeout.size(); ++x) for (auto x = 0; x < int(fadeout.size()); ++x)
{ {
g->draw_line(x, YRES + 1, x, YRES + 18, 0, 0, 0, fadeout[x]); g->BlendLine({ x, YRES + 1 }, { x, YRES + 18 }, 0x000000_rgb .WithAlpha(fadeout[x]));
g->draw_line(XRES - x, YRES + 1, XRES - x, YRES + 18, 0, 0, 0, fadeout[x]); g->BlendLine({ XRES - x, YRES + 1 }, { XRES - x, YRES + 18 }, 0x000000_rgb .WithAlpha(fadeout[x]));
} }
c->Tick(); c->Tick();
@ -2139,7 +2139,7 @@ void GameView::OnDraw()
{ {
if(selectPoint1.X==-1) if(selectPoint1.X==-1)
{ {
ren->fillrect(0, 0, XRES, YRES, 0, 0, 0, 100); ren->BlendFilledRect(RectSized(Vec2{ 0, 0 }, Vec2{ XRES, YRES }), RGBA<uint8_t>(0, 0, 0, 100));
} }
else else
{ {
@ -2153,11 +2153,11 @@ void GameView::OnDraw()
if(y2>YRES-1) if(y2>YRES-1)
y2 = YRES-1; y2 = YRES-1;
ren->fillrect(0, 0, XRES, y1, 0, 0, 0, 100); ren->BlendFilledRect(RectSized(Vec2{ 0, 0 }, Vec2{ XRES, y1 }), RGBA<uint8_t>(0, 0, 0, 100));
ren->fillrect(0, y2+1, XRES, YRES-y2-1, 0, 0, 0, 100); ren->BlendFilledRect(RectSized(Vec2{ 0, y2+1 }, Vec2{ XRES, YRES-y2-1 }), RGBA<uint8_t>(0, 0, 0, 100));
ren->fillrect(0, y1, x1, (y2-y1)+1, 0, 0, 0, 100); ren->BlendFilledRect(RectSized(Vec2{ 0, y1 }, Vec2{ x1, (y2-y1)+1 }), RGBA<uint8_t>(0, 0, 0, 100));
ren->fillrect(x2+1, y1, XRES-x2-1, (y2-y1)+1, 0, 0, 0, 100); ren->BlendFilledRect(RectSized(Vec2{ x2+1, y1 }, Vec2{ XRES-x2-1, (y2-y1)+1 }), RGBA<uint8_t>(0, 0, 0, 100));
ren->XorDottedRect(RectBetween(Vec2{ x1, y1 }, Vec2{ x2, y2 })); ren->XorDottedRect(RectBetween(Vec2{ x1, y1 }, Vec2{ x2, y2 }));
} }
@ -2198,7 +2198,7 @@ void GameView::OnDraw()
break; break;
} }
startY -= 14; startY -= 14;
g->fillrect(startX-3, startY-3, Graphics::TextSize(message).X + 5, 14, 0, 0, 0, std::min(100, alpha)); g->BlendFilledRect(RectSized(Vec2{ startX-3, startY-3 }, Vec2{ Graphics::TextSize(message).X + 5, 14 }), RGBA<uint8_t>(0, 0, 0, std::min(100, alpha)));
g->BlendText({ startX, startY }, message, RGBA<uint8_t>(255, 255, 255, alpha)); g->BlendText({ startX, startY }, message, RGBA<uint8_t>(255, 255, 255, alpha));
(*iter).second -= 3; (*iter).second -= 3;
} }
@ -2210,7 +2210,7 @@ void GameView::OnDraw()
String sampleInfo = String::Build("#", screenshotIndex, " ", String(0xE00E), " REC"); String sampleInfo = String::Build("#", screenshotIndex, " ", String(0xE00E), " REC");
int textWidth = Graphics::TextSize(sampleInfo).X - 1; int textWidth = Graphics::TextSize(sampleInfo).X - 1;
g->fillrect(XRES-20-textWidth, 12, textWidth+8, 15, 0, 0, 0, 127); g->BlendFilledRect(RectSized(Vec2{ XRES-20-textWidth, 12 }, Vec2{ textWidth+8, 15 }), RGBA<uint8_t>(0, 0, 0, 127));
g->BlendText({ XRES-16-textWidth, 16 }, sampleInfo, RGBA<uint8_t>(255, 50, 20, 255)); g->BlendText({ XRES-16-textWidth, 16 }, sampleInfo, RGBA<uint8_t>(255, 50, 20, 255));
} }
else if(showHud) else if(showHud)
@ -2331,14 +2331,14 @@ void GameView::OnDraw()
} }
int textWidth = Graphics::TextSize(sampleInfo.Build()).X - 1; int textWidth = Graphics::TextSize(sampleInfo.Build()).X - 1;
g->fillrect(XRES-20-textWidth, 12, textWidth+8, 15, 0, 0, 0, int(alpha*0.5f)); g->BlendFilledRect(RectSized(Vec2{ XRES-20-textWidth, 12 }, Vec2{ textWidth+8, 15 }), RGBA<uint8_t>(0, 0, 0, int(alpha*0.5f)));
g->BlendText({ XRES-16-textWidth, 16 }, sampleInfo.Build(), RGBA<uint8_t>(255, 255, 255, int(alpha*0.75f))); g->BlendText({ XRES-16-textWidth, 16 }, sampleInfo.Build(), RGBA<uint8_t>(255, 255, 255, int(alpha*0.75f)));
if (wavelengthGfx) if (wavelengthGfx)
{ {
int i, cr, cg, cb, j, h = 3, x = XRES-19-textWidth, y = 10; int i, cr, cg, cb, j, h = 3, x = XRES-19-textWidth, y = 10;
int tmp; int tmp;
g->fillrect(x, y, 30, h, 64, 64, 64, alpha); // coords -1 size +1 to work around bug in fillrect - TODO: fix fillrect g->BlendFilledRect(RectSized(Vec2{ x, y }, Vec2{ 30, h }), RGBA<uint8_t>(64, 64, 64, alpha));
for (i = 0; i < 30; i++) for (i = 0; i < 30; i++)
{ {
if ((wavelengthGfx >> i)&1) if ((wavelengthGfx >> i)&1)
@ -2364,7 +2364,7 @@ void GameView::OnDraw()
cg *= tmp; cg *= tmp;
cb *= tmp; cb *= tmp;
for (j=0; j<h; j++) for (j=0; j<h; j++)
g->blendpixel(x+29-i, y+j, cr>255?255:cr, cg>255?255:cg, cb>255?255:cb, alpha); g->BlendPixel({ x+29-i, y+j }, RGBA<uint8_t>(cr>255?255:cr, cg>255?255:cg, cb>255?255:cb, alpha));
} }
} }
} }
@ -2389,7 +2389,7 @@ void GameView::OnDraw()
} }
auto textWidth = Graphics::TextSize(sampleInfo.Build()).X - 1; auto textWidth = Graphics::TextSize(sampleInfo.Build()).X - 1;
g->fillrect(XRES-20-textWidth, 27, textWidth+8, 14, 0, 0, 0, int(alpha*0.5f)); g->BlendFilledRect(RectSized(Vec2{ XRES-20-textWidth, 27 }, Vec2{ textWidth+8, 14 }), RGBA<uint8_t>(0, 0, 0, int(alpha*0.5f)));
g->BlendText({ XRES-16-textWidth, 30 }, sampleInfo.Build(), RGBA<uint8_t>(255, 255, 255, int(alpha*0.75f))); g->BlendText({ XRES-16-textWidth, 30 }, sampleInfo.Build(), RGBA<uint8_t>(255, 255, 255, int(alpha*0.75f)));
} }
} }
@ -2418,7 +2418,7 @@ void GameView::OnDraw()
int textWidth = Graphics::TextSize(fpsInfo.Build()).X - 1; int textWidth = Graphics::TextSize(fpsInfo.Build()).X - 1;
int alpha = 255-introText*5; int alpha = 255-introText*5;
g->fillrect(12, 12, textWidth+8, 15, 0, 0, 0, int(alpha*0.5)); g->BlendFilledRect(RectSized(Vec2{ 12, 12 }, Vec2{ textWidth+8, 15 }), RGBA<uint8_t>(0, 0, 0, int(alpha*0.5)));
g->BlendText({ 16, 16 }, fpsInfo.Build(), RGBA<uint8_t>(32, 216, 255, int(alpha*0.75))); g->BlendText({ 16, 16 }, fpsInfo.Build(), RGBA<uint8_t>(32, 216, 255, int(alpha*0.75)));
} }
@ -2445,7 +2445,7 @@ void GameView::OnDraw()
//Introduction text //Introduction text
if(introText && showHud) if(introText && showHud)
{ {
g->fillrect(0, 0, WINDOWW, WINDOWH, 0, 0, 0, introText>51?102:introText*2); g->BlendFilledRect(RectSized(Vec2{ 0, 0 }, WINDOW), RGBA<uint8_t>(0, 0, 0, introText>51?102:introText*2));
g->BlendText({ 16, 16 }, introTextMessage, RGBA<uint8_t>(255, 255, 255, introText>51?255:introText*5)); g->BlendText({ 16, 16 }, introTextMessage, RGBA<uint8_t>(255, 255, 255, introText>51?255:introText*5));
} }
} }

View File

@ -239,7 +239,7 @@ void PropertyWindow::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }
void PropertyWindow::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) void PropertyWindow::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt)

View File

@ -169,7 +169,7 @@ void SignWindow::DoDraw()
String text = currentSign.getDisplayText(sim, x, y, w, h); String text = currentSign.getDisplayText(sim, x, y, w, h);
g->DrawFilledRect(RectSized(Vec2{ x + 1, y + 1 }, Vec2{ w, h - 1 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Vec2{ x + 1, y + 1 }, Vec2{ w, h - 1 }), 0x000000_rgb);
g->drawrect(x, y, w+1, h, 192, 192, 192, 255); g->DrawRect(RectSized(Vec2{ x, y }, Vec2{ w+1, h }), RGB<uint8_t>(192, 192, 192));
g->BlendText({ x+3, y+4 }, text, RGBA<uint8_t>(255, 255, 255, 255)); g->BlendText({ x+3, y+4 }, text, RGBA<uint8_t>(255, 255, 255, 255));
if (currentSign.ju != sign::None) if (currentSign.ju != sign::None)
@ -180,7 +180,7 @@ void SignWindow::DoDraw()
dy = (currentSign.y > 18) ? -1 : 1; dy = (currentSign.y > 18) ? -1 : 1;
for (int j=0; j<4; j++) for (int j=0; j<4; j++)
{ {
g->blendpixel(x, y, 192, 192, 192, 255); g->DrawPixel({ x, y }, RGB<uint8_t>(192, 192, 192));
x+=dx; x+=dx;
y+=dy; y+=dy;
} }
@ -223,7 +223,7 @@ void SignWindow::OnDraw()
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }
std::unique_ptr<VideoBuffer> SignTool::GetIcon(int toolID, Vec2<int> size) std::unique_ptr<VideoBuffer> SignTool::GetIcon(int toolID, Vec2<int> size)

View File

@ -58,16 +58,16 @@ void ToolButton::Draw(const ui::Point& screenPos)
} }
else else
{ {
g->fillrect(screenPos.X+2, screenPos.Y+2, Size.X-4, Size.Y-4, Appearance.BackgroundInactive.Red, Appearance.BackgroundInactive.Green, Appearance.BackgroundInactive.Blue, Appearance.BackgroundInactive.Alpha); g->BlendFilledRect(RectSized(screenPos + Vec2{ 2, 2 }, Size - Vec2{ 4, 4 }), Appearance.BackgroundInactive);
} }
if (isMouseInside && currentSelection == -1) if (isMouseInside && currentSelection == -1)
{ {
g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, Appearance.BorderActive.Red, Appearance.BorderActive.Green, Appearance.BorderActive.Blue, Appearance.BorderActive.Alpha); g->BlendRect(RectSized(screenPos, Size), Appearance.BorderActive);
} }
else else
{ {
g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, Appearance.BorderInactive.Red, Appearance.BorderInactive.Green, Appearance.BorderInactive.Blue, Appearance.BorderInactive.Alpha); g->BlendRect(RectSized(screenPos, Size), Appearance.BorderInactive);
} }
if (Favorite::Ref().IsFavorite(toolIdentifier)) if (Favorite::Ref().IsFavorite(toolIdentifier))
{ {

View File

@ -113,19 +113,19 @@ void Button::Draw(const Point& screenPos)
} }
bgColour = Appearance.BackgroundInactive; bgColour = Appearance.BackgroundInactive;
g->fillrect(Position.X+1, Position.Y+1, Size.X-2, Size.Y-2, backgroundColour.Red, backgroundColour.Green, backgroundColour.Blue, backgroundColour.Alpha); g->BlendFilledRect(RectSized(Position + Vec2{ 1, 1 }, Size - Vec2{ 2, 2 }), backgroundColour);
if(Appearance.Border == 1) if(Appearance.Border == 1)
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha); g->BlendRect(RectSized(Position, Size), borderColour);
else else
{ {
if(Appearance.Border.Top) if(Appearance.Border.Top)
g->draw_line(Position.X, Position.Y, Position.X+Size.X-1, Position.Y, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha); g->BlendLine(Position + Vec2{ 0 , 0 }, Position + Vec2{ Size.X-1, 0 }, borderColour);
if(Appearance.Border.Bottom) if(Appearance.Border.Bottom)
g->draw_line(Position.X, Position.Y+Size.Y-1, Position.X+Size.X-1, Position.Y+Size.Y-1, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha); g->BlendLine(Position + Vec2{ 0 , Size.Y-1 }, Position + Vec2{ Size.X-1, Size.Y-1 }, borderColour);
if(Appearance.Border.Left) if(Appearance.Border.Left)
g->draw_line(Position.X, Position.Y, Position.X, Position.Y+Size.Y-1, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha); g->BlendLine(Position + Vec2{ 0 , 0 }, Position + Vec2{ 0, Size.Y-1 }, borderColour);
if(Appearance.Border.Right) if(Appearance.Border.Right)
g->draw_line(Position.X+Size.X-1, Position.Y, Position.X+Size.X-1, Position.Y+Size.Y-1, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha); g->BlendLine(Position + Vec2{ Size.X-1, 0 }, Position + Vec2{ Size.X-1, Size.Y-1 }, borderColour);
} }
g->BlendText(Position + textPosition, buttonDisplayText, textColour); g->BlendText(Position + textPosition, buttonDisplayText, textColour);

View File

@ -76,12 +76,12 @@ void Checkbox::Draw(const Point& screenPos)
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
if(checked) if(checked)
{ {
g->fillrect(screenPos.X+5, screenPos.Y+5, 6, 6, 255, 255, 255, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ 5, 5 }, Vec2{ 6, 6 }), RGB<uint8_t>(255, 255, 255));
} }
if(isMouseOver) if(isMouseOver)
{ {
g->drawrect(screenPos.X+2, screenPos.Y+2, 12, 12, 255, 255, 255, 255); g->DrawRect(RectSized(screenPos + Vec2{ 2, 2 }, Vec2{ 12, 12 }), RGB<uint8_t>(255, 255, 255));
g->fillrect(screenPos.X+5, screenPos.Y+5, 6, 6, 255, 255, 255, 170); g->BlendFilledRect(RectSized(screenPos + Vec2{ 5, 5 }, Vec2{ 6, 6 }), RGBA<uint8_t>(255, 255, 255, 170));
if (!Appearance.icon) if (!Appearance.icon)
g->BlendText(screenPos + Vec2{ 18, 4 }, text, RGBA<uint8_t>(255, 255, 255, 255)); g->BlendText(screenPos + Vec2{ 18, 4 }, text, RGBA<uint8_t>(255, 255, 255, 255));
else else
@ -89,7 +89,7 @@ void Checkbox::Draw(const Point& screenPos)
} }
else else
{ {
g->drawrect(screenPos.X+2, screenPos.Y+2, 12, 12, 255, 255, 255, 200); g->BlendRect(RectSized(screenPos + Vec2{ 2, 2 }, Vec2{ 12, 12 }), RGBA<uint8_t>(255, 255, 255, 200));
if (!Appearance.icon) if (!Appearance.icon)
g->BlendText(screenPos + Vec2{ 18, 4 }, text, RGBA<uint8_t>(255, 255, 255, 200)); g->BlendText(screenPos + Vec2{ 18, 4 }, text, RGBA<uint8_t>(255, 255, 255, 200));
else else

View File

@ -94,6 +94,6 @@ void ContextMenu::AddItem(ContextMenuItem item)
void ContextMenu::OnDraw() void ContextMenu::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->fillrect(Position.X, Position.Y, Size.X, Size.Y, 100, 100, 100, 255); g->DrawFilledRect(RectSized(Position, Size), RGB<uint8_t>(100, 100, 100));
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, Appearance.BackgroundInactive.Red, Appearance.BackgroundInactive.Green, Appearance.BackgroundInactive.Blue, Appearance.BackgroundInactive.Alpha); g->BlendRect(RectSized(Position, Size), Appearance.BackgroundInactive);
} }

View File

@ -120,11 +120,12 @@ void DirectionSelector::Draw(const ui::Point& screenPos)
for (auto &point : snapPoints) for (auto &point : snapPoints)
{ {
g->fillrect( g->BlendFilledRect(
(center.X + point.offset.X) - snapPointRadius, RectBetween(
(center.Y + point.offset.Y) - snapPointRadius, center + point.offset - Vec2{ snapPointRadius, snapPointRadius },
snapPointRadius * 2 + 1, snapPointRadius * 2 + 1, center + point.offset + Vec2{ snapPointRadius, snapPointRadius }
snapPointColor.Red, snapPointColor.Green, snapPointColor.Blue, altDown ? (int)(snapPointColor.Alpha / 2) : snapPointColor.Alpha ),
RGBA<uint8_t>(snapPointColor.Red, snapPointColor.Green, snapPointColor.Blue, altDown ? (int)(snapPointColor.Alpha / 2) : snapPointColor.Alpha)
); );
} }

View File

@ -98,8 +98,8 @@ void DropDown::Draw(const Point& screenPos)
backgroundColour = Appearance.BackgroundInactive; backgroundColour = Appearance.BackgroundInactive;
} }
g->fillrect(Position.X-1, Position.Y-1, Size.X+2, Size.Y+2, backgroundColour.Red, backgroundColour.Green, backgroundColour.Blue, backgroundColour.Alpha); g->BlendFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), backgroundColour);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha); g->BlendRect(RectSized(Position, Size), borderColour);
if(optionIndex!=-1) if(optionIndex!=-1)
g->BlendText(Position + textPosition, options[optionIndex].first, textColour); g->BlendText(Position + textPosition, options[optionIndex].first, textColour);
} }

View File

@ -248,39 +248,39 @@ void Label::Draw(const Point& screenPos)
{ {
if (selectionLineH == selectionLineL) if (selectionLineH == selectionLineL)
{ {
g->fillrect( g->DrawFilledRect(
screenPos.X + textPosition.X + selectionXL - 1, RectSized(
screenPos.Y + textPosition.Y + selectionYL - 2, screenPos + textPosition + Vec2{ selectionXL - 1, selectionYL - 2 },
selectionXH - selectionXL + 1, Vec2{ selectionXH - selectionXL + 1, FONT_H }
FONT_H, ),
255, 255, 255, 255 RGB<uint8_t>(255, 255, 255)
); );
} }
else else
{ {
g->fillrect( g->DrawFilledRect(
screenPos.X + textPosition.X + selectionXL - 1, RectSized(
screenPos.Y + textPosition.Y + selectionYL - 2, screenPos + textPosition + Vec2{ selectionXL - 1, selectionYL - 2 },
textSize.X - selectionXL + 1, Vec2{ textSize.X - selectionXL + 1, FONT_H }
FONT_H, ),
255, 255, 255, 255 RGB<uint8_t>(255, 255, 255)
); );
for (int i = 1; i < selectionLineH - selectionLineL; ++i) for (int i = 1; i < selectionLineH - selectionLineL; ++i)
{ {
g->fillrect( g->DrawFilledRect(
screenPos.X + textPosition.X - 1, RectSized(
screenPos.Y + textPosition.Y + selectionYL - 2 + i * FONT_H, screenPos + textPosition + Vec2{ -1, selectionYL - 2 + i * FONT_H },
textSize.X + 1, Vec2{ textSize.X + 1, FONT_H }
FONT_H, ),
255, 255, 255, 255 RGB<uint8_t>(255, 255, 255)
); );
} }
g->fillrect( g->DrawFilledRect(
screenPos.X + textPosition.X - 1, RectSized(
screenPos.Y + textPosition.Y + selectionYH - 2, screenPos + textPosition + Vec2{ -1, selectionYH - 2 },
selectionXH + 1, Vec2{ selectionXH + 1, FONT_H }
FONT_H, ),
255, 255, 255, 255 RGB<uint8_t>(255, 255, 255)
); );
} }
} }

View File

@ -46,7 +46,7 @@ void ProgressBar::Draw(const Point & screenPos)
ui::Colour progressBarColour = style::Colour::WarningTitle; ui::Colour progressBarColour = style::Colour::WarningTitle;
g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
if(progress!=-1) if(progress!=-1)
{ {
@ -56,7 +56,7 @@ void ProgressBar::Draw(const Point & screenPos)
progress = 100; progress = 100;
float size = float(Size.X-4)*(float(progress)/100.0f); // TIL... float size = float(Size.X-4)*(float(progress)/100.0f); // TIL...
size = std::min(std::max(size, 0.0f), float(Size.X-4)); size = std::min(std::max(size, 0.0f), float(Size.X-4));
g->fillrect(screenPos.X + 2, screenPos.Y + 2, int(size), Size.Y-4, progressBarColour.Red, progressBarColour.Green, progressBarColour.Blue, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ 2, 2 }, Vec2{ int(size), Size.Y-4 }), progressBarColour.NoAlpha());
} }
} else { } else {
int size = 40, rsize = 0; int size = 40, rsize = 0;
@ -66,10 +66,10 @@ void ProgressBar::Draw(const Point & screenPos)
size = int((Size.X-4)-position+1); size = int((Size.X-4)-position+1);
rsize = 40-size; rsize = 40-size;
} }
g->fillrect(screenPos.X + 2 + int(position), screenPos.Y + 2, size, Size.Y-4, progressBarColour.Red, progressBarColour.Green, progressBarColour.Blue, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ 2 + int(position), 2 }, Vec2{ size, Size.Y-4 }), progressBarColour.NoAlpha());
if(rsize) if(rsize)
{ {
g->fillrect(screenPos.X + 2, screenPos.Y + 2, rsize, Size.Y-4, progressBarColour.Red, progressBarColour.Green, progressBarColour.Blue, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ 2, 2 }, Vec2{ rsize, Size.Y-4 }), progressBarColour.NoAlpha());
} }
} }
g->BlendText(screenPos + Vec2{ ((Size.X-(Graphics::TextSize(progressStatus).X - 1))/2), (Size.Y-8)/2 }, progressStatus, progress<50 ? RGBA<uint8_t>(255, 255, 255, 255) : RGBA<uint8_t>(0, 0, 0, 255)); g->BlendText(screenPos + Vec2{ ((Size.X-(Graphics::TextSize(progressStatus).X - 1))/2), (Size.Y-8)/2 }, progressStatus, progress<50 ? RGBA<uint8_t>(255, 255, 255, 255) : RGBA<uint8_t>(0, 0, 0, 255));

View File

@ -188,7 +188,7 @@ void SaveButton::Draw(const Point& screenPos)
if(selected && selectable) if(selected && selectable)
{ {
g->fillrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 100, 170, 255, 100); g->BlendFilledRect(RectSized(screenPos, Size), RGBA<uint8_t>(100, 170, 255, 100));
} }
if (thumbnail) if (thumbnail)
@ -204,29 +204,18 @@ void SaveButton::Draw(const Point& screenPos)
{ {
if(save->id) if(save->id)
{ {
if(isMouseInside) g->DrawRect(RectSized(screenPos + Vec2{ - 3, 0 } + (Size - thumbBoxSize - Vec2{ 0, 21 }) / 2, thumbBoxSize), isMouseInside ? RGB<uint8_t>(210, 230, 255) : RGB<uint8_t>(180, 180, 180));
{ g->DrawRect(RectSized(screenPos + Vec2{ thumbBoxSize.X - 4, 0 } + (Size - thumbBoxSize - Vec2{ 0, 21 }) / 2, Vec2{ 7, thumbBoxSize.Y }), isMouseInside ? RGB<uint8_t>(210, 230, 255) : RGB<uint8_t>(180, 180, 180));
g->drawrect(screenPos.X-3+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 210, 230, 255, 255);
g->drawrect(screenPos.X-4+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, 7, thumbBoxSize.Y, 210, 230, 255, 255);
}
else
{
g->drawrect(screenPos.X-3+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 180, 180, 180, 255);
g->drawrect(screenPos.X-4+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, 7, thumbBoxSize.Y, 180, 180, 180, 255);
}
g->fillrect(screenPos.X-3+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+1+(Size.Y-20-thumbBoxSize.Y)/2, 5, (thumbBoxSize.Y+1)/2-1, 0, 107, 10, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ -3+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, 1+(Size.Y-20-thumbBoxSize.Y)/2 }, Vec2{ 5, (thumbBoxSize.Y+1)/2-1 }), RGB<uint8_t>(0, 107, 10));
g->fillrect(screenPos.X-3+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-20)/2, 5, thumbBoxSize.Y/2-1, 107, 10, 0, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ -3+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, (Size.Y-20)/2 }, Vec2{ 5, thumbBoxSize.Y/2-1 }), RGB<uint8_t>(107, 10, 0));
g->fillrect(screenPos.X-2+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-20)/2-voteBarHeightUp, 3, voteBarHeightUp, 57, 187, 57, 255); //green g->DrawFilledRect(RectSized(screenPos + Vec2{ -2+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, (Size.Y-20)/2-voteBarHeightUp }, Vec2{ 3, voteBarHeightUp }), RGB<uint8_t>(57, 187, 57)); //green
g->fillrect(screenPos.X-2+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-20)/2, 3, voteBarHeightDown, 187, 57, 57, 255); //red g->DrawFilledRect(RectSized(screenPos + Vec2{ -2+thumbBoxSize.X+(Size.X-thumbBoxSize.X)/2, (Size.Y-20)/2 }, Vec2{ 3, voteBarHeightDown }), RGB<uint8_t>(187, 57, 57)); //red
} }
else else
{ {
if(isMouseInside) g->DrawRect(RectSized(screenPos + (Size - thumbBoxSize - Vec2{ 0, 21 }) / 2, thumbBoxSize), isMouseInside ? RGB<uint8_t>(210, 230, 255) : RGB<uint8_t>(180, 180, 180));
g->drawrect(screenPos.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 210, 230, 255, 255);
else
g->drawrect(screenPos.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 180, 180, 180, 255);
} }
g->BlendText(screenPos + Vec2{ (Size.X-(Graphics::TextSize(name).X - 1))/2, Size.Y - 21 }, name, (isMouseInside && !isMouseInsideAuthor) ? RGBA<uint8_t>(255, 255, 255, 255) : RGBA<uint8_t>(180, 180, 180, 255)); g->BlendText(screenPos + Vec2{ (Size.X-(Graphics::TextSize(name).X - 1))/2, Size.Y - 21 }, name, (isMouseInside && !isMouseInsideAuthor) ? RGBA<uint8_t>(255, 255, 255, 255) : RGBA<uint8_t>(180, 180, 180, 255));
@ -243,7 +232,7 @@ void SaveButton::Draw(const Point& screenPos)
{ {
int x = screenPos.X; int x = screenPos.X;
int y = screenPos.Y-15+(Size.Y-thumbBoxSize.Y)/2+thumbBoxSize.Y; int y = screenPos.Y-15+(Size.Y-thumbBoxSize.Y)/2+thumbBoxSize.Y;
g->fillrect(x+1, y+1, 7, 8, 255, 255, 255, 255); g->DrawFilledRect(RectSized(Vec2{ x+1, y+1 }, Vec2{ 7, 8 }), RGB<uint8_t>(255, 255, 255));
g->BlendText({ x, y }, 0xE026, isMouseInsideHistory ? RGBA<uint8_t>(200, 100, 80, 255) : RGBA<uint8_t>(160, 70, 50, 255)); g->BlendText({ x, y }, 0xE026, isMouseInsideHistory ? RGBA<uint8_t>(200, 100, 80, 255) : RGBA<uint8_t>(160, 70, 50, 255));
} }
if (!save->GetPublished()) if (!save->GetPublished())
@ -254,10 +243,7 @@ void SaveButton::Draw(const Point& screenPos)
} }
else if (file) else if (file)
{ {
if (isMouseInside) g->DrawRect(RectSized(screenPos + (Size - thumbBoxSize- Vec2{ 0, 21 }) / 2, thumbBoxSize), isMouseInside ? RGB<uint8_t>(210, 230, 255) : RGB<uint8_t>(180, 180, 180));
g->drawrect(screenPos.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 210, 230, 255, 255);
else
g->drawrect(screenPos.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 180, 180, 180, 255);
if (thumbSize.X) if (thumbSize.X)
g->XorDottedRect(RectSized(screenPos + (Size - thumbSize - Vec2{ 0, 21 }) / 2, thumbSize)); g->XorDottedRect(RectSized(screenPos + (Size - thumbSize - Vec2{ 0, 21 }) / 2, thumbSize));
@ -267,9 +253,9 @@ void SaveButton::Draw(const Point& screenPos)
if(isMouseInside && selectable) if(isMouseInside && selectable)
{ {
g->DrawFilledRect(RectSized(screenPos + Vec2{ Size.X - 19, 7 }, Vec2{ 13, 13 }), 0x000000_rgb); g->DrawFilledRect(RectSized(screenPos + Vec2{ Size.X - 19, 7 }, Vec2{ 13, 13 }), 0x000000_rgb);
g->drawrect(screenPos.X+(Size.X-20), screenPos.Y+6, 14, 14, 255, 255, 255, 255); g->DrawRect(RectSized(screenPos + Vec2{ Size.X-20, 6 }, Vec2{ 14, 14 }), RGB<uint8_t>(255, 255, 255));
if(selected) if(selected)
g->fillrect(screenPos.X+(Size.X-18), screenPos.Y+8, 10, 10, 255, 255, 255, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ Size.X-18, 8 }, Vec2{ 10, 10 }), RGB<uint8_t>(255, 255, 255));
} }
} }

View File

@ -65,8 +65,8 @@ void ScrollPanel::Draw(const Point& screenPos)
scrollPos = float(Size.Y-scrollHeight)*(float(offsetY)/float(maxOffset.Y)); scrollPos = float(Size.Y-scrollHeight)*(float(offsetY)/float(maxOffset.Y));
} }
g->fillrect(screenPos.X+(Size.X-scrollBarWidth), screenPos.Y, scrollBarWidth, Size.Y, 125, 125, 125, 100); g->BlendFilledRect(RectSized(screenPos + Vec2{ Size.X - scrollBarWidth, 0 }, { scrollBarWidth, Size.Y }), RGBA<uint8_t>(125, 125, 125, 100));
g->fillrect(screenPos.X+(Size.X-scrollBarWidth), screenPos.Y+int(scrollPos), scrollBarWidth, int(scrollHeight)+1, 255, 255, 255, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ Size.X - scrollBarWidth, int(scrollPos) }, { scrollBarWidth, int(scrollHeight)+1 }), RGB<uint8_t>(255, 255, 255));
} }
} }

View File

@ -104,7 +104,6 @@ void Slider::SetSteps(int steps)
void Slider::Draw(const Point& screenPos) void Slider::Draw(const Point& screenPos)
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
//g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255);
if (bgGradient.size()) if (bgGradient.size())
{ {
@ -112,13 +111,12 @@ void Slider::Draw(const Point& screenPos)
{ {
for (int i = 3; i < Size.X-7; i++) for (int i = 3; i < Size.X-7; i++)
{ {
RGB<uint8_t> color = bgGradient[i - 3]; g->DrawPixel(screenPos + Vec2{ i + 2, j + 2 }, bgGradient[i - 3]);
g->blendpixel(screenPos.X+i+2, screenPos.Y+j+2, color.Red, color.Green, color.Blue, 255);
} }
} }
} }
g->drawrect(screenPos.X+3, screenPos.Y+3, Size.X-6, Size.Y-6, 255, 255, 255, 255); g->DrawRect(RectSized(screenPos + Vec2{ 3, 3 }, Size - Vec2{ 6, 6 }), RGB<uint8_t>(255, 255, 255));
auto fPosition = float(sliderPosition); auto fPosition = float(sliderPosition);
auto fSize = float(Size.X-6); auto fSize = float(Size.X-6);
@ -128,8 +126,8 @@ void Slider::Draw(const Point& screenPos)
auto sliderX = int(fSliderX); auto sliderX = int(fSliderX);
sliderX += 3; sliderX += 3;
g->fillrect(screenPos.X+sliderX-2, screenPos.Y+1, 4, Size.Y-2, 20, 20, 20, 255); g->DrawFilledRect(RectSized(screenPos + Vec2{ sliderX-2, 1 }, Vec2{ 4, Size.Y-2 }), RGB<uint8_t>(20, 20, 20));
g->drawrect(screenPos.X+sliderX-2, screenPos.Y+1, 4, Size.Y-2, 200, 200, 200, 255); g->DrawRect(RectSized(screenPos + Vec2{ sliderX-2, 1 }, Vec2{ 4, Size.Y-2 }), RGB<uint8_t>(200, 200, 200));
} }
} /* namespace ui */ } /* namespace ui */

View File

@ -27,8 +27,10 @@ void Spinner::Draw(const Point& screenPos)
int lineOuter = (Size.X/2)+3; int lineOuter = (Size.X/2)+3;
for(float t = 0.0f; t < 6.0f; t+=0.25f) for(float t = 0.0f; t < 6.0f; t+=0.25f)
{ {
//g->drawblob(baseX+(sin(cValue+t)*(Size.X/2)), baseY+(cos(cValue+t)*(Size.X/2)), t*255, t*255, t*255); g->DrawLine(
g->draw_line(int(baseX+(sin(cValue+t)*lineInner)), int(baseY+(cos(cValue+t)*lineInner)), int(baseX+(sin(cValue+t)*lineOuter)), int(baseY+(cos(cValue+t)*lineOuter)), int((t/6)*255), int((t/6)*255), int((t/6)*255), 255); { int(baseX+(sin(cValue+t)*lineInner)), int(baseY+(cos(cValue+t)*lineInner)) },
{ int(baseX+(sin(cValue+t)*lineOuter)), int(baseY+(cos(cValue+t)*lineOuter)) },
RGB<uint8_t>(int((t/6)*255), int((t/6)*255), int((t/6)*255)));
} }
} }
Spinner::~Spinner() Spinner::~Spinner()

View File

@ -613,8 +613,12 @@ void Textbox::Draw(const Point& screenPos)
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
if(IsFocused()) if(IsFocused())
{ {
if(border) g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255); if(border)
g->draw_line(screenPos.X+textPosition.X+cursorPositionX, screenPos.Y-2+textPosition.Y+cursorPositionY, screenPos.X+textPosition.X+cursorPositionX, screenPos.Y+9+textPosition.Y+cursorPositionY, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
g->DrawLine(
screenPos + textPosition + Vec2{ cursorPositionX, cursorPositionY-2 },
screenPos + textPosition + Vec2{ cursorPositionX, cursorPositionY+9 },
RGB<uint8_t>(255, 255, 255));
} }
else else
{ {
@ -622,7 +626,8 @@ void Textbox::Draw(const Point& screenPos)
{ {
g->BlendText(screenPos + textPosition, placeHolder, RGBA<uint8_t>(textColour.Red, textColour.Green, textColour.Blue, 170)); g->BlendText(screenPos + textPosition, placeHolder, RGBA<uint8_t>(textColour.Red, textColour.Green, textColour.Blue, 170));
} }
if(border) g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 160, 160, 160, 255); if(border)
g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(160, 160, 160));
} }
if(Appearance.icon) if(Appearance.icon)
g->draw_icon(screenPos.X+iconPosition.X, screenPos.Y+iconPosition.Y, Appearance.icon); g->draw_icon(screenPos.X+iconPosition.X, screenPos.Y+iconPosition.Y, Appearance.icon);

View File

@ -125,7 +125,7 @@ void LoginView::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
} }
LoginView::~LoginView() { LoginView::~LoginView() {

View File

@ -46,7 +46,7 @@ OptionsView::OptionsView():
void Draw(const ui::Point& screenPos) override void Draw(const ui::Point& screenPos) override
{ {
GetGraphics()->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 180); GetGraphics()->BlendRect(RectSized(screenPos, Size), RGBA<uint8_t>(255, 255, 255, 180));
} }
}; };
@ -159,7 +159,7 @@ OptionsView::OptionsView():
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(200, 200, 200));
} }
ui::DirectionSelector * gravityDirection; ui::DirectionSelector * gravityDirection;
@ -541,7 +541,7 @@ void OptionsView::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
} }
void OptionsView::OnTryExit(ExitMethod method) void OptionsView::OnTryExit(ExitMethod method)

View File

@ -260,20 +260,18 @@ void PreviewView::DoDraw()
{ {
int linePos = commentTextComponents[i]->Position.Y+commentsPanel->ViewportPosition.Y+commentTextComponents[i]->Size.Y+4; int linePos = commentTextComponents[i]->Position.Y+commentsPanel->ViewportPosition.Y+commentTextComponents[i]->Size.Y+4;
if (linePos > 0 && linePos < Size.Y-commentBoxHeight) if (linePos > 0 && linePos < Size.Y-commentBoxHeight)
g->draw_line( g->BlendLine(
Position.X+1+XRES/2, Position + Vec2{ 1+XRES/2, linePos },
Position.Y+linePos, Position + Vec2{ Size.X-2, linePos },
Position.X+Size.X-2, RGBA<uint8_t>(255, 255, 255, 100));
Position.Y+linePos,
255, 255, 255, 100);
} }
if (c->GetDoOpen()) if (c->GetDoOpen())
{ {
g->fillrect(Position.X+(Size.X/2)-101, Position.Y+(Size.Y/2)-26, 202, 52, 0, 0, 0, 210); g->BlendFilledRect(RectSized(Position + Size / 2 - Vec2{ 101, 26 }, { 202, 52 }), RGBA<uint8_t>(0, 0, 0, 210));
g->drawrect(Position.X+(Size.X/2)-100, Position.Y+(Size.Y/2)-25, 200, 50, 255, 255, 255, 180); g->BlendRect(RectSized(Position + Size / 2 - Vec2{ 100, 25 }, Vec2{ 200, 50 }), RGBA<uint8_t>(255, 255, 255, 180));
g->BlendText(Position + Vec2{(Size.X/2)-((Graphics::TextSize("Loading save...").X - 1)/2), (Size.Y/2)-5}, "Loading save...", RGBA<uint8_t>(style::Colour::InformationTitle.Red, style::Colour::InformationTitle.Green, style::Colour::InformationTitle.Blue, 255)); g->BlendText(Position + Vec2{(Size.X/2)-((Graphics::TextSize("Loading save...").X - 1)/2), (Size.Y/2)-5}, "Loading save...", RGBA<uint8_t>(style::Colour::InformationTitle.Red, style::Colour::InformationTitle.Green, style::Colour::InformationTitle.Blue, 255));
} }
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
} }
@ -289,8 +287,8 @@ void PreviewView::OnDraw()
{ {
g->BlendImage(savePreview->Data(), 0xFF, RectSized(Position + Vec2(1, 1) + (RES / 2 - savePreview->Size()) / 2, savePreview->Size())); g->BlendImage(savePreview->Data(), 0xFF, RectSized(Position + Vec2(1, 1) + (RES / 2 - savePreview->Size()) / 2, savePreview->Size()));
} }
g->drawrect(Position.X, Position.Y, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 100); g->BlendRect(RectSized(Position, RES / 2 + Vec2{ 1, 1 }), RGBA<uint8_t>(255, 255, 255, 100));
g->draw_line(Position.X+XRES/2, Position.Y+1, Position.X+XRES/2, Position.Y+Size.Y-2, 200, 200, 200, 255); g->DrawLine(Position + Vec2{ XRES/2, 1 }, Position + Vec2{ XRES/2, Size.Y-2 }, RGB<uint8_t>(200, 200, 200));
if(votesUp || votesDown) if(votesUp || votesDown)
{ {
@ -314,13 +312,13 @@ void PreviewView::OnDraw()
nyu = nyu>50?50:nyu; nyu = nyu>50?50:nyu;
nyd = nyd>50?50:nyd; nyd = nyd>50?50:nyd;
g->fillrect(Position.X+(XRES/2)-55, Position.Y+(YRES/2)+3, 53, 7, 0, 107, 10, 255); g->DrawFilledRect(RectSized(Position + RES / 2 + Vec2{ -55, 3 }, Vec2{ 53, 7 }), RGB<uint8_t>(0, 107, 10));
g->fillrect(Position.X+(XRES/2)-55, Position.Y+(YRES/2)+9, 53, 7, 107, 10, 0, 255); g->DrawFilledRect(RectSized(Position + RES / 2 + Vec2{ -55, 9 }, Vec2{ 53, 7 }), RGB<uint8_t>(107, 10, 0));
g->drawrect(Position.X+(XRES/2)-55, Position.Y+(YRES/2)+3, 53, 7, 128, 128, 128, 255); g->DrawRect(RectSized(Position + Vec2{ (XRES/2)-55, (YRES/2)+3 }, { 53, 7 }), RGB<uint8_t>(128, 128, 128));
g->drawrect(Position.X+(XRES/2)-55, Position.Y+(YRES/2)+9, 53, 7, 128, 128, 128, 255); g->DrawRect(RectSized(Position + Vec2{ (XRES/2)-55, (YRES/2)+9 }, { 53, 7 }), RGB<uint8_t>(128, 128, 128));
g->fillrect(Position.X+(XRES/2)-4-nyu, Position.Y+(YRES/2)+5, nyu, 3, 57, 187, 57, 255); g->DrawFilledRect(RectSized(Position + RES / 2 + Vec2{ -4-nyu, 5 }, Vec2{ nyu, 3 }), RGB<uint8_t>(57, 187, 57));
g->fillrect(Position.X+(XRES/2)-4-nyd, Position.Y+(YRES/2)+11, nyd, 3, 187, 57, 57, 255); g->DrawFilledRect(RectSized(Position + RES / 2 + Vec2{ -4-nyd, 11 }, Vec2{ nyd, 3 }), RGB<uint8_t>(187, 57, 57));
} }
} }

View File

@ -233,7 +233,7 @@ void ProfileActivity::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
} }
void ProfileActivity::OnTryExit(ExitMethod method) void ProfileActivity::OnTryExit(ExitMethod method)

View File

@ -162,12 +162,12 @@ void RenderView::OnDraw()
ren->RenderBegin(); ren->RenderBegin();
ren->RenderEnd(); ren->RenderEnd();
} }
g->draw_line(0, YRES, XRES-1, YRES, 200, 200, 200, 255); g->DrawLine({ 0, YRES }, { XRES-1, YRES }, RGB<uint8_t>(200, 200, 200));
g->draw_line(line1, YRES, line1, WINDOWH, 200, 200, 200, 255); g->DrawLine({ line1, YRES }, { line1, WINDOWH }, RGB<uint8_t>(200, 200, 200));
g->draw_line(line2, YRES, line2, WINDOWH, 200, 200, 200, 255); g->DrawLine({ line2, YRES }, { line2, WINDOWH }, RGB<uint8_t>(200, 200, 200));
g->draw_line(line3, YRES, line3, WINDOWH, 200, 200, 200, 255); g->DrawLine({ line3, YRES }, { line3, WINDOWH }, RGB<uint8_t>(200, 200, 200));
g->draw_line(line4, YRES, line4, WINDOWH, 200, 200, 200, 255); g->DrawLine({ line4, YRES }, { line4, WINDOWH }, RGB<uint8_t>(200, 200, 200));
g->draw_line(XRES, 0, XRES, WINDOWH, 255, 255, 255, 255); g->DrawLine({ XRES, 0 }, { XRES, WINDOWH }, RGB<uint8_t>(255, 255, 255));
if(toolTipPresence && toolTip.length()) if(toolTipPresence && toolTip.length())
{ {
g->BlendText({ 6, Size.Y-MENUSIZE-12 }, toolTip, RGBA<uint8_t>(255, 255, 255, toolTipPresence>51?255:toolTipPresence*5)); g->BlendText({ 6, Size.Y-MENUSIZE-12 }, toolTip, RGBA<uint8_t>(255, 255, 255, toolTipPresence>51?255:toolTipPresence*5));

View File

@ -206,7 +206,7 @@ void SearchController::OpenSave(int saveID)
{ {
delete activePreview; delete activePreview;
Graphics * g = searchView->GetGraphics(); Graphics * g = searchView->GetGraphics();
g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable g->BlendFilledRect(RectSized(Vec2{ XRES/3, WINDOWH-20 }, Vec2{ XRES/3, 20 }), RGBA<uint8_t>(0, 0, 0, 150)); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
activePreview = new PreviewController(saveID, 0, instantOpen, [this] { OpenSaveDone(); }); activePreview = new PreviewController(saveID, 0, instantOpen, [this] { OpenSaveDone(); });
activePreview->GetView()->MakeActiveWindow(); activePreview->GetView()->MakeActiveWindow();
} }
@ -215,7 +215,7 @@ void SearchController::OpenSave(int saveID, int saveDate)
{ {
delete activePreview; delete activePreview;
Graphics * g = searchView->GetGraphics(); Graphics * g = searchView->GetGraphics();
g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable g->BlendFilledRect(RectSized(Vec2{ XRES/3, WINDOWH-20 }, Vec2{ XRES/3, 20 }), RGBA<uint8_t>(0, 0, 0, 150)); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
activePreview = new PreviewController(saveID, saveDate, instantOpen, [this] { OpenSaveDone(); }); activePreview = new PreviewController(saveID, saveDate, instantOpen, [this] { OpenSaveDone(); });
activePreview->GetView()->MakeActiveWindow(); activePreview->GetView()->MakeActiveWindow();
} }

View File

@ -53,7 +53,7 @@ void TagsView::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
} }
void TagsView::NotifyTagsChanged(TagsModel * sender) void TagsView::NotifyTagsChanged(TagsModel * sender)

View File

@ -891,7 +891,7 @@ int luatpt_drawpixel(lua_State* l)
else if (b>255) b = 255; else if (b>255) b = 255;
if (a<0) a = 0; if (a<0) a = 0;
else if (a>255) a = 255; else if (a>255) a = 255;
luacon_g->blendpixel(x, y, r, g, b, a); luacon_g->BlendPixel({ x, y }, RGBA<uint8_t>(r, g, b, a));
return 0; return 0;
} }
@ -921,7 +921,14 @@ int luatpt_drawrect(lua_State* l)
else if (b>255) b = 255; else if (b>255) b = 255;
if (a<0) a = 0; if (a<0) a = 0;
else if (a>255) a = 255; else if (a>255) a = 255;
luacon_g->drawrect(x, y, w, h, r, g, b, a); if (a == 255)
{
luacon_g->DrawRect(RectSized(Vec2{ x, y }, Vec2{ w, h }), RGB<uint8_t>(r, g, b));
}
else
{
luacon_g->BlendRect(RectSized(Vec2{ x, y }, Vec2{ w, h }), RGBA<uint8_t>(r, g, b, a));
}
return 0; return 0;
} }
@ -951,7 +958,14 @@ int luatpt_fillrect(lua_State* l)
else if (b>255) b = 255; else if (b>255) b = 255;
if (a<0) a = 0; if (a<0) a = 0;
else if (a>255) a = 255; else if (a>255) a = 255;
luacon_g->fillrect(x, y, w, h, r, g, b, a); if (a == 255)
{
luacon_g->DrawFilledRect(RectSized(Vec2{ x, y }, Vec2{ w, h }), RGB<uint8_t>(r, g, b));
}
else
{
luacon_g->BlendFilledRect(RectSized(Vec2{ x, y }, Vec2{ w, h }), RGBA<uint8_t>(r, g, b, a));
}
return 0; return 0;
} }
@ -976,7 +990,14 @@ int luatpt_drawline(lua_State* l)
else if (b>255) b = 255; else if (b>255) b = 255;
if (a<0) a = 0; if (a<0) a = 0;
else if (a>255) a = 255; else if (a>255) a = 255;
luacon_g->draw_line(x1, y1, x2, y2, r, g, b, a); if (a == 255)
{
luacon_g->DrawLine({ x1, y1 }, { x2, y2 }, RGB<uint8_t>(r, g, b));
}
else
{
luacon_g->BlendLine({ x1, y1 }, { x2, y2 }, RGBA<uint8_t>(r, g, b, a));
}
return 0; return 0;
} }

View File

@ -3836,7 +3836,14 @@ int LuaScriptInterface::graphics_drawLine(lua_State * l)
if (a<0) a = 0; if (a<0) a = 0;
else if (a>255) a = 255; else if (a>255) a = 255;
luacon_g->draw_line(x1, y1, x2, y2, r, g, b, a); if (a == 255)
{
luacon_g->DrawLine({ x1, y1 }, { x2, y2 }, RGB<uint8_t>(r, g, b));
}
else
{
luacon_g->BlendLine({ x1, y1 }, { x2, y2 }, RGBA<uint8_t>(r, g, b, a));
}
return 0; return 0;
} }
@ -3860,7 +3867,14 @@ int LuaScriptInterface::graphics_drawRect(lua_State * l)
if (a<0) a = 0; if (a<0) a = 0;
else if (a>255) a = 255; else if (a>255) a = 255;
luacon_g->drawrect(x, y, width, height, r, g, b, a); if (a == 255)
{
luacon_g->DrawRect(RectSized(Vec2{ x, y }, Vec2{ width, height }), RGB<uint8_t>(r, g, b));
}
else
{
luacon_g->BlendRect(RectSized(Vec2{ x, y }, Vec2{ width, height }), RGBA<uint8_t>(r, g, b, a));
}
return 0; return 0;
} }
@ -3884,7 +3898,14 @@ int LuaScriptInterface::graphics_fillRect(lua_State * l)
if (a<0) a = 0; if (a<0) a = 0;
else if (a>255) a = 255; else if (a>255) a = 255;
luacon_g->fillrect(x, y, width, height, r, g, b, a); if (a == 255)
{
luacon_g->DrawFilledRect(RectSized(Vec2{ x, y }, Vec2{ width, height }), RGB<uint8_t>(r, g, b));
}
else
{
luacon_g->BlendFilledRect(RectSized(Vec2{ x, y }, Vec2{ width, height }), RGBA<uint8_t>(r, g, b, a));
}
return 0; return 0;
} }

View File

@ -81,7 +81,7 @@ LuaWindow::LuaWindow(lua_State * l) :
{ {
Graphics * g = ui::Engine::Ref().g; Graphics * g = ui::Engine::Ref().g;
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
luaWindow->triggerOnDraw(); luaWindow->triggerOnDraw();
} }
void OnInitialized() override { luaWindow->triggerOnInitialized(); } void OnInitialized() override { luaWindow->triggerOnInitialized(); }

View File

@ -87,9 +87,9 @@ void TaskWindow::OnDraw()
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb); g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->DrawRect(RectSized(Position, Size), RGB<uint8_t>(255, 255, 255));
g->draw_line(Position.X, Position.Y + Size.Y-17, Position.X + Size.X - 1, Position.Y + Size.Y-17, 255, 255, 255, 255); g->DrawLine(Position + Vec2{ 0, Size.Y-17 }, Position + Vec2{ Size.X - 1, Size.Y-17 }, RGB<uint8_t>(255, 255, 255));
ui::Colour progressBarColour = style::Colour::WarningTitle; ui::Colour progressBarColour = style::Colour::WarningTitle;
@ -101,7 +101,7 @@ void TaskWindow::OnDraw()
progress = 100; progress = 100;
float size = float(Size.X-4)*(float(progress)/100.0f); // TIL... float size = float(Size.X-4)*(float(progress)/100.0f); // TIL...
size = std::min(std::max(size, 0.0f), float(Size.X-4)); size = std::min(std::max(size, 0.0f), float(Size.X-4));
g->fillrect(Position.X + 2, Position.Y + Size.Y-15, int(size), 13, progressBarColour.Red, progressBarColour.Green, progressBarColour.Blue, 255); g->DrawFilledRect(RectSized(Position + Vec2{ 2, Size.Y-15 }, Vec2{ int(size), 13 }), progressBarColour.NoAlpha());
} }
} else { } else {
int size = 40, rsize = 0; int size = 40, rsize = 0;
@ -111,10 +111,10 @@ void TaskWindow::OnDraw()
size = (Size.X-4)-int(position)+1; size = (Size.X-4)-int(position)+1;
rsize = 40-size; rsize = 40-size;
} }
g->fillrect(Position.X + 2 + int(position), Position.Y + Size.Y-15, size, 13, progressBarColour.Red, progressBarColour.Green, progressBarColour.Blue, 255); g->DrawFilledRect(RectSized(Position + Vec2{ 2 + int(position), Size.Y-15 }, Vec2{ size, 13 }), progressBarColour.NoAlpha());
if(rsize) if(rsize)
{ {
g->fillrect(Position.X + 2, Position.Y + Size.Y-15, rsize, 13, progressBarColour.Red, progressBarColour.Green, progressBarColour.Blue, 255); g->DrawFilledRect(RectSized(Position + Vec2{ 2, Size.Y-15 }, Vec2{ rsize, 13 }), progressBarColour.NoAlpha());
} }
} }
g->BlendText(Position + Vec2{ ((Size.X-(Graphics::TextSize(progressStatus).X - 1))/2), Size.Y-13 }, progressStatus, progress<50 ? RGBA<uint8_t>(255, 255, 255, 255) : RGBA<uint8_t>(0, 0, 0, 255)); g->BlendText(Position + Vec2{ ((Size.X-(Graphics::TextSize(progressStatus).X - 1))/2), Size.Y-13 }, progressStatus, progress<50 ? RGBA<uint8_t>(255, 255, 255, 255) : RGBA<uint8_t>(0, 0, 0, 255));