Commit b334e11d authored by kenan's avatar kenan

尺寸

parent 34d96ae1
......@@ -12,6 +12,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
......@@ -236,9 +237,14 @@ public class YGOMobileActivity extends NativeActivity implements
//调整padding
float xScale = app().getXScale();
float yScale = app().getYScale();
float sw = app().getScreenWidth();
float sh = app().getScreenHeight();
int w = (int) (app().getGameWidth() * xScale);
int h = (int) (app().getGameHeight() * yScale);
Log.i("kk", "w1=" + app().getGameWidth() + ",h1=" + app().getGameHeight() + ",w2=" + w + ",h2=" + h + ",xScale=" + xScale + ",yScale=" + yScale);
Log.i(IrrlichtBridge.TAG, "game size=" + app().getGameWidth() + "x" + app().getGameHeight()
+ ", surface=" + w + "x" + h
+ ", screen=" + sw + "x" + sh
+ ", xScale=" + xScale + ",yScale=" + yScale);
return new int[]{w, h};
}
......@@ -264,6 +270,7 @@ public class YGOMobileActivity extends NativeActivity implements
int h = size[1];
mLayout = new FrameLayout(this);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(w, h);
mLayout.setBackgroundColor(Color.BLACK);
lp.gravity = Gravity.CENTER;
if (USE_SURFACE) {
mLayout.addView(mSurfaceView, lp);
......@@ -514,6 +521,8 @@ public class YGOMobileActivity extends NativeActivity implements
if (!replaced) {
return;
}
// int[] size = getGameSize();
// holder.setFixedSize(size[0], size[1]);
}
super.surfaceCreated(holder);
}
......
......@@ -64,6 +64,16 @@ public class App extends GameApplication {
public float getYScale() {
return AppsSettings.get().getYScale(getGameWidth(), getGameHeight());
}
//
// @Override
// public int getGameHeight() {
// return 720;
// }
//
// @Override
// public int getGameWidth() {
// return 1280;
// }
@Override
public String getCardImagePath() {
......
......@@ -172,7 +172,6 @@ public class AppsSettings {
int ret = Math.min(w, h);
//测试代码,曲面屏左右2变需要留空白,但是游戏画面比例不对,需要修改c那边代码
int fix_h = mSharedPreferences.getInt(PREF_WINDOW_TOP_BOTTOM, DEF_PREF_WINDOW_TOP_BOTTOM);
Log.i(IrrlichtBridge.TAG, "get width=" + ret + "->" + (ret - fix_h * 2));
return ret - fix_h * 2;
}
......
......@@ -119,7 +119,7 @@ public interface Constants {
//dp单位,游戏高度减少,留空白
String PREF_WINDOW_TOP_BOTTOM = "pref_settings_window_top_bottom";
int DEF_PREF_WINDOW_TOP_BOTTOM = 50;
int DEF_PREF_WINDOW_TOP_BOTTOM = 0;
int REQUEST_CUT_IMG = 0x1000 + 0x10;
int REQUEST_CHOOSE_FILE = 0x1000 + 0x20;
......
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