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
2fe782e3
Commit
2fe782e3
authored
Oct 04, 2019
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
居中显示
parent
48c0bbf6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
10 deletions
+52
-10
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+10
-10
libcore/build.gradle
libcore/build.gradle
+1
-0
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
...re/src/main/java/cn/garymb/ygomobile/GameApplication.java
+1
-0
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+39
-0
libygo/build.gradle
libygo/build.gradle
+1
-0
No files found.
Classes/gframe/game.cpp
View file @
2fe782e3
...
...
@@ -35,10 +35,10 @@ bool Game::Initialize() {
#endif
srand
(
time
(
0
));
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
();
int
screenH
=
android
::
getScreenHeight
(
app
);
int
screenW
=
android
::
getScreenWidth
(
app
);
float
sH
=
s
creenH
/
1024.0
;
float
sW
=
s
creenW
/
640.0
;
int
screenH
=
static_cast
<
int
>
(
android
::
getScreenHeight
(
app
)
);
int
screenW
=
static_cast
<
int
>
(
android
::
getScreenWidth
(
app
)
);
float
sH
=
s
tatic_cast
<
float
>
(
screenH
/
1024.0
)
;
float
sW
=
s
tatic_cast
<
float
>
(
screenW
/
640.0
)
;
//取最小值
if
(
sH
<
sW
){
...
...
@@ -61,13 +61,13 @@ bool Game::Initialize() {
params
.
Bits
=
24
;
params
.
ZBufferBits
=
16
;
params
.
AntiAlias
=
0
;
int
w
=
(
int
)(
1024.0
*
xScale
);
int
h
=
(
int
)(
640.0
*
yScale
);
params
.
WindowSize
=
irr
::
core
::
dimension2d
<
u32
>
(
w
,
h
);
//
int w = (int)(1024.0*xScale);
//
int h = (int)(640.0*yScale);
params
.
WindowSize
=
irr
::
core
::
dimension2d
<
u32
>
(
0
,
0
);
//每一个元素得left和top都需要改
xStart
=
(
float
)((
screenH
-
w
)
/
2.0
);
yStart
=
(
float
)((
screenW
-
h
)
/
2.0
);
params
.
WindowPosition
=
core
::
position2di
((
s32
)
xStart
,
(
s32
)
yStart
);
//
xStart = (float)((screenH - w)/2.0);
//
yStart = (float)((screenW - h)/2.0);
//
params.WindowPosition = core::position2di((s32)xStart, (s32)yStart);
#else
if
(
gameConf
.
use_d3d
)
params
.
DriverType
=
irr
::
video
::
EDT_DIRECT3D9
;
...
...
libcore/build.gradle
View file @
2fe782e3
...
...
@@ -27,4 +27,5 @@ android {
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
// implementation "me.weishu:free_reflection:2.1.0"
}
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
View file @
2fe782e3
...
...
@@ -26,6 +26,7 @@ public abstract class GameApplication extends Application implements IrrlichtBri
public
void
onCreate
()
{
super
.
onCreate
();
sGameApplication
=
this
;
// Reflection.unseal(this);
// initSoundEffectPool();
}
...
...
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
2fe782e3
...
...
@@ -20,6 +20,7 @@ import android.view.Gravity;
import
android.view.HapticFeedbackConstants
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.widget.FrameLayout
;
import
android.widget.PopupWindow
;
import
android.widget.TextView
;
import
android.widget.Toast
;
...
...
@@ -211,9 +212,47 @@ public class YGOMobileActivity extends NativeActivity implements
if
(
app
().
isImmerSiveMode
())
{
mFullScreenUtils
.
fullscreen
();
app
().
attachGame
(
this
);
//游戏大小
int
[]
size
=
getGameSize
();
getWindow
().
setLayout
(
size
[
0
],
size
[
1
]);
}
}
private
int
[]
getGameSize
(){
//调整padding
float
screenW
=
app
().
getScreenWidth
();
float
screenH
=
app
().
getScreenHeight
();
float
sH
=
screenH
/
1024.0f
;
float
sW
=
screenW
/
640.0f
;
float
xScale
,
yScale
;
//取最小值
if
(
sH
<
sW
){
xScale
=
sH
;
yScale
=
sH
;
}
else
{
xScale
=
sW
;
yScale
=
sW
;
}
int
w
=
(
int
)(
1024.0
*
xScale
);
int
h
=
(
int
)(
640.0
*
yScale
);
return
new
int
[]{
w
,
h
};
}
@Override
public
void
setContentView
(
View
view
)
{
int
[]
size
=
getGameSize
();
int
w
=
size
[
0
];
int
h
=
size
[
1
];
FrameLayout
.
LayoutParams
lp
=
new
FrameLayout
.
LayoutParams
(
w
,
h
);
FrameLayout
layout
=
new
FrameLayout
(
this
);
lp
.
gravity
=
Gravity
.
CENTER
;
layout
.
addView
(
view
,
lp
);
getWindow
().
setLayout
(
w
,
h
);
getWindow
().
setGravity
(
Gravity
.
CENTER
);
super
.
setContentView
(
layout
);
}
private
void
initExtraView
()
{
mContentView
=
getWindow
().
getDecorView
().
findViewById
(
android
.
R
.
id
.
content
);
mGlobalComboBox
=
new
ComboBoxCompat
(
this
);
...
...
libygo/build.gradle
View file @
2fe782e3
...
...
@@ -31,4 +31,5 @@ android {
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
// implementation "me.weishu:free_reflection:2.1.0"
}
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