Вопрос

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