Missing methods in Picture class?

This may be by design but I was wondering why there are no getX() getY() getWidth() and getHeight() methods in the Picture class



Both are alreaedy there, you can get all size info from the texture object,
and the position from its translation.

I am simply wondering why there is no helper methods to expose Picture.getLocalScale().x as Picture.getWidth(), Picture.getLocalScale().y as Picture.getHeight(), Picture.getPosition() as new Vector2f(Picture.getLocalTranslation().x, Picture.getLocalTranslation.y). It just seems strange to have setters for x y width and height without a way to get that value. I know on position creating a new Vector2f is not an efficient way of doing this and storing a local Vector2f would be a waste of memory so maybe just having a getX and getY would work. I should also mention that this is not really that big of a deal.

also thanks @Empire_Phoenix I never thought of using Texture.getImage().getWidth() this would make using Pictures for UI easier I have been setting the width and height of my pictures manually.

Well for me they sound usefull and sensible, especially considering the setter.

You could try to make a pull request on github and add them :slight_smile:

Your right but I am probably not going to because I am lazy :stuck_out_tongue:

Well, that certainly could be done, but it would kind of obscure the truth and add unnecessary code duplication, I think. At the end, you can always subclass Picture and add the methods…

You do realize that the setWidth and setHeight methods actually obscure the truth. So are you saying these methods should be removed? Technically a picture is Geometry with a Quad Mesh so you can call Picture.setLocalScale.

Like I said before this is not a real issue in my opinion.

It may not be an big issue, but its not the first time some one ask this in the forum, there is one question about this at least one time per month, my opinion it should be fixed, I dont know if it was fixed on the v3.1 thought.

In my opinion, the Picture class is nearly useless. It takes the place of like three lines of code and manages to obscure everything useful in the process. The alternative is to add the 50-60 methods necessary to set all of the stuff you can think of setting about a Picture, I guess.

I think everything even remotely useful about Picture could be done with a factory method and then you will already know you are dealing with a regular Quad Geometry and Unshaded.j3md material and just go from there.

Well look at the bright side if someone has questions about Picture or its methods there is enough :poop: in this topic that they wont post a question about it.

So the final verdict is:
NO the methods are not missing
If you want them add them your self or create a factory

also @pspeed I solemnly swear to only use quads from this day forward an remove any Picture objects from my projects…LOL no but really I am going to do this it actually sounds like it will make my code more consistent.

1 Like