문제

Just using the coord system my rectangle for my touch bounding box never seems to align with the coordinated and placement of my textures.

What is the simplest way to draw bounding box rectangles so that I can line them up with my drawn textures?

Im using OPEN-GLES

EG..

playBounds = new Rectangle( 240, 400, 157, 177);
batcher.drawSprite(240, 400, 157, 177, Assets.mainMenu);
도움이 되었습니까?

해결책

I found out that because the bounding rectangles are based on the lower left corner and texture coords are based on the center, the below seems to be the best solution.

playBounds = new Rectangle(240, 400, 157, 177);
batcher.drawSprite(
    playBounds.lowerLeft.x + playBounds.width / 2,
    playBounds.lowerLeft.y + playBounds.height / 2, 
    playBounds.width, 
    playBounds.height, 
    Assets.mainMenu
);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top