Fix some deprecation warnings

Namely:

 - [[deprecated("Use operator+(Vec2)")]]
 - [[deprecated("Use operator-(Vec2)")]]
 - [[deprecated("Use video")]]
 - [[deprecated("Use persistentVideo")]]
 - [[deprecated("Use wrapVideo")]]
This commit is contained in:
Tamás Bálint Misius 2023-04-29 14:44:27 +02:00
parent 8f10210c77
commit 2960e0f58f
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
14 changed files with 55 additions and 80 deletions

View File

@ -43,13 +43,6 @@ struct Vec2
return Vec2<decltype(std::declval<T>() + std::declval<S>())>(X + other.X, Y + other.Y); return Vec2<decltype(std::declval<T>() + std::declval<S>())>(X + other.X, Y + other.Y);
} }
template<typename S>
[[deprecated("Use operator+(Vec2)")]]
constexpr Vec2<decltype(std::declval<T>() + std::declval<S>())> operator+(S other) const
{
return Vec2<decltype(std::declval<T>() + std::declval<S>())>(X + other, Y + other);
}
constexpr Vec2<T> operator-() const constexpr Vec2<T> operator-() const
{ {
return Vec2<T>(-X, -Y); return Vec2<T>(-X, -Y);
@ -61,13 +54,6 @@ struct Vec2
return Vec2<decltype(std::declval<T>() - std::declval<S>())>(X - other.X, Y - other.Y); return Vec2<decltype(std::declval<T>() - std::declval<S>())>(X - other.X, Y - other.Y);
} }
template<typename S>
[[deprecated("Use operator-(Vec2)")]]
constexpr Vec2<decltype(std::declval<T>() - std::declval<S>())> operator-(S other) const
{
return Vec2<decltype(std::declval<T>() - std::declval<S>())>(X - other, Y - other);
}
template<typename S, typename = std::enable_if_t<std::is_arithmetic_v<S>>> template<typename S, typename = std::enable_if_t<std::is_arithmetic_v<S>>>
constexpr Vec2<decltype(std::declval<T>() * std::declval<S>())> operator*(S other) const constexpr Vec2<decltype(std::declval<T>() * std::declval<S>())> operator*(S other) const
{ {

View File

@ -527,7 +527,7 @@ void Renderer::render_parts()
} }
if(pixel_mode & PMODE_FLAT) if(pixel_mode & PMODE_FLAT)
{ {
vid[ny*(VIDXRES)+nx] = RGB<uint8_t>(colr, colg, colb).Pack(); video[{ nx, ny }] = RGB<uint8_t>(colr, colg, colb).Pack();
} }
if(pixel_mode & PMODE_BLEND) if(pixel_mode & PMODE_BLEND)
{ {
@ -539,7 +539,7 @@ void Renderer::render_parts()
} }
if(pixel_mode & PMODE_BLOB) if(pixel_mode & PMODE_BLOB)
{ {
vid[ny*(VIDXRES)+nx] = 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, colr, colg, colb, 223);
blendpixel(nx-1, ny, colr, colg, colb, 223); blendpixel(nx-1, ny, colr, colg, colb, 223);
@ -890,7 +890,7 @@ void Renderer::draw_air()
} }
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++)
vid[(x*CELL+i) + (y*CELL+j)*(VIDXRES)] = c.Pack(); video[{ x * CELL + i, y * CELL + j }] = c.Pack();
} }
} }
@ -931,14 +931,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)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = pc; video[{ x * CELL + i, y * CELL + j }] = pc;
} }
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))
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = pc; video[{ x * CELL + i, y * CELL + j }] = pc;
} }
} }
else if (wt == WL_WALLELEC) else if (wt == WL_WALLELEC)
@ -947,9 +947,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))
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = pc; video[{ x * CELL + i, y * CELL + j }] = pc;
else else
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = 0x808080_rgb .Pack(); video[{ x * CELL + i, y * CELL + j }] = 0x808080_rgb .Pack();
} }
} }
else if (wt == WL_EHOLE) else if (wt == WL_EHOLE)
@ -958,16 +958,16 @@ 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++)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = 0x242424_rgb .Pack(); video[{ x * CELL + i, y * CELL + j }] = 0x242424_rgb .Pack();
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)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = 0x000000_rgb .Pack(); video[{ x * CELL + i, y * CELL + j }] = 0x000000_rgb .Pack();
} }
else else
{ {
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)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = 0x242424_rgb .Pack(); video[{ x * CELL + i, y * CELL + j }] = 0x242424_rgb .Pack();
} }
} }
else if (wt == WL_STREAM) else if (wt == WL_STREAM)
@ -1017,27 +1017,27 @@ void Renderer::DrawWalls()
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)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = pc; video[{ x * CELL + i, y * CELL + j }] = pc;
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)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = pc; video[{ x * CELL + i, y * CELL + j }] = pc;
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++)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = pc; video[{ x * CELL + i, y * CELL + j }] = pc;
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)
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = pc; video[{ x * CELL + i, y * CELL + j }] = pc;
else if (i == j+1 || (i == 0 && j == CELL-1)) else if (i == j+1 || (i == 0 && j == CELL-1))
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = gc; video[{ x * CELL + i, y * CELL + j }] = gc;
else else
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = 0x202020_rgb .Pack(); video[{ x * CELL + i, y * CELL + j }] = 0x202020_rgb .Pack();
break; break;
} }
@ -1086,7 +1086,7 @@ 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)
// looks bad if drawing black blobs // looks bad if drawing black blobs
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = 0x000000_rgb .Pack(); video[{ x * CELL + i, y * CELL + j }] = 0x000000_rgb .Pack();
} }
else else
{ {
@ -1117,10 +1117,10 @@ void Renderer::DrawWalls()
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.Red, prgb.Green, prgb.Blue);
else if (i == j+1 || (i == 0 && j == CELL-1)) else if (i == j+1 || (i == 0 && j == CELL-1))
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = gc; video[{ x * CELL + i, y * CELL + j }] = gc;
else else
// looks bad if drawing black blobs // looks bad if drawing black blobs
vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = 0x202020_rgb .Pack(); video[{ x * CELL + i, y * CELL + j }] = 0x202020_rgb .Pack();
break; break;
} }
} }

View File

@ -37,9 +37,10 @@ int HeatToColour(float temp);
class Renderer: public RasterDrawMethods<Renderer> class Renderer: public RasterDrawMethods<Renderer>
{ {
PlaneAdapter<std::array<pixel, WINDOW.X * RES.Y>, WINDOW.X, RES.Y> video; using Video = PlaneAdapter<std::array<pixel, WINDOW.X * RES.Y>, WINDOW.X, RES.Y>;
Video video;
std::array<pixel, WINDOW.X * RES.Y> persistentVideo; std::array<pixel, WINDOW.X * RES.Y> persistentVideo;
PlaneAdapter<std::array<pixel, WINDOW.X * RES.Y>, WINDOW.X, RES.Y> warpVideo; Video warpVideo;
Rect<int> getClipRect() const Rect<int> getClipRect() const
{ {
@ -103,7 +104,7 @@ public:
void DrawBlob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); void DrawBlob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb);
void DrawWalls(); void DrawWalls();
void DrawSigns(); void DrawSigns();
void render_gravlensing(pixel * source); void render_gravlensing(const Video &source);
void render_fire(); void render_fire();
void prepare_alpha(int size, float intensity); void prepare_alpha(int size, float intensity);
void render_parts(); void render_parts();
@ -115,14 +116,7 @@ public:
void ClearAccumulation(); void ClearAccumulation();
void clearScreen(); void clearScreen();
void SetSample(int x, int y); void SetSample(Vec2<int> pos);
[[deprecated("Use video")]]
pixel *const vid = video.Base.data();
[[deprecated("Use persistentVideo")]]
pixel *const persistentVid = persistentVideo.data();
[[deprecated("Use wrapVideo")]]
pixel *const warpVid = warpVideo.data();
void draw_icon(int x, int y, Icon icon); void draw_icon(int x, int y, Icon icon);
@ -130,7 +124,7 @@ public:
void drawblob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); void drawblob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb);
pixel GetPixel(int x, int y); pixel GetPixel(Vec2<int> pos) const;
//... //...
//Display mode modifiers //Display mode modifiers
void CompileDisplayMode(); void CompileDisplayMode();

View File

@ -18,10 +18,9 @@ void Renderer::RenderBegin()
if(display_mode & DISPLAY_PERS) if(display_mode & DISPLAY_PERS)
{ {
for (int i = 0; i < VIDXRES*YRES; i++) std::transform(video.RowIterator({ 0, 0 }), video.RowIterator({ 0, YRES }), persistentVideo.begin(), [](pixel p) {
{ return RGB<uint8_t>::Unpack(p).Decay().Pack();
persistentVid[i] = RGB<uint8_t>::Unpack(vid[i]).Decay().Pack(); });
}
} }
render_fire(); render_fire();
@ -37,15 +36,15 @@ void Renderer::RenderEnd()
RenderZoom(); RenderZoom();
} }
void Renderer::SetSample(int x, int y) void Renderer::SetSample(Vec2<int> pos)
{ {
sampleColor = GetPixel(x, y); sampleColor = GetPixel(pos);
} }
void Renderer::clearScreen() { void Renderer::clearScreen() {
if(display_mode & DISPLAY_PERS) if(display_mode & DISPLAY_PERS)
{ {
std::copy(persistentVid, persistentVid+(VIDXRES*YRES), vid); std::copy(persistentVideo.begin(), persistentVideo.end(), video.RowIterator({ 0, 0 }));
} }
else else
{ {
@ -59,7 +58,7 @@ void Renderer::FinaliseParts()
{ {
warpVideo = video; warpVideo = video;
std::fill_n(video.data(), VIDXRES * YRES, 0); std::fill_n(video.data(), VIDXRES * YRES, 0);
render_gravlensing(warpVid); render_gravlensing(warpVideo);
} }
} }
@ -70,17 +69,16 @@ void Renderer::RenderZoom()
{ {
int x, y, i, j; int x, y, i, j;
pixel pix; pixel pix;
pixel * img = vid;
clearrect(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR+1, zoomScopeSize*ZFACTOR+1); clearrect(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR+1, zoomScopeSize*ZFACTOR+1);
drawrect(zoomWindowPosition.X-2, zoomWindowPosition.Y-2, zoomScopeSize*ZFACTOR+3, zoomScopeSize*ZFACTOR+3, 192, 192, 192, 255); 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); drawrect(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR+1, zoomScopeSize*ZFACTOR+1, 0, 0, 0, 255);
for (j=0; j<zoomScopeSize; j++) for (j=0; j<zoomScopeSize; j++)
for (i=0; i<zoomScopeSize; i++) for (i=0; i<zoomScopeSize; i++)
{ {
pix = img[(j+zoomScopePosition.Y)*(VIDXRES)+(i+zoomScopePosition.X)]; pix = video[{ i + zoomScopePosition.X, j + zoomScopePosition.Y }];
for (y=0; y<ZFACTOR-1; y++) for (y=0; y<ZFACTOR-1; y++)
for (x=0; x<ZFACTOR-1; x++) for (x=0; x<ZFACTOR-1; x++)
img[(j*ZFACTOR+y+zoomWindowPosition.Y)*(VIDXRES)+(i*ZFACTOR+x+zoomWindowPosition.X)] = pix; video[{ i * ZFACTOR + x + zoomWindowPosition.X, j * ZFACTOR + y + zoomWindowPosition.Y }] = pix;
} }
if (zoomEnabled) if (zoomEnabled)
{ {
@ -112,13 +110,9 @@ void Renderer::DrawBlob(int x, int y, unsigned char cr, unsigned char cg, unsign
} }
void Renderer::render_gravlensing(pixel * source) void Renderer::render_gravlensing(const Video &source)
{ {
int nx, ny, rx, ry, gx, gy, bx, by, co; int nx, ny, rx, ry, gx, gy, bx, by, co;
pixel *src = source;
pixel *dst = vid;
if (!dst)
return;
for(nx = 0; nx < XRES; nx++) for(nx = 0; nx < XRES; nx++)
{ {
for(ny = 0; ny < YRES; ny++) for(ny = 0; ny < YRES; ny++)
@ -132,11 +126,11 @@ void Renderer::render_gravlensing(pixel * source)
by = (int)(ny-sim->gravy[co]+0.5f); by = (int)(ny-sim->gravy[co]+0.5f);
if(rx >= 0 && rx < XRES && ry >= 0 && ry < YRES && gx >= 0 && gx < XRES && gy >= 0 && gy < YRES && bx >= 0 && bx < XRES && by >= 0 && by < YRES) if(rx >= 0 && rx < XRES && ry >= 0 && ry < YRES && gx >= 0 && gx < XRES && gy >= 0 && gy < YRES && bx >= 0 && bx < XRES && by >= 0 && by < YRES)
{ {
auto t = RGB<uint8_t>::Unpack(dst[ny*(VIDXRES)+nx]); auto t = RGB<uint8_t>::Unpack(video[{ nx, ny }]);
t.Red = std::min(0xFF, (int)RGB<uint8_t>::Unpack(src[ry*(VIDXRES)+rx]).Red + t.Red); t.Red = std::min(0xFF, (int)RGB<uint8_t>::Unpack(source[{ rx, ry }]).Red + t.Red);
t.Green = std::min(0xFF, (int)RGB<uint8_t>::Unpack(src[gy*(VIDXRES)+gx]).Green + t.Green); t.Green = std::min(0xFF, (int)RGB<uint8_t>::Unpack(source[{ gx, gy }]).Green + t.Green);
t.Blue = std::min(0xFF, (int)RGB<uint8_t>::Unpack(src[by*(VIDXRES)+bx]).Blue + t.Blue); t.Blue = std::min(0xFF, (int)RGB<uint8_t>::Unpack(source[{ bx, by }]).Blue + t.Blue);
dst[ny*(VIDXRES)+nx] = t.Pack(); video[{ nx, ny }] = t.Pack();
} }
} }
} }
@ -177,11 +171,11 @@ void Renderer::drawblob(int x, int y, unsigned char cr, unsigned char cg, unsign
blendpixel(x-1, y+1, cr, cg, cb, 64); blendpixel(x-1, y+1, cr, cg, cb, 64);
} }
pixel Renderer::GetPixel(int x, int y) pixel Renderer::GetPixel(Vec2<int> pos) const
{ {
if (x<0 || y<0 || x>=VIDXRES || y>=VIDYRES) if (pos.X<0 || pos.Y<0 || pos.X>=VIDXRES || pos.Y>=VIDYRES)
return 0; return 0;
return vid[(y*VIDXRES)+x]; return video[pos];
} }
std::vector<RGB<uint8_t>> Renderer::flameTable; std::vector<RGB<uint8_t>> Renderer::flameTable;
@ -369,7 +363,7 @@ void Renderer::ClearAccumulation()
std::fill(&fire_r[0][0], &fire_r[0][0] + NCELL, 0); std::fill(&fire_r[0][0], &fire_r[0][0] + NCELL, 0);
std::fill(&fire_g[0][0], &fire_g[0][0] + NCELL, 0); std::fill(&fire_g[0][0], &fire_g[0][0] + NCELL, 0);
std::fill(&fire_b[0][0], &fire_b[0][0] + NCELL, 0); std::fill(&fire_b[0][0], &fire_b[0][0] + NCELL, 0);
std::fill(persistentVid, persistentVid+(VIDXRES*YRES), 0); std::fill(persistentVideo.begin(), persistentVideo.end(), 0);
} }
void Renderer::AddRenderMode(unsigned int mode) void Renderer::AddRenderMode(unsigned int mode)

View File

@ -27,7 +27,7 @@ BitmapBrush::BitmapBrush(const BitmapBrush &other) : BitmapBrush(other.origSize,
std::unique_ptr<unsigned char []> BitmapBrush::GenerateBitmap() const std::unique_ptr<unsigned char []> BitmapBrush::GenerateBitmap() const
{ {
ui::Point size = radius * 2 + 1; ui::Point size = radius * 2 + Vec2{ 1, 1 };
auto bitmap = std::make_unique<unsigned char []>(size.X * size.Y); auto bitmap = std::make_unique<unsigned char []>(size.X * size.Y);
if (size == origSize) if (size == origSize)
std::copy(&origBitmap[0], &origBitmap[origSize.X * origSize.Y], &bitmap[0]); std::copy(&origBitmap[0], &origBitmap[origSize.X * origSize.Y], &bitmap[0]);

View File

@ -63,7 +63,7 @@ public:
ui::Point GetSize() const ui::Point GetSize() const
{ {
return radius * 2 + 1; return radius * 2 + Vec2{ 1, 1 };
} }
ui::Point GetRadius() const ui::Point GetRadius() const

View File

@ -54,7 +54,7 @@ void DecorationTool::DrawRect(Simulation * sim, Brush const &brush, ui::Point po
void DecorationTool::DrawFill(Simulation * sim, Brush const &brush, ui::Point position) void DecorationTool::DrawFill(Simulation * sim, Brush const &brush, ui::Point position)
{ {
auto loc = RGB<uint8_t>::Unpack(ren.vid[position.X+position.Y*WINDOWW]); auto loc = RGB<uint8_t>::Unpack(ren.GetPixel(position));
if (ToolID == DECO_CLEAR) if (ToolID == DECO_CLEAR)
// TODO: this is actually const-correct // TODO: this is actually const-correct
sim->ApplyDecorationFill(const_cast<Renderer *>(&ren), position.X, position.Y, 0, 0, 0, 0, loc.Red, loc.Green, loc.Blue); sim->ApplyDecorationFill(const_cast<Renderer *>(&ren), position.X, position.Y, 0, 0, 0, 0, loc.Red, loc.Green, loc.Blue);

View File

@ -15,7 +15,7 @@ public:
std::unique_ptr<unsigned char []> GenerateBitmap() const override std::unique_ptr<unsigned char []> GenerateBitmap() const override
{ {
ui::Point size = radius * 2 + 1; ui::Point size = radius * 2 + Vec2{ 1, 1 };
auto bitmap = std::make_unique<unsigned char []>(size.X * size.Y); auto bitmap = std::make_unique<unsigned char []>(size.X * size.Y);
int rx = radius.X; int rx = radius.X;

View File

@ -928,7 +928,8 @@ void GameController::SetToolStrength(float value)
void GameController::SetZoomPosition(ui::Point position) void GameController::SetZoomPosition(ui::Point position)
{ {
ui::Point zoomPosition = position-(gameModel->GetZoomSize()/2); auto zoomhalf = gameModel->GetZoomSize() / 2;
ui::Point zoomPosition = position - Vec2{ zoomhalf, zoomhalf };
if(zoomPosition.X < 0) if(zoomPosition.X < 0)
zoomPosition.X = 0; zoomPosition.X = 0;
if(zoomPosition.Y < 0) if(zoomPosition.Y < 0)

View File

@ -2058,7 +2058,7 @@ void GameView::OnDraw()
{ {
ren->clearScreen(); ren->clearScreen();
ren->RenderBegin(); ren->RenderBegin();
ren->SetSample(c->PointTranslate(currentMouse).X, c->PointTranslate(currentMouse).Y); ren->SetSample(c->PointTranslate(currentMouse));
if (showBrush && selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && (isMouseDown || (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES))) if (showBrush && selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && (isMouseDown || (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES)))
{ {
ui::Point finalCurrentMouse = windTool ? c->PointTranslateNoClamp(currentMouse) : c->PointTranslate(currentMouse); ui::Point finalCurrentMouse = windTool ? c->PointTranslateNoClamp(currentMouse) : c->PointTranslate(currentMouse);

View File

@ -9,7 +9,7 @@ public:
std::unique_ptr<unsigned char []> GenerateBitmap() const override std::unique_ptr<unsigned char []> GenerateBitmap() const override
{ {
ui::Point size = radius * 2 + 1; ui::Point size = radius * 2 + Vec2{ 1, 1 };
auto bitmap = std::make_unique<unsigned char []>(size.X * size.Y); auto bitmap = std::make_unique<unsigned char []>(size.X * size.Y);
int rx = radius.X; int rx = radius.X;

View File

@ -113,7 +113,7 @@ void DirectionSelector::Draw(const ui::Point& screenPos)
{ {
Graphics * g = GetGraphics(); Graphics * g = GetGraphics();
auto handleTrackRadius = radius + handleRadius; auto handleTrackRadius = radius + handleRadius;
ui::Point center = screenPos + handleTrackRadius; ui::Point center = screenPos + Vec2{ handleTrackRadius, handleTrackRadius };
g->fillcircle(center.X, center.Y, handleTrackRadius, handleTrackRadius, backgroundColor.Red, backgroundColor.Green, backgroundColor.Blue, backgroundColor.Alpha); 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->drawcircle(center.X, center.Y, handleTrackRadius, handleTrackRadius, borderColor.Red, borderColor.Green, borderColor.Blue, borderColor.Alpha);

View File

@ -1885,7 +1885,7 @@ int LuaScriptInterface::simulation_floodDeco(lua_State * l)
return luaL_error(l, "coordinates out of range (%d,%d)", x, y); return luaL_error(l, "coordinates out of range (%d,%d)", x, y);
// hilariously broken, intersects with console and all Lua graphics // hilariously broken, intersects with console and all Lua graphics
auto loc = RGB<uint8_t>::Unpack(luacon_ren->vid[x + y * WINDOWW]); auto loc = RGB<uint8_t>::Unpack(luacon_ren->GetPixel({ x, y }));
luacon_sim->ApplyDecorationFill(luacon_ren, x, y, r, g, b, a, loc.Red, loc.Green, loc.Blue); luacon_sim->ApplyDecorationFill(luacon_ren, x, y, r, g, b, a, loc.Red, loc.Green, loc.Blue);
return 0; return 0;
} }

View File

@ -702,7 +702,7 @@ void Simulation::ApplyDecorationBox(int x1, int y1, int x2, int y2, int colR, in
bool Simulation::ColorCompare(Renderer *ren, int x, int y, int replaceR, int replaceG, int replaceB) bool Simulation::ColorCompare(Renderer *ren, int x, int y, int replaceR, int replaceG, int replaceB)
{ {
auto pix = RGB<uint8_t>::Unpack(ren->vid[x+y*WINDOWW]); auto pix = RGB<uint8_t>::Unpack(ren->GetPixel({ x, y }));
int r = pix.Red; int r = pix.Red;
int g = pix.Green; int g = pix.Green;
int b = pix.Blue; int b = pix.Blue;