GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2017-Aug-21

Title: Android - Touch / Mouse movement related crashes...
Post by: MrPlow on 2017-Aug-21
Hi Guys

Any ideas what causes this with looping mousetouches etc...?
I'm not doing anything out of the ordinary for my movement controls.


native: pc 00000000000995dc  /data/app/com.gazzappergames.centiplode.centipedeshooter-1/lib/arm/libmain.so (_ZN7DXInput14SetActiveMouseEi+60)

  native: pc 0000000000099584  /data/app/com.gazzappergames.centiplode.centipedeshooter-1/lib/arm/libmain.so (_ZN7DXInput10GetNumMiceEv+24)


Title: Re: Android - Touch / Mouse movement related crashes...
Post by: Qedo on 2017-Aug-22
have you any source to try?
Ciao
Title: Re: Android - Touch / Mouse movement related crashes...
Post by: MrPlow on 2017-Aug-22
Hi Yes,

Apk but you probably wont see the issue as I have being using it for ages and cannot crash it - but Google says it has been crashing higher than my other apps.

It possible its just certain phones or actions by users...thought a quick answer might be out there but maybe I need to test it more myself on other devices.
Title: Re: Android - Touch / Mouse movement related crashes...
Post by: spacefractal on 2017-Aug-23
Android can been quite annoying and crashing can do anything.

Can you give the code you using?

in Karma Miwa im do something like this?

Code (glbasic) Select

IF GameInput.isTV=FALSE
FOR i=0 TO GETMOUSECOUNT()-1
SETACTIVEMOUSE i
MOUSESTATE mx, my, mba, mbb
mx=mx+S_XPOS_OFFSET
my=my+S_YPOS_OFFSET
IF mba=1
MOUSEDOWN=1
IF mx>2 AND my>2 THEN FINGERS_PRESSED=FINGERS_PRESSED+1
KEYBOARD=0
IF mx<256*SCALING*CONTOROLSIZE+OVERSCAN AND my>SCREENHEIGHT-164*SCALING*CONTOROLSIZE THEN L=L+1
IF mx>SCREENWIDTH-256*SCALING*CONTOROLSIZE AND my>SCREENHEIGHT-164*SCALING*CONTOROLSIZE THEN R=R+1
IF my<SCREENHEIGHT-164*SCALING*CONTOROLSIZE AND my>SCREENHEIGHT-340*SCALING*CONTOROLSIZE AND (mx<256*SCALING*CONTOROLSIZE OR SCREENWIDTH-256*SCALING*CONTOROLSIZE) THEN B=B+1
IF B=1
IF mx>SCREENWIDTH-256*SCALING*CONTOROLSIZE THEN R=1
IF mx<256*SCALING*CONTOROLSIZE+OVERSCAN THEN L=1
ENDIF
IF my<128*SCALING AND mx<128*SCALING
GameHide=1;
GAMEHIDED$="pause"
ENDIF
ENDIF
NEXT
ENDIF


With other word im send its to L as well R variable and does not use the variable directly. Alternative you can also exit the loop after the number of touch using, often normally two.
Title: Re: Android - Touch / Mouse movement related crashes...
Post by: MrPlow on 2017-Aug-23
Here you go! *ahem* Excuse the Mess!
Code (glbasic) Select

FOR i=0 TO GETMOUSECOUNT()-1
    SETACTIVEMOUSE i

MOUSESTATE mmx,mmy,mm1,mm2


mmx = mmx / offsetx
mmy = mmy / offsety

// shooting
IF mmy> movelimit AND mm1=TRUE AND delayshot<1 AND ABS(mmx-20-pl1x)<12 AND gunmeter>0 AND finger1=TRUE

LOCAL sh AS shot
sh.x = pl1x + 10
sh.y = pl1y - 10
sh.stat = 0
DEC gunmeter,1

DIMPUSH shots[],sh
delayshot = 15
panim = 8
IF musicyn=TRUE THEN  PLAYSOUND(4,0,.6)

IF RND(10) > 8 THEN creategunsmoke()



ENDIF
// shooting 2 finger mode
IF  mm1=TRUE AND delayshot<1 AND mmy<300 AND gunmeter>0 AND finger1=FALSE

LOCAL sh AS shot
sh.x = pl1x + 10
sh.y = pl1y - 10
sh.stat = 0
DEC gunmeter,1

DIMPUSH shots[],sh
delayshot = 15
panim = 8
IF musicyn=TRUE THEN  PLAYSOUND(4,0,.6)

IF RND(10) > 8 THEN creategunsmoke()



ENDIF

// movement controls

IF BOXCOLL(mmx,mmy,5,5,  150,30,16,16)=TRUE AND mm1=TRUE  AND delay<1

app_pause = 2
delay = 50
SLEEP 300

ENDIF

IF mmy-50> movelimit-130 AND mm1=TRUE AND mmx-15>pl1x AND  ABS(mmx-15-pl1x)>10 AND delay<1
wdir = 2
//delay = 2

INC pl1x, 4+(ABS(mmx-20-pl1x)/10) //*speed

// animtimer

IF GETTIMERALL()-onesec > 100
panim = 0

ELSE
panim = 1

ENDIF

IF delayshot>0 THEN panim = 8

IF GETTIMERALL()-onesec > 200
onesec = GETTIMERALL()

IF SOUNDPLAYING(channel3)=FALSE
IF musicyn=TRUE THEN channel3 = PLAYSOUND(3,0,.3)
ENDIF

ENDIF

ENDIF

IF mmy-50> movelimit-130 AND mm1=TRUE AND mmx-15<pl1x AND ABS(mmx-15-pl1x)>10 AND delay<1
wdir = 0
//delay = 2

DEC pl1x, 4+(ABS(mmx-25-pl1x)/10) //*speed

// animtimer

IF GETTIMERALL()-onesec > 100
panim = 0

ELSE
panim = 1

ENDIF
IF delayshot>0 THEN panim = 8

IF GETTIMERALL()-onesec > 200
onesec = GETTIMERALL()
IF SOUNDPLAYING(channel3)=FALSE
IF musicyn=TRUE THEN channel3= PLAYSOUND(3,0,.3)
ENDIF
ENDIF

ENDIF

// up down

IF mmy-50> movelimit-20 AND mm1=TRUE AND mmy-40>pl1y AND  ABS((mmy-40)-pl1y)>10 AND delay<1
wdir = 2
//delay = 2

INC pl1y, 4+(ABS(mmy-40-pl1y)/10) //*speed

// animtimer

IF GETTIMERALL()-onesec > 100
panim = 0

ELSE
panim = 1

ENDIF

IF delayshot>0 THEN panim = 8

IF GETTIMERALL()-onesec > 200
onesec = GETTIMERALL()

IF SOUNDPLAYING(channel3)=FALSE
IF musicyn=TRUE THEN channel3 = PLAYSOUND(3,0,.3)
ENDIF

ENDIF

ENDIF

IF  pl1y>movelimit AND (mmy-50> movelimit-20 OR mmy-50 > movelimit-150) AND mm1=TRUE AND mmy-45<pl1y AND ABS((mmy-45)-pl1y)>10 AND delay<1
wdir = 0
//delay = 2

DEC pl1y, 4+(ABS(mmy-45-pl1y)/10) //*speed

// animtimer

IF GETTIMERALL()-onesec > 100
panim = 0

ELSE
panim = 1

ENDIF
IF delayshot>0 THEN panim = 8

IF GETTIMERALL()-onesec > 200
onesec = GETTIMERALL()

ENDIF

ENDIF


NEXT


I did do a BREAK out of a Touch loop for another project - perhaps I should try it after 8 or so?

Title: Re: Android - Touch / Mouse movement related crashes...
Post by: spacefractal on 2017-Aug-23
you can try to do GLOBAL mmx,mmy,mm1,mm2, if the issue has been happens a null pointer issue. but im do hope not. Im do use GETMOUSECOUNT() as you see here, but im do not change the MOUSESTATE variables eventuelly.
Title: Re: Android - Touch / Mouse movement related crashes...
Post by: MrPlow on 2017-Aug-23
Thanks
I already have that GLOBAL statement,
do you think I should do a check for if mmy is NULL after the MOUSESTATE or could it be breaking on that Mousestate command?
Title: Re: Android - Touch / Mouse movement related crashes...
Post by: spacefractal on 2017-Aug-23
something. its could also been a bug relative to that. but as im remember its does allways return same number of mouse devices, which its should not do that. But im would limit to the number of touches the game was intended to been using. not more.