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 choice of components to position. The performance of the dropdown menu is working. I’m able to set the inputProcessor because the stage and upon deciding on the component sort set the inputProcessor again to CreatorInputProcessor and I’m able to efficiently place components once more. The performance is all working as anticipated.
Nevertheless, once I set the stage with the dropdown as inputProcessor the component rectangles develop into stretched as you may see within the video. The decision and pixel width of the window stays the identical. It isn’t zooming in or something. When the inputProcessor is ready again to the CreatorInputProcessor the rectangles keep stretched.
Listed here are the issues I’ve tried to repair this challenge:
- Use each type of ViewPort passing in each a brand new OrthographicCamera and likewise 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 change query which is analogous 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 on the lookout 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
drawing as anticipated
drawing not as anticipated