Getmousecount()

Previous topic - Next topic

MrPlow

Should a limit be used for Getmousecount function?

10 mouse instances enough and ignore the rest?! or would that cause problems.

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

bigsofty

My tablet can register up to 16 touches, but I suppose your need is down to the game design. For example, if you had a multiplayer touch game.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Ian Price

Quotebut I suppose your need is down to the game design. For example, if you had a multiplayer touch game.
Or if you're a singleton from Norwich! :P
I came. I saw. I played.

spacefractal

dont uses more than you needs to uses for. etc max two input if its a two input game.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

So should I place a counter and break out the loop if the counter for the Getmousecount() is over 10 say?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

as you wrote to me in pm, your game did crash for some odd reason on extractly this command without know where its actuelly crashed (in Android). Om not sure im did seen that one.

Howover in my own game im did all control thing performed in a single function (here ctrl), which checking using something like this:

Code (glbasic) Select

GLOBAL JoyLeft
GLOBAL JoyRight
GLOBAL JoyFire


FUNCTION ctrl:
local mx, my, mba, mbb
JoyLeft=0
JoyRight=0
FOR i=0 TO GETMOUSECOUNT()-1
SETACTIVEMOUSE i
MOUSESTATE mx, my, mba, mbb
if mba=1
... do checkpoint here ...
PaintImage("left", 16*SCALING, 16*SCALING, 0, SCALING*0.75*CONTOROLSIZE, -1, 1, 2)
IF mx>PX AND mx<PX+PW AND my>PY-SCALING*32 AND my<PY+PH+SCALING*32
JoyLeft=1
ENDIF
.... Do rest of checking here....
EndIf
NEXT
ENDFUNCTION


Here you can also do special AE control thing here as well windows controllers, or what you might want to uses. Rest of your game will not change that, if you just ses JoyLeft, JoyRIght and JoyFire input instead constact checking GETMOUSECOUNT() etc.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Marmor

i think you need 12 mouse instance because some Aliens will also play your Game ! :D
in reality 2 or 3 is enough because i dont know any game which use 4-10.

   :x

bigsofty

This guy begs to differ!  ;)

Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrPlow

Lol!!

Wasn't sure if residual touches stayed active...  =D
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Kitty Hello

Mousecount returns the max GLB can handle or detect. Use mousestate to see if its pressed.

Gesendet von meinem GT-N7100 mit Tapatalk


MrPlow

#10
Reason I am asking is that I am getting some crashes now involving the Getmousecount  and by the looks of it the error the count exceeds 24.

I thought I might limit this if I stop the count - plus the game speed might improve if there are limits on the loop?!


Here is an example of the error:

backtrace:
#00 pc 00094e40 /data/app-lib/com.gazzapper.invadersandroidiafree-2/libmain.so (DXInput::SetActiveMouse(int)+60)
#01 pc 00094de8 /data/app-lib/com.gazzapper.invadersandroidiafree-2/libmain.so (DXInput::GetNumMice()+24)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

Its not a counter, itss more memory adress thing.

Etc im thinks im could fix that in my game. Here Im only use its once per loop, and allways uses arrays (if required) to save the mousestate and then progress its from here. Im also not uses it when the game is suspended.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hmmm, might look into that too...At the moment I am breaking out of the loop if the mousecount goes over 10

But would checking once per loop make the game controls less responsive? A delay if pressing left and fire together?

Anyway - I'm all for the most stable and playable solution!
=D
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

erico

Hey Plow, why would you need such a high count? Are you doing a piano for 4 players? :S
I think it is best you describe the need you are going to have if you need specific help.

For example, my game actually needs to read 1 touch only.
You are either walking left or right or jumping left or right (2 buttons each side).
Since players will hold and control with both hands using thumbs, there is a problem since the player would have to release left thumb to press right thumb.
In a fast action game, this control will be busted on the precision level.
Note that from left walking to left jumping, it works fine.

Solution was to write a code that reads 2 touches but consider only the last one.
Suppose you are walking left and you press walking right without releasing the walking left part. Here the player must now move right, and suppose I suddenly relese the right button, player is back walking left.

It gets a bit hard to implement such, but I managed in a cool way.
If you need something similar to this, let me know and I upload the code I have as a snippet (which I should do it anyways when game is finally released).
Cheers!

MrPlow

Thanks Erico!

I was unsure about how the getmousecount worked - and whether it counted more touches than actually used.

Like in swipes or something...I think I should do some experiments this.
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs