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
ca18b39d
Commit
ca18b39d
authored
Oct 04, 2019
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
game's width,height
parent
c99935ed
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
40 deletions
+39
-40
Classes/gframe/drawing.cpp
Classes/gframe/drawing.cpp
+2
-2
Classes/gframe/event_handler.cpp
Classes/gframe/event_handler.cpp
+3
-3
Classes/gframe/game.h
Classes/gframe/game.h
+8
-0
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
...re/src/main/java/cn/garymb/ygomobile/GameApplication.java
+6
-2
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+10
-4
mobile/src/main/java/cn/garymb/ygomobile/App.java
mobile/src/main/java/cn/garymb/ygomobile/App.java
+2
-12
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+8
-16
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+0
-1
No files found.
Classes/gframe/drawing.cpp
View file @
ca18b39d
...
...
@@ -199,7 +199,7 @@ void Game::DrawBackGround() {
DrawShadowText
(
numFont
,
dInfo
.
str_total_attack
[
1
],
recti
(
885
*
mainGame
->
xScale
,
271
*
mainGame
->
yScale
,
905
*
mainGame
->
xScale
,
291
*
mainGame
->
yScale
),
recti
(
0
,
1
,
2
,
0
),
dInfo
.
total_attack_color
[
1
],
0xff000000
,
true
,
false
,
0
);
}
else
{
driver
->
drawVertexPrimitiveList
(
matManager
.
vTotalAtkopT
,
4
,
matManager
.
iRectangle
,
2
);
DrawShadowText
(
numFont
,
dInfo
.
str_total_attack
[
1
],
recti
(
740
*
mainGame
->
xScale
,
295
*
mainGame
->
yScale
,
760
*
mainGame
->
xScale
,
3
3
15
*
mainGame
->
yScale
),
recti
(
0
,
1
,
2
,
0
),
dInfo
.
total_attack_color
[
1
],
0xff000000
,
true
,
false
,
0
);
DrawShadowText
(
numFont
,
dInfo
.
str_total_attack
[
1
],
recti
(
740
*
mainGame
->
xScale
,
295
*
mainGame
->
yScale
,
760
*
mainGame
->
xScale
,
315
*
mainGame
->
yScale
),
recti
(
0
,
1
,
2
,
0
),
dInfo
.
total_attack_color
[
1
],
0xff000000
,
true
,
false
,
0
);
}
}
...
...
@@ -1065,7 +1065,7 @@ void Game::DrawSpec() {
void
Game
::
DrawBackImage
(
irr
::
video
::
ITexture
*
texture
)
{
if
(
!
texture
)
return
;
driver
->
draw2DImage
(
texture
,
recti
(
0
,
0
,
1024
*
mainGame
->
xScale
,
640
*
mainGame
->
yScale
),
recti
(
0
,
0
,
texture
->
getOriginalSize
().
Width
,
texture
->
getOriginalSize
().
Height
));
driver
->
draw2DImage
(
texture
,
recti
(
0
,
0
,
GAME_WIDTH
*
mainGame
->
xScale
,
GAME_HEIGHT
*
mainGame
->
yScale
),
recti
(
0
,
0
,
texture
->
getOriginalSize
().
Width
,
texture
->
getOriginalSize
().
Height
));
}
void
Game
::
ShowElement
(
irr
::
gui
::
IGUIElement
*
win
,
int
autoframe
)
{
FadingUnit
fu
;
...
...
Classes/gframe/event_handler.cpp
View file @
ca18b39d
...
...
@@ -2010,8 +2010,8 @@ void ClientField::GetHoverField(int x, int y) {
hovered_sequence
=
hc
-
1
-
(
x
-
ofRect
.
UpperLeftCorner
.
X
)
*
(
hc
-
1
)
/
((
cardSize
+
cardSpace
)
*
5
*
mainGame
->
xScale
);
}
}
else
{
double
screenx
=
x
/
(
1024.0
*
mainGame
->
xScale
)
*
1.35
-
0.90
;
double
screeny
=
y
/
(
640.0
*
mainGame
->
yScale
)
*
0.84
-
0.42
;
double
screenx
=
x
/
(
GAME_WIDTH
*
mainGame
->
xScale
)
*
1.35
-
0.90
;
double
screeny
=
y
/
(
GAME_HEIGHT
*
mainGame
->
yScale
)
*
0.84
-
0.42
;
double
angle
=
0.798056
-
atan
(
screeny
);
//0.798056 = arctan(8.0/7.8)
double
vlen
=
sqrt
(
1.0
+
screeny
*
screeny
);
double
boardx
=
4.2
+
7.8
*
screenx
/
vlen
/
cos
(
angle
);
...
...
@@ -2308,7 +2308,7 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
x
=
w
+
10
*
mainGame
->
xScale
;
if
(
x
+
w
>
670
*
mainGame
->
xScale
)
x
=
670
*
mainGame
->
xScale
-
w
;
mainGame
->
stCardListTip
->
setRelativePosition
(
recti
(
x
-
dTip
.
Width
/
2
,
y
-
10
,
x
+
dTip
.
Width
/
2
,
y
-
10
+
dTip
.
Height
));
mainGame
->
stCardListTip
->
setRelativePosition
(
recti
(
x
-
dTip
.
Width
/
2
,
y
-
10
*
mainGame
->
yScale
,
x
+
dTip
.
Width
/
2
,
y
-
10
*
mainGame
->
yScale
+
dTip
.
Height
));
mainGame
->
stCardListTip
->
setVisible
(
true
);
}
}
...
...
Classes/gframe/game.h
View file @
ca18b39d
...
...
@@ -737,6 +737,14 @@ extern Game* mainGame;
#define CARD_ARTWORK_VERSIONS_OFFSET 10
#ifdef _IRR_ANDROID_PLATFORM_
#define GAME_WIDTH 1024
#define GAME_HEIGHT 640
#else
#define GAME_WIDTH 1280
#define GAME_HEIGHT 720
#endif
#ifdef _IRR_ANDROID_PLATFORM_
#define GUI_INFO_FPS 1000
#endif
...
...
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
View file @
ca18b39d
...
...
@@ -53,9 +53,13 @@ public abstract class GameApplication extends Application implements IrrlichtBri
isInitSoundEffectPool
=
initSoundEffectPool
;
}
public
abstract
int
getGameWidth
();
public
int
getGameWidth
(){
return
1024
;
}
public
abstract
int
getGameHeight
();
public
int
getGameHeight
(){
return
640
;
}
public
abstract
boolean
isKeepScale
();
...
...
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
ca18b39d
...
...
@@ -213,9 +213,11 @@ public class YGOMobileActivity extends NativeActivity implements
mFullScreenUtils
.
fullscreen
();
app
().
attachGame
(
this
);
//游戏大小
int
[]
size
=
getGameSize
();
getWindow
().
setLayout
(
size
[
0
],
size
[
1
]);
if
(!
app
().
isKeepScale
())
{
//游戏大小
int
[]
size
=
getGameSize
();
getWindow
().
setLayout
(
size
[
0
],
size
[
1
]);
}
}
}
...
...
@@ -225,12 +227,16 @@ public class YGOMobileActivity extends NativeActivity implements
float
yScale
=
app
().
getYScale
();
int
w
=
(
int
)
(
app
().
getGameWidth
()
*
xScale
);
int
h
=
(
int
)
(
app
().
getGameHeight
()
*
yScale
);
Log
.
i
(
"kk"
,
"w
="
+
w
+
",h
="
+
h
+
",xScale="
+
xScale
+
",yScale="
+
yScale
);
Log
.
i
(
"kk"
,
"w
1="
+
app
().
getGameWidth
()
+
",h1="
+
app
().
getGameHeight
()
+
",w2="
+
w
+
",h2
="
+
h
+
",xScale="
+
xScale
+
",yScale="
+
yScale
);
return
new
int
[]{
w
,
h
};
}
@Override
public
void
setContentView
(
View
view
)
{
if
(!
app
().
isKeepScale
())
{
super
.
setContentView
(
view
);
return
;
}
int
[]
size
=
getGameSize
();
int
w
=
size
[
0
];
int
h
=
size
[
1
];
...
...
mobile/src/main/java/cn/garymb/ygomobile/App.java
View file @
ca18b39d
...
...
@@ -53,12 +53,12 @@ public class App extends GameApplication {
@Override
public
float
getXScale
()
{
return
AppsSettings
.
get
().
getXScale
();
return
AppsSettings
.
get
().
getXScale
(
getGameWidth
(),
getGameHeight
()
);
}
@Override
public
float
getYScale
()
{
return
AppsSettings
.
get
().
getYScale
();
return
AppsSettings
.
get
().
getYScale
(
getGameWidth
(),
getGameHeight
()
);
}
@Override
...
...
@@ -76,16 +76,6 @@ public class App extends GameApplication {
return
AppsSettings
.
get
().
isKeepScale
();
}
@Override
public
int
getGameHeight
()
{
return
Constants
.
CORE_GAME_SIZE
[
1
];
}
@Override
public
int
getGameWidth
()
{
return
Constants
.
CORE_GAME_SIZE
[
0
];
}
@Override
public
void
saveSetting
(
String
key
,
String
value
)
{
AppsSettings
.
get
().
saveSettings
(
key
,
value
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
ca18b39d
...
...
@@ -185,31 +185,23 @@ public class AppsSettings {
return
false
;
//mSharedPreferences.getBoolean(PREF_DECK_MANAGER_V2, DEF_PREF_DECK_MANAGER_V2);
}
public
float
getGameHeight
()
{
return
(
float
)
Constants
.
CORE_GAME_SIZE
[
1
];
}
public
float
getGameWidth
()
{
return
(
float
)
Constants
.
CORE_GAME_SIZE
[
0
];
}
public
float
getXScale
()
{
public
float
getXScale
(
int
w
,
int
h
)
{
if
(
isKeepScale
()){
float
sx
=
getScreenHeight
()
/
getGameWidth
()
;
float
sy
=
getScreenWidth
()
/
getGameHeight
()
;
float
sx
=
getScreenHeight
()
/
w
;
float
sy
=
getScreenWidth
()
/
h
;
return
Math
.
min
(
sx
,
sy
);
}
return
getScreenHeight
()
/
getGameWidth
()
;
return
getScreenHeight
()
/
w
;
}
public
float
getYScale
()
{
public
float
getYScale
(
int
w
,
int
h
)
{
if
(
isKeepScale
()){
//固定比例,取最小值
float
sx
=
getScreenHeight
()
/
getGameWidth
()
;
float
sy
=
getScreenWidth
()
/
getGameHeight
()
;
float
sx
=
getScreenHeight
()
/
w
;
float
sy
=
getScreenWidth
()
/
h
;
return
Math
.
min
(
sx
,
sy
);
}
return
getScreenWidth
()
/
getGameHeight
()
;
return
getScreenWidth
()
/
h
;
}
public
boolean
isKeepScale
(){
...
...
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
ca18b39d
...
...
@@ -90,7 +90,6 @@ public interface Constants {
String
CORE_SKIN_AVATAR_OPPONENT
=
"opponent.jpg"
;
String
UNKNOWN_IMAGE
=
"unknown.jpg"
;
String
YDK_FILE_EX
=
".ydk"
;
int
[]
CORE_GAME_SIZE
=
new
int
[]{
1024
,
640
};
int
[]
CORE_SKIN_BG_SIZE
=
new
int
[]{
1280
,
720
};
int
[]
CORE_SKIN_CARD_COVER_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_AVATAR_SIZE
=
new
int
[]{
128
,
128
};
...
...
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