Fix some deprecation warnings

Namely:

 - [[deprecated("Use BlendChar")]]
 - [[deprecated("Use AddChar")]]
 - [[deprecated("Use XorPixel")]]
 - [[deprecated("Use AddPixel")]]
 - [[deprecated("Use XorLine")]]
 - [[deprecated("Use XorDottedRect")]]
 - [[deprecated("Use XorImage")]]
 - [[deprecated("Use BlendEllipse")]]
 - [[deprecated("Use BlendFilledEllipse")]]
 - [[deprecated("Use DrawFilledRect (beware off by 1)")]]
This commit is contained in:
Tamás Bálint Misius 2023-04-30 11:27:58 +02:00
parent f5cbc30d85
commit 9fbb780728
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
31 changed files with 201 additions and 284 deletions

View File

@ -22,9 +22,9 @@ void DebugParts::Draw()
for (int i = 0; i < NPART; i++)
{
if (sim->parts[i].type)
g->addpixel(x, y, 255, 255, 255, 180);
g->AddPixel({ x, y }, RGBA<uint8_t>(255, 255, 255, 180));
else
g->addpixel(x, y, 0, 0, 0, 180);
g->AddPixel({ x, y }, RGBA<uint8_t>(0, 0, 0, 180));
if (i == sim->parts_lastActiveIndex)
{
@ -40,12 +40,12 @@ void DebugParts::Draw()
}
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, 255, 50, 50, 220);
g->AddPixel({ lpx, lpy }, RGBA<uint8_t>(255, 50, 50, 220));
g->addpixel(lpx+1, lpy, 255, 50, 50, 120);
g->addpixel(lpx-1, lpy, 255, 50, 50, 120);
g->addpixel(lpx, lpy+1, 255, 50, 50, 120);
g->addpixel(lpx, lpy-1, 255, 50, 50, 120);
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->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));

View File

@ -174,269 +174,269 @@ void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool inve
{
case IconOpen:
if(invert)
drawchar(x, y, 0xE001, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE001, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y, 0xE001, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE001, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconReload:
if(invert)
drawchar(x, y, 0xE011, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE011, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y, 0xE011, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE011, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconSave:
if(invert)
drawchar(x, y, 0xE002, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE002, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y, 0xE002, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE002, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconVoteUp:
if(invert)
{
drawchar(x-11, y+1, 0xE04B, 0, 100, 0, alpha);
BlendChar({ x-11, y+1 }, 0xE04B, RGBA<uint8_t>(0, 100, 0, alpha));
BlendText({ x+2, y+1 }, "Vote", RGBA<uint8_t>(0, 100, 0, alpha));
}
else
{
drawchar(x-11, y+1, 0xE04B, 0, 187, 18, alpha);
BlendChar({ x-11, y+1 }, 0xE04B, RGBA<uint8_t>(0, 187, 18, alpha));
BlendText({ x+2, y+1 }, "Vote", RGBA<uint8_t>(0, 187, 18, alpha));
}
break;
case IconVoteDown:
if(invert)
drawchar(x, y, 0xE04A, 100, 10, 0, alpha);
BlendChar({ x, y }, 0xE04A, RGBA<uint8_t>(100, 10, 0, alpha));
else
drawchar(x, y, 0xE04A, 187, 40, 0, alpha);
BlendChar({ x, y }, 0xE04A, RGBA<uint8_t>(187, 40, 0, alpha));
break;
case IconTag:
if(invert)
drawchar(x, y, 0xE003, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE003, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y, 0xE003, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE003, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconNew:
if(invert)
drawchar(x, y, 0xE012, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE012, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y, 0xE012, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE012, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconLogin:
if(invert)
drawchar(x, y+1, 0xE004, 0, 0, 0, alpha);
BlendChar({ x, y + 1 }, 0xE004, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y+1, 0xE004, 255, 255, 255, alpha);
BlendChar({ x, y + 1 }, 0xE004, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconSimulationSettings:
if(invert)
drawchar(x, y+1, 0xE04F, 0, 0, 0, alpha);
BlendChar({ x, y + 1 }, 0xE04F, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y+1, 0xE04F, 255, 255, 255, alpha);
BlendChar({ x, y + 1 }, 0xE04F, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconRenderSettings:
if(invert)
{
drawchar(x, y+1, 0xE058, 255, 0, 0, alpha);
drawchar(x, y+1, 0xE059, 0, 255, 0, alpha);
drawchar(x, y+1, 0xE05A, 0, 0, 255, alpha);
BlendChar({ x, y + 1 }, 0xE058, RGBA<uint8_t>(255, 0, 0, alpha));
BlendChar({ x, y + 1 }, 0xE059, RGBA<uint8_t>(0, 255, 0, alpha));
BlendChar({ x, y + 1 }, 0xE05A, RGBA<uint8_t>(0, 0, 255, alpha));
}
else
{
addchar(x, y+1, 0xE058, 255, 0, 0, alpha);
addchar(x, y+1, 0xE059, 0, 255, 0, alpha);
addchar(x, y+1, 0xE05A, 0, 0, 255, alpha);
AddChar({ x, y + 1 }, 0xE058, RGBA<uint8_t>(255, 0, 0, alpha));
AddChar({ x, y + 1 }, 0xE059, RGBA<uint8_t>(0, 255, 0, alpha));
AddChar({ x, y + 1 }, 0xE05A, RGBA<uint8_t>(0, 0, 255, alpha));
}
break;
case IconPause:
if(invert)
drawchar(x, y, 0xE010, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE010, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y, 0xE010, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE010, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconFavourite:
if(invert)
drawchar(x, y, 0xE04C, 100, 80, 32, alpha);
BlendChar({ x, y }, 0xE04C, RGBA<uint8_t>(100, 80, 32, alpha));
else
drawchar(x, y, 0xE04C, 192, 160, 64, alpha);
BlendChar({ x, y }, 0xE04C, RGBA<uint8_t>(192, 160, 64, alpha));
break;
case IconReport:
if(invert)
drawchar(x, y, 0xE063, 140, 140, 0, alpha);
BlendChar({ x, y }, 0xE063, RGBA<uint8_t>(140, 140, 0, alpha));
else
drawchar(x, y, 0xE063, 255, 255, 0, alpha);
BlendChar({ x, y }, 0xE063, RGBA<uint8_t>(255, 255, 0, alpha));
break;
case IconUsername:
if(invert)
{
drawchar(x, y, 0xE00B, 32, 64, 128, alpha);
drawchar(x, y, 0xE00A, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE00B, RGBA<uint8_t>(32, 64, 128, alpha));
BlendChar({ x, y }, 0xE00A, RGBA<uint8_t>(0, 0, 0, alpha));
}
else
{
drawchar(x, y, 0xE00B, 32, 64, 128, alpha);
drawchar(x, y, 0xE00A, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE00B, RGBA<uint8_t>(32, 64, 128, alpha));
BlendChar({ x, y }, 0xE00A, RGBA<uint8_t>(255, 255, 255, alpha));
}
break;
case IconPassword:
if(invert)
{
drawchar(x, y, 0xE00C, 160, 144, 32, alpha);
drawchar(x, y, 0xE004, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE00C, RGBA<uint8_t>(160, 144, 32, alpha));
BlendChar({ x, y }, 0xE004, RGBA<uint8_t>(0, 0, 0, alpha));
}
else
{
drawchar(x, y, 0xE00C, 160, 144, 32, alpha);
drawchar(x, y, 0xE004, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE00C, RGBA<uint8_t>(160, 144, 32, alpha));
BlendChar({ x, y }, 0xE004, RGBA<uint8_t>(255, 255, 255, alpha));
}
break;
case IconClose:
if(invert)
drawchar(x, y, 0xE02A, 20, 20, 20, alpha);
BlendChar({ x, y }, 0xE02A, RGBA<uint8_t>(20, 20, 20, alpha));
else
drawchar(x, y, 0xE02A, 230, 230, 230, alpha);
BlendChar({ x, y }, 0xE02A, RGBA<uint8_t>(230, 230, 230, alpha));
break;
case IconVoteSort:
if (invert)
{
drawchar(x, y, 0xE029, 44, 48, 32, alpha);
drawchar(x, y, 0xE028, 32, 44, 32, alpha);
drawchar(x, y, 0xE027, 128, 128, 128, alpha);
BlendChar({ x, y }, 0xE029, RGBA<uint8_t>(44, 48, 32, alpha));
BlendChar({ x, y }, 0xE028, RGBA<uint8_t>(32, 44, 32, alpha));
BlendChar({ x, y }, 0xE027, RGBA<uint8_t>(128, 128, 128, alpha));
}
else
{
drawchar(x, y, 0xE029, 144, 48, 32, alpha);
drawchar(x, y, 0xE028, 32, 144, 32, alpha);
drawchar(x, y, 0xE027, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE029, RGBA<uint8_t>(144, 48, 32, alpha));
BlendChar({ x, y }, 0xE028, RGBA<uint8_t>(32, 144, 32, alpha));
BlendChar({ x, y }, 0xE027, RGBA<uint8_t>(255, 255, 255, alpha));
}
break;
case IconDateSort:
if (invert)
{
drawchar(x, y, 0xE026, 32, 32, 32, alpha);
BlendChar({ x, y }, 0xE026, RGBA<uint8_t>(32, 32, 32, alpha));
}
else
{
drawchar(x, y, 0xE026, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE026, RGBA<uint8_t>(255, 255, 255, alpha));
}
break;
case IconMyOwn:
if (invert)
{
drawchar(x, y, 0xE014, 192, 160, 64, alpha);
drawchar(x, y, 0xE013, 32, 32, 32, alpha);
BlendChar({ x, y }, 0xE014, RGBA<uint8_t>(192, 160, 64, alpha));
BlendChar({ x, y }, 0xE013, RGBA<uint8_t>(32, 32, 32, alpha));
}
else
{
drawchar(x, y, 0xE014, 192, 160, 64, alpha);
drawchar(x, y, 0xE013, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE014, RGBA<uint8_t>(192, 160, 64, alpha));
BlendChar({ x, y }, 0xE013, RGBA<uint8_t>(255, 255, 255, alpha));
}
break;
case IconSearch:
drawchar(x, y, 0xE00E, 30, 30, 180, alpha);
drawchar(x, y, 0xE00F, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE00E, RGBA<uint8_t>(30, 30, 180, alpha));
BlendChar({ x, y }, 0xE00F, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconDelete:
if(invert)
{
drawchar(x, y, 0xE006, 159, 47, 31, alpha);
drawchar(x, y, 0xE005, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE006, RGBA<uint8_t>(159, 47, 31, alpha));
BlendChar({ x, y }, 0xE005, RGBA<uint8_t>(0, 0, 0, alpha));
}
else
{
drawchar(x, y, 0xE006, 159, 47, 31, alpha);
drawchar(x, y, 0xE005, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE006, RGBA<uint8_t>(159, 47, 31, alpha));
BlendChar({ x, y }, 0xE005, RGBA<uint8_t>(255, 255, 255, alpha));
}
break;
case IconAdd:
if(invert)
{
drawchar(x, y, 0xE006, 32, 144, 32, alpha);
drawchar(x, y, 0xE009, 0, 0, 0, alpha);
BlendChar({ x, y }, 0xE006, RGBA<uint8_t>(32, 144, 32, alpha));
BlendChar({ x, y }, 0xE009, RGBA<uint8_t>(0, 0, 0, alpha));
}
else
{
drawchar(x, y, 0xE006, 32, 144, 32, alpha);
drawchar(x, y, 0xE009, 255, 255, 255, alpha);
BlendChar({ x, y }, 0xE006, RGBA<uint8_t>(32, 144, 32, alpha));
BlendChar({ x, y }, 0xE009, RGBA<uint8_t>(255, 255, 255, alpha));
}
break;
case IconVelocity:
drawchar(x+1, y, 0xE018, 128, 160, 255, alpha);
BlendChar({ x + 1, y }, 0xE018, RGBA<uint8_t>(128, 160, 255, alpha));
break;
case IconPressure:
if(invert)
drawchar(x+1, y+1, 0xE019, 180, 160, 16, alpha);
BlendChar({ x + 1, y + 1 }, 0xE019, RGBA<uint8_t>(180, 160, 16, alpha));
else
drawchar(x+1, y+1, 0xE019, 255, 212, 32, alpha);
BlendChar({ x + 1, y + 1 }, 0xE019, RGBA<uint8_t>(255, 212, 32, alpha));
break;
case IconPersistant:
if(invert)
drawchar(x+1, y+1, 0xE01A, 20, 20, 20, alpha);
BlendChar({ x + 1, y + 1 }, 0xE01A, RGBA<uint8_t>(20, 20, 20, alpha));
else
drawchar(x+1, y+1, 0xE01A, 212, 212, 212, alpha);
BlendChar({ x + 1, y + 1 }, 0xE01A, RGBA<uint8_t>(212, 212, 212, alpha));
break;
case IconFire:
drawchar(x+1, y+1, 0xE01B, 255, 0, 0, alpha);
drawchar(x+1, y+1, 0xE01C, 255, 255, 64, alpha);
BlendChar({ x + 1, y + 1 }, 0xE01B, RGBA<uint8_t>(255, 0, 0, alpha));
BlendChar({ x + 1, y + 1 }, 0xE01C, RGBA<uint8_t>(255, 255, 64, alpha));
break;
case IconBlob:
if(invert)
drawchar(x+1, y, 0xE03F, 55, 180, 55, alpha);
BlendChar({ x + 1, y }, 0xE03F, RGBA<uint8_t>(55, 180, 55, alpha));
else
drawchar(x+1, y, 0xE03F, 55, 255, 55, alpha);
BlendChar({ x + 1, y }, 0xE03F, RGBA<uint8_t>(55, 255, 55, alpha));
break;
case IconHeat:
drawchar(x+3, y, 0xE03E, 255, 0, 0, alpha);
BlendChar({ x + 3, y }, 0xE03E, RGBA<uint8_t>(255, 0, 0, alpha));
if(invert)
drawchar(x+3, y, 0xE03D, 0, 0, 0, alpha);
BlendChar({ x + 3, y }, 0xE03D, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x+3, y, 0xE03D, 255, 255, 255, alpha);
BlendChar({ x + 3, y }, 0xE03D, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconBlur:
if(invert)
drawchar(x+1, y, 0xE044, 50, 70, 180, alpha);
BlendChar({ x + 1, y }, 0xE044, RGBA<uint8_t>(50, 70, 180, alpha));
else
drawchar(x+1, y, 0xE044, 100, 150, 255, alpha);
BlendChar({ x + 1, y }, 0xE044, RGBA<uint8_t>(100, 150, 255, alpha));
break;
case IconGradient:
if(invert)
drawchar(x+1, y+1, 0xE053, 255, 50, 255, alpha);
BlendChar({ x + 1, y + 1 }, 0xE053, RGBA<uint8_t>(255, 50, 255, alpha));
else
drawchar(x+1, y+1, 0xE053, 205, 50, 205, alpha);
BlendChar({ x + 1, y + 1 }, 0xE053, RGBA<uint8_t>(205, 50, 205, alpha));
break;
case IconLife:
if(invert)
drawchar(x, y+1, 0xE060, 0, 0, 0, alpha);
BlendChar({ x, y + 1 }, 0xE060, RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y+1, 0xE060, 255, 255, 255, alpha);
BlendChar({ x, y + 1 }, 0xE060, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconEffect:
drawchar(x+1, y, 0xE061, 255, 255, 160, alpha);
BlendChar({ x + 1, y }, 0xE061, RGBA<uint8_t>(255, 255, 160, alpha));
break;
case IconGlow:
drawchar(x+1, y, 0xE05F, 200, 255, 255, alpha);
BlendChar({ x + 1, y }, 0xE05F, RGBA<uint8_t>(200, 255, 255, alpha));
break;
case IconWarp:
drawchar(x+1, y, 0xE05E, 255, 255, 255, alpha);
BlendChar({ x + 1, y }, 0xE05E, RGBA<uint8_t>(255, 255, 255, alpha));
break;
case IconBasic:
if(invert)
drawchar(x+1, y+1, 0xE05B, 50, 50, 0, alpha);
BlendChar({ x + 1, y + 1 }, 0xE05B, RGBA<uint8_t>(50, 50, 0, alpha));
else
drawchar(x+1, y+1, 0xE05B, 255, 255, 200, alpha);
BlendChar({ x + 1, y + 1 }, 0xE05B, RGBA<uint8_t>(255, 255, 200, alpha));
break;
case IconAltAir:
if(invert) {
drawchar(x+1, y+1, 0xE054, 180, 55, 55, alpha);
drawchar(x+1, y+1, 0xE055, 55, 180, 55, alpha);
BlendChar({ x + 1, y + 1 }, 0xE054, RGBA<uint8_t>(180, 55, 55, alpha));
BlendChar({ x + 1, y + 1 }, 0xE055, RGBA<uint8_t>(55, 180, 55, alpha));
} else {
drawchar(x+1, y+1, 0xE054, 255, 55, 55, alpha);
drawchar(x+1, y+1, 0xE055, 55, 255, 55, alpha);
BlendChar({ x + 1, y + 1 }, 0xE054, RGBA<uint8_t>(255, 55, 55, alpha));
BlendChar({ x + 1, y + 1 }, 0xE055, RGBA<uint8_t>(55, 255, 55, alpha));
}
break;
default:
if(invert)
drawchar(x, y, 't', 0, 0, 0, alpha);
BlendChar({ x, y }, 't', RGBA<uint8_t>(0, 0, 0, alpha));
else
drawchar(x, y, 't', 255, 255, 255, alpha);
BlendChar({ x, y }, 't', RGBA<uint8_t>(255, 255, 255, alpha));
break;
}
}

View File

@ -60,32 +60,12 @@ struct RasterDrawMethods
void Clear();
[[deprecated("Use BlendChar")]]
int drawchar(int x, int y, String::value_type, int r, int g, int b, int a);
[[deprecated("Use AddChar")]]
int addchar(int x, int y, String::value_type, int r, int g, int b, int a);
[[deprecated("Use XorPixel")]]
void xor_pixel(int x, int y);
[[deprecated("Use DrawPixel/BlendPixel")]]
void blendpixel(int x, int y, int r, int g, int b, int a);
[[deprecated("Use AddPixel")]]
void addpixel(int x, int y, int r, int g, int b, int a);
[[deprecated("Use XorLine")]]
void xor_line(int x1, int y1, int x2, int y2);
[[deprecated("Use XorDottedRect")]]
void xor_rect(int x, int y, int w, int h);
[[deprecated("Use XorImage")]]
void xor_bitmap(unsigned char *bitmap, int x, int y, int w, int h);
[[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);
[[deprecated("Use BlendEllipse")]]
void drawcircle(int x, int y, int rx, int ry, int r, int g, int b, int a);
[[deprecated("Use BlendFilledEllipse")]]
void fillcircle(int x, int y, int rx, int ry, int r, int g, int b, int a);
[[deprecated("Use DrawFilledRect (beware off by 1)")]]
void clearrect(int x, int y, int w, int h);
};

View File

@ -5,7 +5,6 @@
#include "Graphics.h"
#include "RasterDrawMethods.h"
#define video() (static_cast<Derived &>(*this).video)
#define clipRect() (static_cast<Derived const &>(*this).getClipRect())
template<typename Derived, typename V>
@ -401,28 +400,6 @@ String::const_iterator RasterDrawMethods<Derived>::TextFit(String const &str, in
return str.end();
}
template<typename Derived>
int RasterDrawMethods<Derived>::drawchar(int x, int y, String::value_type c, int r, int g, int b, int a)
{
return x + BlendChar(Vec2(x, y), c, RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
int RasterDrawMethods<Derived>::addchar(int x, int y, String::value_type c, int r, int g, int b, int a)
{
FontReader reader(c);
for (int j = -2; j < FONT_H - 2; j++)
for (int i = 0; i < reader.GetWidth(); i++)
addpixel(x + i, y + j, r, g, b, reader.NextPixel() * a / 3);
return x + reader.GetWidth();
}
template<typename Derived>
void RasterDrawMethods<Derived>::xor_pixel(int x, int y)
{
XorPixel(Vec2(x, y));
}
template<typename Derived>
void RasterDrawMethods<Derived>::blendpixel(int x, int y, int r, int g, int b, int a)
{
@ -432,30 +409,6 @@ void RasterDrawMethods<Derived>::blendpixel(int x, int y, int r, int g, int b, i
BlendPixel(Vec2(x, y), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::addpixel(int x, int y, int r, int g, int b, int a)
{
AddPixel(Vec2(x, y), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::xor_line(int x1, int y1, int x2, int y2)
{
XorLine(Vec2(x1, y1), Vec2(x2, y2));
}
template<typename Derived>
void RasterDrawMethods<Derived>::xor_rect(int x, int y, int w, int h)
{
XorDottedRect(RectSized(Vec2(x, y), Vec2(w, h)));
}
template<typename Derived>
void RasterDrawMethods<Derived>::xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h)
{
XorImage(bitmap, RectSized(Vec2(x, y), Vec2(w, h)));
}
template<typename Derived>
void RasterDrawMethods<Derived>::draw_line(int x1, int y1, int x2, int y2, int r, int g, int b, int a)
{
@ -483,23 +436,4 @@ void RasterDrawMethods<Derived>::fillrect(int x, int y, int w, int h, int r, int
BlendFilledRect(RectSized(Vec2(x, y), Vec2(w, h)), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::drawcircle(int x, int y, int rx, int ry, int r, int g, int b, int a)
{
BlendEllipse(Vec2(x, y), Vec2(rx, ry), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::fillcircle(int x, int y, int rx, int ry, int r, int g, int b, int a)
{
BlendFilledEllipse(Vec2(x, y), Vec2(rx, ry), RGBA<uint8_t>(r, g, b, a));
}
template<typename Derived>
void RasterDrawMethods<Derived>::clearrect(int x, int y, int w, int h)
{
DrawFilledRect(RectSized(Vec2(x + 1, y + 1), Vec2(w - 1, h - 1)), 0x000000_rgb);
}
#undef video
#undef clipRect

View File

@ -150,7 +150,7 @@ void Renderer::DrawSigns()
if (currentSign.text.length())
{
String text = currentSign.getDisplayText(sim, x, y, w, h);
clearrect(x, y, w+1, h);
DrawFilledRect(RectSized(Vec2{ x + 1, y + 1 }, Vec2{ w, h - 1 }), 0x000000_rgb);
drawrect(x, y, w+1, h, 192, 192, 192, 255);
BlendText({ x+3, y+4 }, text, RGBA<uint8_t>(255, 255, 255, 255));
@ -535,7 +535,7 @@ void Renderer::render_parts()
}
if(pixel_mode & PMODE_ADD)
{
addpixel(nx, ny, colr, colg, colb, cola);
AddPixel({ nx, ny }, RGBA<uint8_t>(colr, colg, colb, cola));
}
if(pixel_mode & PMODE_BLOB)
{
@ -554,24 +554,24 @@ void Renderer::render_parts()
if(pixel_mode & PMODE_GLOW)
{
int cola1 = (5*cola)/255;
addpixel(nx, ny, colr, colg, colb, (192*cola)/255);
addpixel(nx+1, ny, colr, colg, colb, (96*cola)/255);
addpixel(nx-1, ny, colr, colg, colb, (96*cola)/255);
addpixel(nx, ny+1, colr, colg, colb, (96*cola)/255);
addpixel(nx, ny-1, colr, colg, colb, (96*cola)/255);
AddPixel({ nx, ny }, RGBA<uint8_t>(colr, colg, colb, (192*cola)/255));
AddPixel({ nx+1, ny }, RGBA<uint8_t>(colr, colg, colb, (96*cola)/255));
AddPixel({ nx-1, ny }, RGBA<uint8_t>(colr, colg, colb, (96*cola)/255));
AddPixel({ nx, ny+1 }, RGBA<uint8_t>(colr, colg, colb, (96*cola)/255));
AddPixel({ nx, ny-1 }, RGBA<uint8_t>(colr, colg, colb, (96*cola)/255));
for (x = 1; x < 6; x++) {
addpixel(nx, ny-x, colr, colg, colb, cola1);
addpixel(nx, ny+x, colr, colg, colb, cola1);
addpixel(nx-x, ny, colr, colg, colb, cola1);
addpixel(nx+x, ny, colr, colg, colb, cola1);
AddPixel({ nx, ny-x }, RGBA<uint8_t>(colr, colg, colb, cola1));
AddPixel({ nx, ny+x }, RGBA<uint8_t>(colr, colg, colb, cola1));
AddPixel({ nx-x, ny }, RGBA<uint8_t>(colr, colg, colb, cola1));
AddPixel({ nx+x, ny }, RGBA<uint8_t>(colr, colg, colb, cola1));
for (y = 1; y < 6; y++) {
if(x + y > 7)
continue;
addpixel(nx+x, ny-y, colr, colg, colb, cola1);
addpixel(nx-x, ny+y, colr, colg, colb, cola1);
addpixel(nx+x, ny+y, colr, colg, colb, cola1);
addpixel(nx-x, ny-y, colr, colg, colb, cola1);
AddPixel({ nx+x, ny-y }, RGBA<uint8_t>(colr, colg, colb, cola1));
AddPixel({ nx-x, ny+y }, RGBA<uint8_t>(colr, colg, colb, cola1));
AddPixel({ nx+x, ny+y }, RGBA<uint8_t>(colr, colg, colb, cola1));
AddPixel({ nx-x, ny-y }, RGBA<uint8_t>(colr, colg, colb, cola1));
}
}
}
@ -595,11 +595,10 @@ void Renderer::render_parts()
flicker = float(rng()%20);
gradv = 4*sim->parts[i].life + flicker;
for (x = 0; gradv>0.5; x++) {
addpixel(nx+x, ny, colr, colg, colb, int(gradv));
addpixel(nx-x, ny, colr, colg, colb, int(gradv));
addpixel(nx, ny+x, colr, colg, colb, int(gradv));
addpixel(nx, ny-x, 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, ny+x }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
AddPixel({ nx, ny-x }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
gradv = gradv/1.5f;
}
}
@ -618,10 +617,10 @@ void Renderer::render_parts()
blendpixel(nx+1, ny+1, colr, colg, colb, int(gradv));
blendpixel(nx-1, ny+1, colr, colg, colb, int(gradv));
for (x = 1; gradv>0.5; x++) {
addpixel(nx+x, ny, colr, colg, colb, int(gradv));
addpixel(nx-x, ny, colr, colg, colb, int(gradv));
addpixel(nx, ny+x, colr, colg, colb, int(gradv));
addpixel(nx, ny-x, 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, ny+x }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
AddPixel({ nx, ny-x }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
gradv = gradv/1.2f;
}
}
@ -640,10 +639,10 @@ void Renderer::render_parts()
blendpixel(nx+1, ny+1, colr, colg, colb, int(gradv));
blendpixel(nx-1, ny+1, colr, colg, colb, int(gradv));
for (x = 1; gradv>0.5; x++) {
addpixel(nx+x, ny, colr, colg, colb, int(gradv));
addpixel(nx-x, ny, colr, colg, colb, int(gradv));
addpixel(nx, ny+x, colr, colg, colb, int(gradv));
addpixel(nx, ny-x, 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, ny+x }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
AddPixel({ nx, ny-x }, RGBA<uint8_t>(colr, colg, colb, int(gradv)));
gradv = gradv/1.01f;
}
}
@ -661,7 +660,7 @@ void Renderer::render_parts()
nxo = (int)(ddist*cos(drad));
nyo = (int)(ddist*sin(drad));
if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES && TYP(sim->pmap[ny+nyo][nx+nxo]) != PT_PRTI)
addpixel(nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]);
AddPixel({ nx+nxo, ny+nyo }, RGBA<uint8_t>(colr, colg, colb, 255-orbd[r]));
}
}
if (pixel_mode & EFFECT_GRAVOUT)
@ -678,7 +677,7 @@ void Renderer::render_parts()
nxo = (int)(ddist*cos(drad));
nyo = (int)(ddist*sin(drad));
if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES && TYP(sim->pmap[ny+nyo][nx+nxo]) != PT_PRTO)
addpixel(nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]);
AddPixel({ nx+nxo, ny+nyo }, RGBA<uint8_t>(colr, colg, colb, 255-orbd[r]));
}
}
if (pixel_mode & EFFECT_DBGLINES && !(display_mode&DISPLAY_PERS))
@ -697,7 +696,7 @@ void Renderer::render_parts()
{
othertmp = (int)((parts[z].temp-73.15f)/100+1);
if (tmp == othertmp)
xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f));
XorLine({ nx, ny }, Vec2{ int(parts[z].x+0.5f), int(parts[z].y+0.5f) });
}
}
}
@ -809,7 +808,7 @@ void Renderer::draw_grav()
{
nx -= sim->gravx[ca]*0.5f;
ny -= sim->gravy[ca]*0.5f;
addpixel((int)(nx+0.5f), (int)(ny+0.5f), 255, 255, 255, (int)(dist*20.0f));
AddPixel({ int(nx+0.5f), int(ny+0.5f) }, RGBA<uint8_t>(255, 255, 255, (int)(dist*20.0f)));
}
}
}
@ -981,7 +980,7 @@ void Renderer::DrawWalls()
if (!xVel && !yVel)
{
BlendText({ x*CELL, y*CELL-2 }, 0xE00D, RGBA<uint8_t>(255, 255, 255, 128));
addpixel(oldX, oldY, 255, 255, 255, 255);
AddPixel({ oldX, oldY }, RGBA<uint8_t>(255, 255, 255, 255));
continue;
}
bool changed = false;
@ -997,7 +996,7 @@ void Renderer::DrawWalls()
}
if (changed && (newX<0 || newX>=XRES || newY<0 || newY>=YRES))
break;
addpixel(newX, newY, 255, 255, 255, 64);
AddPixel({ newX, newY }, RGBA<uint8_t>(255, 255, 255, 64));
// cache velocity and other checks so we aren't running them constantly
if (changed)
{
@ -1165,7 +1164,7 @@ void Renderer::render_fire()
a = fire_alpha[y+CELL][x+CELL];
if (findingElement)
a /= 2;
addpixel(i*CELL+x, j*CELL+y, r, g, b, a);
AddPixel({ i*CELL+x, j*CELL+y }, RGBA<uint8_t>(r, g, b, a));
}
r *= 8;
g *= 8;

View File

@ -69,7 +69,8 @@ void Renderer::RenderZoom()
{
int x, y, i, j;
pixel pix;
clearrect(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR+1, zoomScopeSize*ZFACTOR+1);
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(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR+1, zoomScopeSize*ZFACTOR+1, 0, 0, 0, 255);
for (j=0; j<zoomScopeSize; j++)
@ -84,13 +85,13 @@ void Renderer::RenderZoom()
{
for (j=-1; j<=zoomScopeSize; j++)
{
xor_pixel(zoomScopePosition.X+j, zoomScopePosition.Y-1);
xor_pixel(zoomScopePosition.X+j, zoomScopePosition.Y+zoomScopeSize);
XorPixel(zoomScopePosition + Vec2{ j, -1 });
XorPixel(zoomScopePosition + Vec2{ j, zoomScopeSize });
}
for (j=0; j<zoomScopeSize; j++)
{
xor_pixel(zoomScopePosition.X-1, zoomScopePosition.Y+j);
xor_pixel(zoomScopePosition.X+zoomScopeSize, zoomScopePosition.Y+j);
XorPixel(zoomScopePosition + Vec2{ -1, j });
XorPixel(zoomScopePosition + Vec2{ zoomScopeSize, j });
}
}
}

View File

@ -255,15 +255,13 @@ void ColourPickerActivity::OnKeyPress(int key, int scan, bool repeat, bool shift
void ColourPickerActivity::OnDraw()
{
Graphics * g = GetGraphics();
//g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
g->fillrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3, 0, 0, 0, currentAlpha);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);
g->drawrect(Position.X+4, Position.Y+4, 258, 130, 180, 180, 180, 255);
int offsetX = Position.X+5;
int offsetY = Position.Y+5;
auto offset = Position + Vec2{ 5, 5 };
//draw color square
@ -272,7 +270,7 @@ void ColourPickerActivity::OnDraw()
{
for(int hue = 0; hue <= 359; hue++)
{
currx = clamp_flt(float(hue), 0, 359)+offsetX;
currx = clamp_flt(float(hue), 0, 359)+offset.X;
if (currx == lastx)
continue;
lastx = currx;
@ -280,7 +278,7 @@ void ColourPickerActivity::OnDraw()
int cg = 0;
int cb = 0;
HSV_to_RGB(hue, 255-saturation, currentValue, &cr, &cg, &cb);
g->blendpixel(currx, (saturation/2)+offsetY, cr, cg, cb, currentAlpha);
g->blendpixel(currx, (saturation/2)+offset.Y, cr, cg, cb, currentAlpha);
}
}
@ -294,8 +292,8 @@ void ColourPickerActivity::OnDraw()
for (int ry = 0; ry < (hSlider->Size.Y / 2) - 1; ry++)
{
g->blendpixel(
rx + offsetX + hSlider->Position.X,
ry + offsetY + hSlider->Position.Y,
rx + offset.X + hSlider->Position.X,
ry + offset.Y + hSlider->Position.Y,
red, green, blue, currentAlpha
);
}
@ -304,9 +302,9 @@ void ColourPickerActivity::OnDraw()
//draw color square pointer
int currentHueX = clamp_flt(float(currentHue), 0, 359);
int currentSaturationY = ((255-currentSaturation)/2);
g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY-1);
g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY+1, offsetX+currentHueX, offsetY+currentSaturationY+5);
g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX-1, offsetY+currentSaturationY);
g->xor_line(offsetX+currentHueX+1, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY);
g->XorLine(offset + Vec2{ currentHueX, currentSaturationY-5 }, offset + Vec2{ currentHueX, currentSaturationY-1 });
g->XorLine(offset + Vec2{ currentHueX, currentSaturationY+1 }, offset + Vec2{ currentHueX, currentSaturationY+5 });
g->XorLine(offset + Vec2{ currentHueX-5, currentSaturationY }, offset + Vec2{ currentHueX-1, currentSaturationY });
g->XorLine(offset + Vec2{ currentHueX+1, currentSaturationY }, offset + Vec2{ currentHueX+5, currentSaturationY });
}

View File

@ -82,6 +82,6 @@ void ConfirmPrompt::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -58,6 +58,6 @@ void ErrorMessage::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -74,6 +74,6 @@ void InformationMessage::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -52,7 +52,7 @@ void SaveIDMessage::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -93,6 +93,6 @@ void TextPrompt::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -212,7 +212,7 @@ void ElementSearchActivity::SetActiveTool(int selectionState, Tool * tool)
void ElementSearchActivity::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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(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);

View File

@ -303,7 +303,7 @@ void FileBrowserActivity::OnDraw()
Graphics * g = GetGraphics();
//Window Background+Outline
g->clearrect(Position.X-2, Position.Y-2, Size.X+4, Size.Y+4);
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);
}

View File

@ -100,31 +100,35 @@ void Brush::RenderRect(Renderer * ren, ui::Point position1, ui::Point position2)
width *= -1;
}
ren->xor_line(position1.X, position1.Y, position1.X+width, position1.Y);
if (height>0){
ren->xor_line(position1.X, position1.Y+height, position1.X+width, position1.Y+height);
if (height>1){
ren->xor_line(position1.X+width, position1.Y+1, position1.X+width, position1.Y+height-1);
if (width>0)
ren->xor_line(position1.X, position1.Y+1, position1.X, position1.Y+height-1);
ren->XorLine(position1, position1 + Vec2{ width, 0 });
if (height > 0)
{
ren->XorLine(position1 + Vec2{ 0, height }, position1 + Vec2{ width, height });
if (height > 1)
{
ren->XorLine(position1 + Vec2{ width, 1 }, position1 + Vec2{ width, height - 1 });
if (width > 0)
{
ren->XorLine(position1 + Vec2{ 0, 1 }, position1 + Vec2{ 0, height - 1 });
}
}
}
}
void Brush::RenderLine(Renderer * ren, ui::Point position1, ui::Point position2) const
{
ren->xor_line(position1.X, position1.Y, position2.X, position2.Y);
ren->XorLine(position1, position2);
}
void Brush::RenderPoint(Renderer * ren, ui::Point position) const
{
ren->xor_bitmap(&outline[0], position.X - radius.X, position.Y - radius.Y, 2 * radius.X + 1, 2 * radius.Y + 1);
ren->XorImage(&outline[0], RectBetween(position - radius, position + radius));
}
void Brush::RenderFill(Renderer * ren, ui::Point position) const
{
ren->xor_line(position.X-5, position.Y, position.X-1, position.Y);
ren->xor_line(position.X+5, position.Y, position.X+1, position.Y);
ren->xor_line(position.X, position.Y-5, position.X, position.Y-1);
ren->xor_line(position.X, position.Y+5, position.X, position.Y+1);
ren->XorLine(position - Vec2{ 5, 0 }, position - Vec2{ 1, 0 });
ren->XorLine(position + Vec2{ 5, 0 }, position + Vec2{ 1, 0 });
ren->XorLine(position - Vec2{ 0, 5 }, position - Vec2{ 0, 1 });
ren->XorLine(position + Vec2{ 0, 5 }, position + Vec2{ 0, 1 });
}

View File

@ -185,7 +185,7 @@ void GOLWindow::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
int width = Size.X - 60;

View File

@ -2108,11 +2108,12 @@ void GameView::OnDraw()
if (wallBrush)
{
ui::Point finalBrushRadius = c->NormaliseBlockCoord(activeBrush->GetRadius());
ren->xor_line(finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y-finalBrushRadius.Y, finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y-finalBrushRadius.Y);
ren->xor_line(finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-1, finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-1);
ren->xor_line(finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y-finalBrushRadius.Y+1, finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-2);
ren->xor_line(finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y-finalBrushRadius.Y+1, finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-2);
auto topLeft = finalCurrentMouse - finalBrushRadius;
auto bottomRight = finalCurrentMouse + finalBrushRadius + Vec2{ CELL - 1, CELL - 1 };
ren->XorLine({ topLeft.X, topLeft.Y }, { bottomRight.X, topLeft.Y });
ren->XorLine({ topLeft.X, bottomRight.Y }, { bottomRight.X, bottomRight.Y });
ren->XorLine({ topLeft.X, topLeft.Y + 1 }, { topLeft.X, bottomRight.Y - 1 }); // offset by 1 so the corners don't get xor'd twice
ren->XorLine({ bottomRight.X, topLeft.Y + 1 }, { bottomRight.X, bottomRight.Y - 1 }); // offset by 1 so the corners don't get xor'd twice
}
else
{
@ -2158,7 +2159,7 @@ void GameView::OnDraw()
ren->fillrect(0, y1, x1, (y2-y1)+1, 0, 0, 0, 100);
ren->fillrect(x2+1, y1, XRES-x2-1, (y2-y1)+1, 0, 0, 0, 100);
ren->xor_rect(x1, y1, (x2-x1)+1, (y2-y1)+1);
ren->XorDottedRect(RectBetween(Vec2{ x1, y1 }, Vec2{ x2, y2 }));
}
}
}

View File

@ -238,7 +238,7 @@ void PropertyWindow::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -168,7 +168,7 @@ void SignWindow::DoDraw()
Graphics * g = GetGraphics();
String text = currentSign.getDisplayText(sim, x, y, w, h);
g->clearrect(x, y, w+1, h);
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->BlendText({ x+3, y+4 }, text, RGBA<uint8_t>(255, 255, 255, 255));
@ -222,7 +222,7 @@ void SignWindow::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -115,8 +115,8 @@ void DirectionSelector::Draw(const ui::Point& screenPos)
auto handleTrackRadius = radius + handleRadius;
ui::Point center = screenPos + Vec2{ handleTrackRadius, handleTrackRadius };
g->fillcircle(center.X, center.Y, handleTrackRadius, handleTrackRadius, backgroundColor.Red, backgroundColor.Green, backgroundColor.Blue, backgroundColor.Alpha);
g->drawcircle(center.X, center.Y, handleTrackRadius, handleTrackRadius, borderColor.Red, borderColor.Green, borderColor.Blue, borderColor.Alpha);
g->BlendFilledEllipse(center, { handleTrackRadius, handleTrackRadius }, backgroundColor);
g->BlendEllipse(center, { handleTrackRadius, handleTrackRadius }, borderColor);
for (auto &point : snapPoints)
{
@ -128,8 +128,8 @@ void DirectionSelector::Draw(const ui::Point& screenPos)
);
}
g->fillcircle(center.X + value.offset.X, center.Y + value.offset.Y, handleRadius, handleRadius, foregroundColor.Red, foregroundColor.Green, foregroundColor.Blue, (mouseHover || mouseDown) ? std::min((int)(foregroundColor.Alpha * 1.5f), 255) : foregroundColor.Alpha);
g->drawcircle(center.X + value.offset.X, center.Y + value.offset.Y, handleRadius, handleRadius, borderColor.Red, borderColor.Green, borderColor.Blue, borderColor.Alpha);
g->BlendFilledEllipse(center + value.offset, { handleRadius, handleRadius }, RGBA<uint8_t>(foregroundColor.Red, foregroundColor.Green, foregroundColor.Blue, (mouseHover || mouseDown) ? std::min(int(foregroundColor.Alpha * 1.5f), 255) : foregroundColor.Alpha));
g->BlendEllipse(center + value.offset, { handleRadius, handleRadius }, borderColor);
}
void DirectionSelector::OnMouseMoved(int x, int y, int dx, int dy)

View File

@ -15,7 +15,7 @@ class DropDownWindow : public ui::Window
public:
DropDownWindow(DropDown * dropDown):
Window(dropDown->GetScreenPos() + ui::Point(-1, -1 - dropDown->optionIndex * 16), ui::Point(dropDown->Size.X+2, 1+dropDown->options.size()*16)),
Window(dropDown->GetScreenPos() + ui::Point(-1, -1 - dropDown->optionIndex * 16), ui::Point(dropDown->Size.X+2, 2+dropDown->options.size()*16)),
dropDown(dropDown),
appearance(dropDown->Appearance)
{
@ -39,7 +39,7 @@ public:
void OnDraw() override
{
Graphics * g = GetGraphics();
g->clearrect(Position.X, Position.Y, Size.X, Size.Y);
g->DrawFilledRect(RectSized(Position, Size), 0x000000_rgb);
}
void setOption(String option)
{

View File

@ -259,14 +259,14 @@ void SaveButton::Draw(const Point& screenPos)
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)
g->xor_rect(screenPos.X+(Size.X-thumbSize.X)/2, screenPos.Y+(Size.Y-21-thumbSize.Y)/2, thumbSize.X, thumbSize.Y);
g->XorDottedRect(RectSized(screenPos + (Size - thumbSize - Vec2{ 0, 21 }) / 2, thumbSize));
g->BlendText(screenPos + Vec2{ (Size.X-(Graphics::TextSize(name).X - 1))/2, Size.Y - 21 }, name, isMouseInside ? RGBA<uint8_t>(255, 255, 255, 255) : RGBA<uint8_t>(180, 180, 180, 255));
}
if(isMouseInside && selectable)
{
g->clearrect(screenPos.X+(Size.X-20), screenPos.Y+6, 14, 14);
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);
if(selected)
g->fillrect(screenPos.X+(Size.X-18), screenPos.Y+8, 10, 10, 255, 255, 255, 255);

View File

@ -124,7 +124,7 @@ void LoginView::OnTick(float dt)
void LoginView::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -158,7 +158,7 @@ OptionsView::OptionsView():
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}
@ -540,7 +540,7 @@ void OptionsView::AttachController(OptionsController * c_)
void OptionsView::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -282,7 +282,7 @@ void PreviewView::OnDraw()
Graphics * g = GetGraphics();
//Window Background+Outline
g->clearrect(Position.X-2, Position.Y-2, Size.X+4, Size.Y+4);
g->DrawFilledRect(RectSized(Position - Vec2{ 1, 1 }, Size + Vec2{ 2, 2 }), 0x000000_rgb);
//Save preview (top-left)
if (savePreview)

View File

@ -232,7 +232,7 @@ void ProfileActivity::OnTick(float dt)
void ProfileActivity::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -155,7 +155,7 @@ void RenderView::NotifyColourChanged(RenderModel * sender)
void RenderView::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(-1, -1, WINDOWW+1, WINDOWH+1);
g->DrawFilledRect(RectSized({ 0, 0 }, WINDOW), 0x000000_rgb);
if(ren)
{
ren->clearScreen();

View File

@ -52,7 +52,7 @@ TagsView::TagsView():
void TagsView::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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);
}

View File

@ -3908,7 +3908,7 @@ int LuaScriptInterface::graphics_drawCircle(lua_State * l)
if (a<0) a = 0;
else if (a>255) a = 255;
luacon_g->drawcircle(x, y, abs(rx), abs(ry), r, g, b, a);
luacon_g->BlendEllipse({ x, y }, { abs(rx), abs(ry) }, RGBA<uint8_t>(r, g, b, a));
return 0;
}
@ -3932,7 +3932,7 @@ int LuaScriptInterface::graphics_fillCircle(lua_State * l)
if (a<0) a = 0;
else if (a>255) a = 255;
luacon_g->fillcircle(x, y, abs(rx), abs(ry), r, g, b, a);
luacon_g->BlendFilledEllipse({ x, y }, { abs(rx), abs(ry) }, RGBA<uint8_t>(r, g, b, a));
return 0;
}

View File

@ -80,7 +80,7 @@ LuaWindow::LuaWindow(lua_State * l) :
void OnDraw() override
{
Graphics * g = ui::Engine::Ref().g;
g->clearrect(Position.X-2, Position.Y-2, Size.X+4, Size.Y+4);
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);
luaWindow->triggerOnDraw();
}

View File

@ -86,7 +86,7 @@ void TaskWindow::OnTick(float dt)
void TaskWindow::OnDraw()
{
Graphics * g = GetGraphics();
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
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->draw_line(Position.X, Position.Y + Size.Y-17, Position.X + Size.X - 1, Position.Y + Size.Y-17, 255, 255, 255, 255);