mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-12 00:52:40 +01:00
DroidFish: Align the chess board to the top of its drawing area in landscape mode. Makes it aligned with the new non-full-width title bar.
This commit is contained in:
@@ -28,6 +28,7 @@ import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -71,7 +72,9 @@ public class ChessBoardPlay extends ChessBoard {
|
||||
@Override
|
||||
protected void computeOrigin(int width, int height) {
|
||||
x0 = (width - sqSize * 8) / 2;
|
||||
y0 = (height - sqSize * 8) / 2;
|
||||
Configuration config = getResources().getConfiguration();
|
||||
boolean landScape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||
y0 = landScape ? 0 : (height - sqSize * 8) / 2;
|
||||
}
|
||||
@Override
|
||||
protected int getXFromSq(int sq) { return Position.getX(sq); }
|
||||
|
||||
Reference in New Issue
Block a user