mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 03:09:53 +02:00
Fix various warnings that had piled up
This commit is contained in:
@@ -187,10 +187,10 @@ void ScrollPanel::XTick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xScrollVel > 7.0f) xScrollVel = 7.0f;
|
if (xScrollVel.GetValue() > 7.0f) xScrollVel.SetValue(7.0f);
|
||||||
if (xScrollVel < -7.0f) xScrollVel = -7.0f;
|
if (xScrollVel.GetValue() < -7.0f) xScrollVel.SetValue(-7.0f);
|
||||||
if (xScrollVel > -0.5f && xScrollVel < 0.5)
|
if (xScrollVel.GetValue() > -0.5f && xScrollVel.GetValue() < 0.5f)
|
||||||
xScrollVel = 0;
|
xScrollVel.SetValue(0);
|
||||||
|
|
||||||
maxOffset = InnerSize-Size;
|
maxOffset = InnerSize-Size;
|
||||||
maxOffset.Y = std::max(0, maxOffset.Y);
|
maxOffset.Y = std::max(0, maxOffset.Y);
|
||||||
@@ -210,8 +210,8 @@ void ScrollPanel::XTick()
|
|||||||
|
|
||||||
if (!ui::Engine::Ref().MomentumScroll)
|
if (!ui::Engine::Ref().MomentumScroll)
|
||||||
{
|
{
|
||||||
yScrollVel = 0.0f;
|
yScrollVel.SetValue(0.0f);
|
||||||
xScrollVel = 0.0f;
|
xScrollVel.SetValue(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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]")),
|
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]"))
|
passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), "", "[password]"))
|
||||||
{
|
{
|
||||||
targetSize.SetTarget(Size.Y);
|
targetSize.SetTarget(float(Size.Y));
|
||||||
targetSize.SetValue(Size.Y);
|
targetSize.SetValue(float(Size.Y));
|
||||||
FocusComponent(usernameField);
|
FocusComponent(usernameField);
|
||||||
|
|
||||||
infoLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
infoLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
@@ -100,11 +100,11 @@ void LoginView::NotifyStatusChanged(LoginModel * sender)
|
|||||||
passwordField->Enabled = notWorking;
|
passwordField->Enabled = notWorking;
|
||||||
if (infoLabel->Visible)
|
if (infoLabel->Visible)
|
||||||
{
|
{
|
||||||
targetSize.SetTarget(defaultSize.Y + infoLabel->Size.Y);
|
targetSize.SetTarget(float(defaultSize.Y + infoLabel->Size.Y));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
targetSize.SetTarget(defaultSize.Y);
|
targetSize.SetTarget(float(defaultSize.Y));
|
||||||
}
|
}
|
||||||
if (sender->GetStatus() == loginSucceeded)
|
if (sender->GetStatus() == loginSucceeded)
|
||||||
{
|
{
|
||||||
@@ -115,7 +115,7 @@ void LoginView::NotifyStatusChanged(LoginModel * sender)
|
|||||||
void LoginView::OnTick()
|
void LoginView::OnTick()
|
||||||
{
|
{
|
||||||
c->Tick();
|
c->Tick();
|
||||||
Size.Y = targetSize.GetValue();
|
Size.Y = int(targetSize.GetValue());
|
||||||
loginButton->Position.Y = Size.Y-17;
|
loginButton->Position.Y = Size.Y-17;
|
||||||
cancelButton->Position.Y = Size.Y-17;
|
cancelButton->Position.Y = Size.Y-17;
|
||||||
}
|
}
|
||||||
|
@@ -636,14 +636,14 @@ void PreviewView::NotifyCommentBoxEnabledChanged(PreviewModel * sender)
|
|||||||
if(sender->GetCommentBoxEnabled())
|
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");
|
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.SetTarget(float(addCommentBox->Position.X));
|
||||||
commentBoxPositionX.SetValue(addCommentBox->Position.X);
|
commentBoxPositionX.SetValue(float(addCommentBox->Position.X));
|
||||||
commentBoxPositionY.SetTarget(addCommentBox->Position.Y);
|
commentBoxPositionY.SetTarget(float(addCommentBox->Position.Y));
|
||||||
commentBoxPositionY.SetValue(addCommentBox->Position.Y);
|
commentBoxPositionY.SetValue(float(addCommentBox->Position.Y));
|
||||||
commentBoxSizeX.SetTarget(addCommentBox->Size.X);
|
commentBoxSizeX.SetTarget(float(addCommentBox->Size.X));
|
||||||
commentBoxSizeX.SetValue(addCommentBox->Size.X);
|
commentBoxSizeX.SetValue(float(addCommentBox->Size.X));
|
||||||
commentBoxSizeY.SetTarget(addCommentBox->Size.Y);
|
commentBoxSizeY.SetTarget(float(addCommentBox->Size.Y));
|
||||||
commentBoxSizeY.SetValue(addCommentBox->Size.Y);
|
commentBoxSizeY.SetValue(float(addCommentBox->Size.Y));
|
||||||
addCommentBox->SetActionCallback({ [this] {
|
addCommentBox->SetActionCallback({ [this] {
|
||||||
CheckComment();
|
CheckComment();
|
||||||
commentBoxAutoHeight();
|
commentBoxAutoHeight();
|
||||||
|
@@ -134,12 +134,15 @@ public:
|
|||||||
seenRunningThisTick = false;
|
seenRunningThisTick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Progress(int64_t *total, int64_t *done)
|
std::pair<int64_t, int64_t> Progress()
|
||||||
{
|
{
|
||||||
|
int64_t total = 0;
|
||||||
|
int64_t done = 0;
|
||||||
if (!dead)
|
if (!dead)
|
||||||
{
|
{
|
||||||
std::tie(*total, *done) = request->CheckProgress();
|
std::tie(total, done) = request->CheckProgress();
|
||||||
}
|
}
|
||||||
|
return { total, done };
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cancel()
|
void Cancel()
|
||||||
@@ -220,8 +223,7 @@ static int HTTPRequest_progress(lua_State *L)
|
|||||||
auto *rh = (LuaHttp::RequestHandle *)luaL_checkudata(L, 1, "HTTPRequest");
|
auto *rh = (LuaHttp::RequestHandle *)luaL_checkudata(L, 1, "HTTPRequest");
|
||||||
if (rh->GetStatus() != LuaHttp::RequestHandle::Status::dead)
|
if (rh->GetStatus() != LuaHttp::RequestHandle::Status::dead)
|
||||||
{
|
{
|
||||||
int64_t total, done;
|
auto [ total, done ] = rh->Progress();
|
||||||
rh->Progress(&total, &done);
|
|
||||||
lua_pushinteger(L, total);
|
lua_pushinteger(L, total);
|
||||||
lua_pushinteger(L, done);
|
lua_pushinteger(L, done);
|
||||||
return 2;
|
return 2;
|
||||||
|
@@ -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
|
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);
|
auto center = Vec2(x, y);
|
||||||
RasterizeEllipseRows(Vec2<float>(rx * rx, ry * ry), [lsi, c, center](int xLim, int dy) {
|
RasterizeEllipseRows(Vec2<float>(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)))
|
for (auto pos : RectBetween(center + Vec2(-xLim, dy), center + Vec2(xLim, dy)))
|
||||||
{
|
{
|
||||||
lsi->sim->CreateParts(-1, pos.X, pos.Y, 0, 0, c, 0);
|
lsi->sim->CreateParts(-1, pos.X, pos.Y, 0, 0, c, 0);
|
||||||
|
Reference in New Issue
Block a user