I’m engaged on making a falling sand simulation utilizing libgdx. For drawing the person components I’m utilizing a ShapeRenderer and drawing rectangles.
I’ve begun to implement a dropdown menu to permit collection of components to put. The performance of the dropdown menu is working. I’m able to set the inputProcessor because the stage and upon choosing the factor kind set the inputProcessor again to CreatorInputProcessor and I’m able to efficiently place components once more. The performance is all working as anticipated.
Nonetheless, after I set the stage with the dropdown as inputProcessor, the factor rectangles turn out to be stretched. The decision and pixel width of the window stays the identical. It’s not zooming in or something. When the inputProcessor is ready again to the CreatorInputProcessor the rectangles keep stretched.
Listed below are the issues I’ve tried to repair this challenge:
- Use each type of ViewPort passing in each a brand new OrthographicCamera and in addition the identical digicam used for the sport view
- Disposing of the stage after enter processor is ready again to CreatorInputProcessor
- Setting the projection matrix on the digicam each body simply earlier than drawing or after drawing.
I discovered this stack trade query which has similarities to my challenge however the marked reply doesn’t remedy my drawback (setting the projection matrix each body): LibGDX – why are the shapes from my ShapeRenderer resizing with my viewport?
I’m searching for some recommendation on how I can resolve this challenge. Thanks!
Right here is the related code snippet: https://github.com/DavidMcLaughlin208/FallingSandJava/blob/grasp/core/src/com/gdx/mobile/InputManager.java#L357-L399