Skip to content

Commit

Permalink
log error
Browse files Browse the repository at this point in the history
  • Loading branch information
sharrlotte committed Nov 13, 2024
1 parent 2f89048 commit 00a90fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
13 changes: 5 additions & 8 deletions src/mindytool/gui/MapImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,25 @@ public MapImage(MapData mapData) {

@Override
public void draw() {
try {

super.draw();
super.draw();

try {
// textures are only requested when the rendering happens; this assists with
// culling
if (!textureCache.containsKey(mapData.id)) {
textureCache.put(mapData.id, lastTexture = Core.atlas.find("nomap"));
Http.get(Config.IMAGE_URL + "maps/" + mapData.id + ".webp?format=jpeg", res -> {
Pixmap pix = new Pixmap(res.getResult());
Core.app.post(() -> {
Pixmap pix = new Pixmap(res.getResult());
try {
var tex = new Texture(pix);
tex.setFilter(TextureFilter.linear);
textureCache.put(mapData.id, new TextureRegion(tex));
} catch (Exception e) {
Log.err(e);
}
pix.dispose();
});
pix.dispose();
}, err -> {
Log.err(err);
});
}

Expand All @@ -65,7 +62,7 @@ public void draw() {
setDrawable(next);
}
} catch (Exception e) {
e.printStackTrace();
Log.err(e);
}
}
}
15 changes: 5 additions & 10 deletions src/mindytool/gui/SchematicImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,25 @@ public SchematicImage(SchematicData schematicData) {

@Override
public void draw() {
try {

super.draw();
super.draw();

try {
// textures are only requested when the rendering happens; this assists with
// culling
if (!textureCache.containsKey(schematicData.id)) {
textureCache.put(schematicData.id, lastTexture = Core.atlas.find("nomap"));
Http.get(Config.IMAGE_URL + "schematics/" + schematicData.id + ".webp?format=jpeg", res -> {
Pixmap pix = new Pixmap(res.getResult());

Core.app.post(() -> {
Pixmap pix = new Pixmap(res.getResult());
try {
var tex = new Texture(pix);
tex.setFilter(TextureFilter.linear);
textureCache.put(schematicData.id, new TextureRegion(tex));
} catch (Exception e) {
Log.err(e);
}
pix.dispose();
});

pix.dispose();
}, err -> {
Log.err(err);
});
}

Expand All @@ -67,7 +62,7 @@ public void draw() {
setDrawable(next);
}
} catch (Exception e) {
e.printStackTrace();
Log.err(e);
}
}
}

0 comments on commit 00a90fc

Please sign in to comment.