java - libgdx Cutting an image -
i have been trying "cut" image time now, ll explain why , tried. wanted create hp "bar" except it's not bar heart , though easy had have 2 pictures draw them on top of each other , cutting 1 create appear in hp beingness lost, not able find way cutting image.
setting height resizes image might have guessed i tried using textureregion kind of hack didn't go well i found method called clip begin uses scissors reason doesn't seem working.i might using clip begin wrong can't find real documentation on it, i'm doing is:
image.clipbegin(x,y,height,weight); image.clipend();
i forgot, i'm using scene2d image, might improve way go around not sure be.
i appreciate ideas on how this, give thanks you.
you want utilize opengl scissor back upwards libgdx exposes. see libgdx clipping wiki , libgdx scissorstack
documentation.
the api isn't particularly friendly (its designed back upwards dynamically pushing multiple constraining rectangles, far i've seen, isn't used often).
the of import point remember scissor stack applies actual draw commands issued. since apis seek batch draw commands, means actual drawing might not happen when looks should happen. ensure clipping happening must flush buffered draws before pushing scissor (otherwise wrong thing might clipped) , must flush draw calls before popping scissor (otherwise things want clipped might avoid scissors).
see libgdx scissorstack not working expected or libgdx - how clip or how draw on portion of screen spritebatch in libgdx? or making grouping hide actors outside of bounds.
java image libgdx crop clipping
No comments:
Post a Comment