Create a texture or pixmap from a spritebatch!!

Anything libgdx related goes here!

Re: Create a texture or pixmap from a spritebatch!!

Postby shatterblast » Fri Jan 17, 2020 9:21 pm

I'm a little confused. Are you saying you're drawing your Tiled maps in really small sizes 9 times in the top right or something for the purpose of a mini-map? Are you asking how to re-create your level as one larger Texture object?

There are size limits to these things, so you will probably have to negotiate this somehow. However, it is possible to render just your Tiled maps stuff only through a SpriteBatch in one cycle of the render() method, and send the output of that SpriteBatch into a Texture object. What you do with that Texture object is up to you, though. You could store it as a picture and reference it later as a Texture for mini-map purposes later if you want.

However, Texture objects can only reach a certain size. You would likely exceed the limits of what would work. I'm not sure if you would zoom out a lot with something like a ScalingViewport to do this. Also, a Viewport will eventually reach its limit, too.

Another idea would be to use 2x2 tiles or similar to shrink your Tiled stuff way down to hopefully fit your work onto one screen enough with the ScalingViewport zoomed way out. At least, it may convey the general idea of your layout.
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm

Return to Libgdx

Who is online

Users browsing this forum: Google [Bot] and 1 guest