mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
cmd/ebitenmobile: Bug fix: Use even numbers for the position/size
Fixes #956
This commit is contained in:
parent
4bfe60fb8a
commit
1f56266027
@ -367,10 +367,15 @@ public class EbitenView extends ViewGroup {
|
||||
Ebitenmobileview.layout(widthInDp, heightInDp, new ViewRectSetter() {
|
||||
@Override
|
||||
public void setViewRect(long xInDp, long yInDp, long widthInDp, long heightInDp) {
|
||||
final int widthInPx = (int)Math.ceil(dpToPx(widthInDp));
|
||||
final int heightInPx = (int)Math.ceil(dpToPx(heightInDp));
|
||||
final int xInPx = (int)Math.ceil(dpToPx(xInDp));
|
||||
final int yInPx = (int)Math.ceil(dpToPx(yInDp));
|
||||
int width = (int)Math.ceil(dpToPx(widthInDp));
|
||||
int height = (int)Math.ceil(dpToPx(heightInDp));
|
||||
int x = (int)Math.ceil(dpToPx(xInDp));
|
||||
int y = (int)Math.ceil(dpToPx(yInDp));
|
||||
// Use even numbers to avoid glitches (#956).
|
||||
final int xInPx = x / 2 * 2;
|
||||
final int yInPx = y / 2 * 2;
|
||||
final int widthInPx = width / 2 * 2;
|
||||
final int heightInPx = height / 2 * 2;
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user