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
bd22e195
Commit
bd22e195
authored
Oct 04, 2019
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
刷新会闪退
parent
0f6ff7ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
43 deletions
+49
-43
Classes/gframe/drawing.cpp
Classes/gframe/drawing.cpp
+1
-1
libcore/jni/cn_garymb_ygomobile_core_IrrlichtBridge.cpp
libcore/jni/cn_garymb_ygomobile_core_IrrlichtBridge.cpp
+39
-36
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+9
-6
No files found.
Classes/gframe/drawing.cpp
View file @
bd22e195
...
...
@@ -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
);
}
}
...
...
libcore/jni/cn_garymb_ygomobile_core_IrrlichtBridge.cpp
View file @
bd22e195
...
...
@@ -226,38 +226,27 @@ static void* join_game_thread(void* param) {
return
NULL
;
}
bool
sendKey
(
int
handle
,
int
keycode
,
bool
begin
){
if
(
handle
)
{
CIrrDeviceAndroid
*
device
=
(
CIrrDeviceAndroid
*
)
handle
;
/*
* Class: cn_garymb_ygomobile_core_IrrlichtBridge
* Method: nativeRefreshTexture
* Signature: (I)V
*/
JNIEXPORT
void
JNICALL
Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeRefreshTexture
(
JNIEnv
*
env
,
jclass
clazz
,
jint
handle
)
{
if
(
handle
)
{
IrrlichtDevice
*
device
=
(
IrrlichtDevice
*
)
handle
;
if
(
device
->
isWindowFocused
())
{
irr
::
os
::
Printer
::
log
(
"before send refresh event"
);
SEvent
event
;
event
.
EventType
=
EET_KEY_INPUT_EVENT
;
int
keyCode
=
keycode
;
if
(
keyCode
>=
0
&&
(
u32
)
keyCode
<
device
->
KeyMap
.
size
())
event
.
KeyInput
.
Key
=
device
->
KeyMap
[
keyCode
];
else
event
.
KeyInput
.
Key
=
KEY_UNKNOWN
;
event
.
KeyInput
.
PressedDown
=
begin
;
//just cause a right up event to refresh texture
event
.
KeyInput
.
PressedDown
=
true
;
event
.
KeyInput
.
Shift
=
false
;
event
.
KeyInput
.
Control
=
false
;
event
.
KeyInput
.
Key
=
KEY_KEY_R
;
device
->
postEventFromUser
(
event
);
return
true
;
}
}
return
false
;
}
/*
* Class: cn_garymb_ygomobile_core_IrrlichtBridge
* Method: nativeRefreshTexture
* Signature: (I)V
*/
JNIEXPORT
void
JNICALL
Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeRefreshTexture
(
JNIEnv
*
env
,
jclass
clazz
,
jint
handle
)
{
if
(
sendKey
(
handle
,
KEY_KEY_R
,
true
)){
irr
::
os
::
Printer
::
log
(
"before send refresh event"
);
}
}
/*
...
...
@@ -266,8 +255,19 @@ bool sendKey(int handle, int keycode, bool begin){
* Signature: (IZ)V
*/
JNIEXPORT
void
JNICALL
Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeIgnoreChain
(
JNIEnv
*
env
,
jclass
clazz
,
jint
handle
,
jboolean
begin
)
{
if
(
sendKey
(
handle
,
KEY_KEY_S
,
true
)){
irr
::
os
::
Printer
::
log
(
"before send ignore chain"
);
if
(
handle
)
{
IrrlichtDevice
*
device
=
(
IrrlichtDevice
*
)
handle
;
if
(
device
->
isWindowFocused
())
{
irr
::
os
::
Printer
::
log
(
"before send ignore chain"
);
SEvent
event
;
event
.
EventType
=
EET_KEY_INPUT_EVENT
;
//just cause a right up event to refresh texture
event
.
KeyInput
.
PressedDown
=
begin
;
event
.
KeyInput
.
Shift
=
false
;
event
.
KeyInput
.
Control
=
false
;
event
.
KeyInput
.
Key
=
KEY_KEY_S
;
device
->
postEventFromUser
(
event
);
}
}
}
...
...
@@ -277,16 +277,19 @@ bool sendKey(int handle, int keycode, bool begin){
* Signature: (IZ)V
*/
JNIEXPORT
void
JNICALL
Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeReactChain
(
JNIEnv
*
env
,
jclass
clazz
,
jint
handle
,
jboolean
begin
)
{
if
(
sendKey
(
handle
,
KEY_KEY_A
,
true
)){
irr
::
os
::
Printer
::
log
(
"before send react chain"
);
}
}
//key事件
JNIEXPORT
void
JNICALL
Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeSendKey
(
JNIEnv
*
env
,
jclass
clazz
,
jint
handle
,
jint
keycode
,
jboolean
begin
)
{
if
(
sendKey
(
handle
,
keycode
,
begin
)){
irr
::
os
::
Printer
::
log
(
"before send nativeSendKey"
);
if
(
handle
)
{
IrrlichtDevice
*
device
=
(
IrrlichtDevice
*
)
handle
;
if
(
device
->
isWindowFocused
())
{
irr
::
os
::
Printer
::
log
(
"before send react chain"
);
SEvent
event
;
event
.
EventType
=
EET_KEY_INPUT_EVENT
;
//just cause a right up event to refresh texture
event
.
KeyInput
.
PressedDown
=
begin
;
event
.
KeyInput
.
Shift
=
false
;
event
.
KeyInput
.
Control
=
false
;
event
.
KeyInput
.
Key
=
KEY_KEY_A
;
device
->
postEventFromUser
(
event
);
}
}
}
...
...
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
bd22e195
...
...
@@ -263,8 +263,8 @@ public class YGOMobileActivity extends NativeActivity implements
int
[]
size
=
getGameSize
();
int
w
=
size
[
0
];
int
h
=
size
[
1
];
getWindow
().
takeInputQueue
(
null
);
FrameLayout
.
LayoutParams
lp
=
new
FrameLayout
.
LayoutParams
(
w
,
h
);
lp
.
gravity
=
Gravity
.
CENTER
;
layout
.
addView
(
mSurfaceView
,
lp
);
layout
.
addView
(
view
,
lp
);
...
...
@@ -290,7 +290,7 @@ public class YGOMobileActivity extends NativeActivity implements
final
int
action
=
event
.
getAction
();
final
float
x
=
event
.
getX
();
final
float
y
=
event
.
getY
();
mWorker
.
post
(
new
Runnable
()
{
doWork
(
new
Runnable
()
{
@Override
public
void
run
()
{
IrrlichtBridge
.
sendTouch
(
action
,
x
,
y
,
0
);
...
...
@@ -303,9 +303,8 @@ public class YGOMobileActivity extends NativeActivity implements
// getWindow().setLayout(w, h);
// getWindow().setGravity(Gravity.CENTER);
super
.
setContentView
(
layout
);
mSurfaceView
.
requestFocus
();
getWindow
().
takeSurface
(
null
);
getWindow
().
takeInputQueue
(
null
);
mSurfaceView
.
requestFocus
(
);
}
@Override
...
...
@@ -321,7 +320,7 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public
boolean
onKeyDown
(
final
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
!=
KeyEvent
.
KEYCODE_BACK
){
mWorker
.
post
(
new
Runnable
()
{
doWork
(
new
Runnable
()
{
@Override
public
void
run
()
{
IrrlichtBridge
.
sendKey
(
keyCode
,
true
);
...
...
@@ -335,7 +334,7 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public
boolean
onKeyUp
(
final
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
!=
KeyEvent
.
KEYCODE_BACK
){
mWorker
.
post
(
new
Runnable
()
{
doWork
(
new
Runnable
()
{
@Override
public
void
run
()
{
IrrlichtBridge
.
sendKey
(
keyCode
,
false
);
...
...
@@ -346,6 +345,10 @@ public class YGOMobileActivity extends NativeActivity implements
return
super
.
onKeyUp
(
keyCode
,
event
);
}
private
void
doWork
(
Runnable
runnable
){
mWorker
.
post
(
runnable
);
}
@Override
public
void
onBackPressed
()
{
Toast
.
makeText
(
this
,
"请在游戏里面退出"
,
Toast
.
LENGTH_SHORT
).
show
();
...
...
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