question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to load image file from disk to WSprite?

See original GitHub issue

Obviously its no problem if its images already in my assets folder, or some item in the game that already has an Identifier that I’m trying to use with new WSprite(new Identifier("some identifier")), but I cant figure out how to (if its even possible) make an arbitrary path to an image C:\Users\user\AppData\Roaming\.minecraft\... .png usable as a WSprite.

Is there a way to convert some path of an image into an ‘Identifier’, or am I just to use the in-game item Identifiers or preloaded images etc in my assets? If its just the assets folder stuff, is it a thing to load external images into a mods assets folder or something?

new to this stuff btw

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
LemmaEOFcommented, Sep 7, 2020

Any texture used in LibGui, or any other GUI system, needs to be inside of a loaded resource pack. This can be the vanilla resource pack, a mod resource pack, or a player-added resource pack. For security reasons, it can’t just find any random file on your computer.

0reactions
LemmaEOFcommented, Sep 9, 2020

@Username404-59 It’d still not be doable. The resource pack system is very strict. There are a few hacky things you could do but LibGui WSprites aren’t built for them. You’d need to likely make your own widget.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generating sprites dynamically from PNG or JPEG files in C# ...
// This script loads a PNG or JPEG image from disk and returns it as a Sprite. // Drop it on any GameObject/Camera...
Read more >
Load Image at Runtime in Unity - Gyanendu Shekhar's Blog
Load method to load image from resources folder. First, copy your image in the Resources folder. You can find the image used in...
Read more >
How to load external images as sprites? - Game Dev Help
Yes, I'm using C2 and working on a server. My pictures are located relatively to the project folder. My point is about an...
Read more >
c# - Import Sprite from a file on the Computer and reference it ...
There's 3 parts needed here: Loading a file from disk; Loading the data read from the disk into a Texture2D; Creating a Sprite...
Read more >
Displaying a sprite (SFML / Learn / 1.6 Tutorials)
Usually, sprites are loaded from files on hard drive. To load an image from a file with SFML you have to use the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found