【问题标题】:Android Touch Bounding Rectangle and Texture LocationAndroid 触摸边界矩形和纹理位置
【发布时间】:2013-07-12 03:01:08
【问题描述】:

仅使用坐标系统我的rectangle 作为我的触摸边界框似乎永远不会与我的纹理的协调和位置对齐。

绘制边界框rectangles 以便我可以将它们与绘制的textures 对齐的最简单方法是什么?

我正在使用 OPEN-GLES

EG..

playBounds = new Rectangle( 240, 400, 157, 177);
batcher.drawSprite(240, 400, 157, 177, Assets.mainMenu);

【问题讨论】:

    标签: java android opengl-es bounding-box


    【解决方案1】:

    我发现因为边界矩形基于左下角,纹理坐标基于中心,所以下面似乎是最好的解决方案。

    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
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-10
      • 2014-09-22
      • 2020-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-17
      • 1970-01-01
      相关资源
      最近更新 更多