Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile-Cn-Ko-En
Commits
480d4237
Commit
480d4237
authored
Oct 03, 2019
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
宽高
parent
728505f0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
8 deletions
+32
-8
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+16
-5
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+16
-3
No files found.
Classes/gframe/game.cpp
View file @
480d4237
...
...
@@ -37,8 +37,17 @@ bool Game::Initialize() {
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
();
int
screenH
=
android
::
getScreenHeight
(
app
);
int
screenW
=
android
::
getScreenWidth
(
app
);
xScale
=
screenH
/
1024.0
;
yScale
=
screenW
/
640.0
;
float
sH
=
screenH
/
1024.0
;
float
sW
=
screenW
/
640.0
;
//取最小值
if
(
sH
<
sW
){
xScale
=
sH
;
yScale
=
sH
;
}
else
{
xScale
=
sW
;
yScale
=
sW
;
}
#ifdef _IRR_ANDROID_PLATFORM_
android
::
InitOptions
*
options
=
android
::
getInitOptions
(
app
);
...
...
@@ -52,9 +61,11 @@ bool Game::Initialize() {
params
.
Bits
=
24
;
params
.
ZBufferBits
=
16
;
params
.
AntiAlias
=
0
;
params
.
WindowSize
=
irr
::
core
::
dimension2d
<
u32
>
(
0
,
0
);
params
.
WindowLeft
=
(
screenH
-
1024.0
*
xScale
)
/
2.0
;
params
.
WindowTop
=
(
screenW
-
640.0
*
yScale
)
/
2.0
;
int
w
=
1024.0
*
xScale
;
int
h
=
640.0
*
yScale
;
params
.
WindowSize
=
irr
::
core
::
dimension2d
<
u32
>
(
w
,
h
);
params
.
WindowLeft
=
(
screenH
-
w
)
/
2.0
;
params
.
WindowTop
=
(
screenW
-
h
)
/
2.0
;
#else
if
(
gameConf
.
use_d3d
)
params
.
DriverType
=
irr
::
video
::
EDT_DIRECT3D9
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
480d4237
...
...
@@ -3,10 +3,12 @@ package cn.garymb.ygomobile;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.graphics.Point
;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.view.WindowManager
;
import
com.zlm.libs.preferences.PreferencesProviderUtils
;
...
...
@@ -78,10 +80,21 @@ public class AppsSettings {
return
new
File
(
getResourcePath
(),
CORE_SYSTEM_PATH
);
}
private
static
float
getScale
(
float
srcWidth
,
float
srcHeight
,
float
destWidth
,
float
destHeight
)
{
float
sx
=
srcWidth
/
destWidth
;
float
sy
=
srcHeight
==
0
?
(
sx
+
1.0f
)
:
(
srcHeight
/
destHeight
);
return
Math
.
min
(
sx
,
sy
);
}
public
void
update
(
Context
context
)
{
WindowManager
wm
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
Point
size
=
new
Point
();
//真实宽高
wm
.
getDefaultDisplay
().
getRealSize
(
size
);
mDensity
=
context
.
getResources
().
getDisplayMetrics
().
density
;
mScreenHeight
=
context
.
getResources
().
getDisplayMetrics
().
heightPixels
;
mScreenWidth
=
context
.
getResources
().
getDisplayMetrics
().
widthPixels
;
mScreenHeight
=
size
.
y
;
mScreenWidth
=
size
.
x
;
if
(
isImmerSiveMode
()
&&
context
instanceof
Activity
)
{
DisplayMetrics
dm
=
SystemUtils
.
getHasVirtualDisplayMetrics
((
Activity
)
context
);
...
...
@@ -458,7 +471,7 @@ public class AppsSettings {
public
String
getResourcePath
()
{
String
defPath
;
try
{
defPath
=
new
File
(
Environmen
t
.
getExternalStorageDirectory
(),
Constants
.
PREF_DEF_GAME_DIR
).
getAbsolutePath
();
defPath
=
new
File
(
contex
t
.
getExternalStorageDirectory
(),
Constants
.
PREF_DEF_GAME_DIR
).
getAbsolutePath
();
}
catch
(
Exception
e
)
{
defPath
=
new
File
(
context
.
getFilesDir
(),
Constants
.
PREF_DEF_GAME_DIR
).
getAbsolutePath
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment