Page 1 of 1

Token image display questions.

Posted: Thu May 10, 2012 9:20 pm
by Jeriah
I've been using MapTool for awhile. I'm taking some coding classes at uni, and we're doing java at the moment. So, I've started going through the MT source code, and I can't for the life of me figure out how MT handles images and displaying them. I get the MD5 references, but the actual image handlers seem to escape me. If someone could point me in the right direction, I'm really interested in learning more that I can use in the future when I get some more experience.

If this is the wrong forum, I apologize.

Re: Token image display questions.

Posted: Fri May 11, 2012 12:59 am
by Azhrei
If you have specific questions, I'll try to answer them.

In general, look for class whose names start with Image and/or Asset. For example, AssetManager keeps track of which assets are loaded and which need to be read from the assetcache. You can most easily see this by looking in the rplib project (a separate project from MapTool) and looking for the code that loads tokens or other images from external files, such as loadToken().

The ImageManager is more low-level and tends to handle image conversion to formats that are faster or easier for the JVM to work with, such as converting JPEGs into BufferedImage objects.

I think I've got those two right. I didn't write the code, I inherited it ;), so I could have them backwards.

Re: Token image display questions.

Posted: Fri May 11, 2012 3:22 am
by Jeriah
Thanks! The rplib part was what I was trying to find. I don't fully understand everything it's doing, but that at least puts me where I can start learning this stuff better.