diff --git a/src/gui/interface/ScrollPanel.cpp b/src/gui/interface/ScrollPanel.cpp index 884c872f8..ed628b971 100644 --- a/src/gui/interface/ScrollPanel.cpp +++ b/src/gui/interface/ScrollPanel.cpp @@ -187,10 +187,10 @@ void ScrollPanel::XTick() } } - if (xScrollVel > 7.0f) xScrollVel = 7.0f; - if (xScrollVel < -7.0f) xScrollVel = -7.0f; - if (xScrollVel > -0.5f && xScrollVel < 0.5) - xScrollVel = 0; + if (xScrollVel.GetValue() > 7.0f) xScrollVel.SetValue(7.0f); + if (xScrollVel.GetValue() < -7.0f) xScrollVel.SetValue(-7.0f); + if (xScrollVel.GetValue() > -0.5f && xScrollVel.GetValue() < 0.5f) + xScrollVel.SetValue(0); maxOffset = InnerSize-Size; maxOffset.Y = std::max(0, maxOffset.Y); @@ -210,8 +210,8 @@ void ScrollPanel::XTick() if (!ui::Engine::Ref().MomentumScroll) { - yScrollVel = 0.0f; - xScrollVel = 0.0f; + yScrollVel.SetValue(0.0f); + xScrollVel.SetValue(0.0f); } diff --git a/src/gui/login/LoginView.cpp b/src/gui/login/LoginView.cpp index 4c9338ac8..29bafffa0 100644 --- a/src/gui/login/LoginView.cpp +++ b/src/gui/login/LoginView.cpp @@ -23,8 +23,8 @@ LoginView::LoginView(): usernameField(new ui::Textbox(ui::Point(8, 25), ui::Point(200-16, 17), Client::Ref().GetAuthUser().Username.FromUtf8(), "[username]")), passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), "", "[password]")) { - targetSize.SetTarget(Size.Y); - targetSize.SetValue(Size.Y); + targetSize.SetTarget(float(Size.Y)); + targetSize.SetValue(float(Size.Y)); FocusComponent(usernameField); infoLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; @@ -100,11 +100,11 @@ void LoginView::NotifyStatusChanged(LoginModel * sender) passwordField->Enabled = notWorking; if (infoLabel->Visible) { - targetSize.SetTarget(defaultSize.Y + infoLabel->Size.Y); + targetSize.SetTarget(float(defaultSize.Y + infoLabel->Size.Y)); } else { - targetSize.SetTarget(defaultSize.Y); + targetSize.SetTarget(float(defaultSize.Y)); } if (sender->GetStatus() == loginSucceeded) { @@ -115,7 +115,7 @@ void LoginView::NotifyStatusChanged(LoginModel * sender) void LoginView::OnTick() { c->Tick(); - Size.Y = targetSize.GetValue(); + Size.Y = int(targetSize.GetValue()); loginButton->Position.Y = Size.Y-17; cancelButton->Position.Y = Size.Y-17; } diff --git a/src/gui/preview/PreviewView.cpp b/src/gui/preview/PreviewView.cpp index c0ccea7c5..3f7f25403 100644 --- a/src/gui/preview/PreviewView.cpp +++ b/src/gui/preview/PreviewView.cpp @@ -636,14 +636,14 @@ void PreviewView::NotifyCommentBoxEnabledChanged(PreviewModel * sender) if(sender->GetCommentBoxEnabled()) { addCommentBox = new ui::Textbox(ui::Point((XRES/2)+4, Size.Y-19), ui::Point(Size.X-(XRES/2)-48, 17), "", "Add Comment"); - commentBoxPositionX.SetTarget(addCommentBox->Position.X); - commentBoxPositionX.SetValue(addCommentBox->Position.X); - commentBoxPositionY.SetTarget(addCommentBox->Position.Y); - commentBoxPositionY.SetValue(addCommentBox->Position.Y); - commentBoxSizeX.SetTarget(addCommentBox->Size.X); - commentBoxSizeX.SetValue(addCommentBox->Size.X); - commentBoxSizeY.SetTarget(addCommentBox->Size.Y); - commentBoxSizeY.SetValue(addCommentBox->Size.Y); + commentBoxPositionX.SetTarget(float(addCommentBox->Position.X)); + commentBoxPositionX.SetValue(float(addCommentBox->Position.X)); + commentBoxPositionY.SetTarget(float(addCommentBox->Position.Y)); + commentBoxPositionY.SetValue(float(addCommentBox->Position.Y)); + commentBoxSizeX.SetTarget(float(addCommentBox->Size.X)); + commentBoxSizeX.SetValue(float(addCommentBox->Size.X)); + commentBoxSizeY.SetTarget(float(addCommentBox->Size.Y)); + commentBoxSizeY.SetValue(float(addCommentBox->Size.Y)); addCommentBox->SetActionCallback({ [this] { CheckComment(); commentBoxAutoHeight(); diff --git a/src/lua/LuaHttp.cpp b/src/lua/LuaHttp.cpp index fa6c56ca1..b774e33c5 100644 --- a/src/lua/LuaHttp.cpp +++ b/src/lua/LuaHttp.cpp @@ -134,12 +134,15 @@ public: seenRunningThisTick = false; } - void Progress(int64_t *total, int64_t *done) + std::pair Progress() { + int64_t total = 0; + int64_t done = 0; if (!dead) { - std::tie(*total, *done) = request->CheckProgress(); + std::tie(total, done) = request->CheckProgress(); } + return { total, done }; } void Cancel() @@ -220,8 +223,7 @@ static int HTTPRequest_progress(lua_State *L) auto *rh = (LuaHttp::RequestHandle *)luaL_checkudata(L, 1, "HTTPRequest"); if (rh->GetStatus() != LuaHttp::RequestHandle::Status::dead) { - int64_t total, done; - rh->Progress(&total, &done); + auto [ total, done ] = rh->Progress(); lua_pushinteger(L, total); lua_pushinteger(L, done); return 2; diff --git a/src/lua/LuaSimulation.cpp b/src/lua/LuaSimulation.cpp index 6293a4002..6eb22bb05 100644 --- a/src/lua/LuaSimulation.cpp +++ b/src/lua/LuaSimulation.cpp @@ -511,7 +511,7 @@ static int createParts(lua_State *L) { int c = luaL_checkint(L, 5); // note: weird: has to be specified in a sim context but not in a ui context auto center = Vec2(x, y); - RasterizeEllipseRows(Vec2(rx * rx, ry * ry), [lsi, c, center](int xLim, int dy) { + RasterizeEllipseRows(Vec2(float(rx * rx), float(ry * ry)), [lsi, c, center](int xLim, int dy) { for (auto pos : RectBetween(center + Vec2(-xLim, dy), center + Vec2(xLim, dy))) { lsi->sim->CreateParts(-1, pos.X, pos.Y, 0, 0, c, 0);