Commit aa6cd81c authored by kenan's avatar kenan

notouchHeight

parent 26016d46
......@@ -29,6 +29,16 @@ public class GameConfig implements Parcelable {
private boolean enableSoundEffect;
private int notouchHeight;
public int getNotouchHeight() {
return notouchHeight;
}
public void setNotouchHeight(int notouchHeight) {
this.notouchHeight = notouchHeight;
}
public NativeInitOptions getNativeInitOptions() {
return nativeInitOptions;
}
......@@ -103,6 +113,7 @@ public class GameConfig implements Parcelable {
return Objects.hash(nativeInitOptions, lockScreenOrientation, sensorRefresh, keepScale, immerSiveMode, enableSoundEffect);
}
@Override
public int describeContents() {
return 0;
......@@ -116,6 +127,7 @@ public class GameConfig implements Parcelable {
dest.writeByte(this.keepScale ? (byte) 1 : (byte) 0);
dest.writeByte(this.immerSiveMode ? (byte) 1 : (byte) 0);
dest.writeByte(this.enableSoundEffect ? (byte) 1 : (byte) 0);
dest.writeInt(this.notouchHeight);
}
protected GameConfig(Parcel in) {
......@@ -125,6 +137,7 @@ public class GameConfig implements Parcelable {
this.keepScale = in.readByte() != 0;
this.immerSiveMode = in.readByte() != 0;
this.enableSoundEffect = in.readByte() != 0;
this.notouchHeight = in.readInt();
}
public static final Creator<GameConfig> CREATOR = new Creator<GameConfig>() {
......@@ -138,4 +151,17 @@ public class GameConfig implements Parcelable {
return new GameConfig[size];
}
};
@Override
public String toString() {
return "GameConfig{" +
"nativeInitOptions=" + nativeInitOptions +
", lockScreenOrientation=" + lockScreenOrientation +
", sensorRefresh=" + sensorRefresh +
", keepScale=" + keepScale +
", immerSiveMode=" + immerSiveMode +
", enableSoundEffect=" + enableSoundEffect +
", notouchHeight=" + notouchHeight +
'}';
}
}
......@@ -70,6 +70,7 @@ public class App extends GameApplication {
public static GameConfig genConfig() {
GameConfig config = new GameConfig();
config.setNotouchHeight(AppsSettings.get().getNotchHeight());
config.setNativeInitOptions(AppsSettings.get().getNativeInitOptions());
config.setLockScreenOrientation(AppsSettings.get().isLockScreenOrientation());
config.setSensorRefresh(AppsSettings.get().isSensorRefresh());
......
......@@ -141,6 +141,9 @@ class LocalGameHost extends GameHost {
}
maxW = Math.max(w1, h1);
maxH = Math.min(w1, h1);
if(immerSiveMode){
maxH -= config.getNotouchHeight();
}
Log.i("kk", "real=" + fullW + "x" + fullH + ",cur=" + actW + "x" + actH + ",use=" + maxW + "x" + maxH);
float sx, sy, scale;
int gw, gh;
......@@ -221,7 +224,8 @@ class LocalGameHost extends GameHost {
((TextView) dlg.findViewById(R.id.tv_rom_ver)).setText(RomIdentifier.getRomInfo(activity).getVersion());
((TextView) dlg.findViewById(R.id.tv_cut_screen)).setText(ScreenUtil.hasNotchInformation(activity) ? "Yes" : "No");
((TextView) dlg.findViewById(R.id.tv_nav_bar)).setText(ScreenUtil.isNavigationBarShown(activity) ? "Yes" : "No");
((TextView) dlg.findViewById(R.id.tv_screen_size)).setText(String.format("real:%dx%d, cur=%dx%d, game=%dx%d", size.getFullW(), size.getFullH(), size.getActW(), size.getActH(), size.getWidth(), size.getHeight()));
((TextView) dlg.findViewById(R.id.tv_screen_size)).setText(String.format("real:%dx%d, cur=%dx%d, game=%dx%d, notouch=%d",
size.getFullW(), size.getFullH(), size.getActW(), size.getActH(), size.getWidth(), size.getHeight(), config.getNotouchHeight()));
dlg.findViewById(R.id.btn_ok).setOnClickListener((v) -> {
dlg.dismiss();
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment