Skip to content

Commit

Permalink
Texture uploading isn't batched :/
Browse files Browse the repository at this point in the history
  • Loading branch information
buthed010203 committed Jan 30, 2024
1 parent 39de94a commit e568880
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/src/mindustry/ui/dialogs/JoinDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ public void refreshCommunity(){
t.button(Icon.zoom, Styles.emptyi, this::refreshCommunity).size(54f);
}).width((targetWidth() + 5f) * columns()).height(70f).pad(4).row();

long[] last = {0, 0}; // last time, frame
long[] lastFrame = {0};
long[] start = {0};
for(int i = 0; i < defaultServers.size; i ++){
ServerGroup group = defaultServers.get((i + defaultServers.size/2) % defaultServers.size);
boolean hidden = group.hidden();
Expand All @@ -450,12 +451,11 @@ public void refreshCommunity(){
};
net.pingHost(resaddress, resport, ref.cons = res -> {
var frame = Core.graphics.getFrameId();
if (Time.timeSinceMillis(last[0]) < 1000 && last[1] != frame) {
last[0] = Time.millis();
last[1] = frame;
Core.app.post(() -> ref.cons.get(res));
if (lastFrame[0] == frame && Time.timeSinceMillis(start[0]) > 5) { // Limit frames to 5ms (arbitrary value)
return;
}
} else start[0] = Time.millis(); // Save the time on the first call each frame
lastFrame[0] = frame;

if(refreshes != cur) return;
res.port = resport;
res.group = group.name;
Expand Down

0 comments on commit e568880

Please sign in to comment.