Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 712 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
mouse button 4 and 5? #453583
08/02/15 11:18
08/02/15 11:18
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi,

Is it possible to set a function for other mouse buttons besides left, right and middle (so besides on_mouse_left, on_mouse_right, on_mouse_middle)?

Some mouses have e.g. 2 extra buttons, would be nice to make use of them for shortcuts / hotkeys.

Last edited by Reconnoiter; 08/02/15 11:47.
Re: mouse button 4 and 5? [Re: Reconnoiter] #453586
08/02/15 15:43
08/02/15 15:43

M
Malice
Unregistered
Malice
Unregistered
M



No other buttons are in the manuals key map, try find the scan code for the buttons and writing your own check with key_pressed(scancodeX)

Re: mouse button 4 and 5? [Re: ] #453594
08/02/15 18:48
08/02/15 18:48
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Cool, I will try key_pressed. thanks laugh

Re: mouse button 4 and 5? [Re: Reconnoiter] #453601
08/02/15 20:01
08/02/15 20:01

M
Malice
Unregistered
Malice
Unregistered
M



If that doesn't work... You need to jump out of the 3dgs and into the winapi to achieve the goal. There are a many people here that could speak on that, I am not one of them.

Re: mouse button 4 and 5? [Re: ] #453607
08/03/15 10:20
08/03/15 10:20
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Yeah it doesn't seem to work for scancode above ~280. I will check the winapi, have a little experience with it (hopefully enough grin ).
Anyway thanks for taking the time to reply here. laugh

Re: mouse button 4 and 5? [Re: Reconnoiter] #453610
08/03/15 18:54
08/03/15 18:54
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
I've got a code snippet, I'll see if I can find it.

Edit: here:
Code:
#define mouse_4 (GetKeyState(5) > 1)
#define mouse_5 (GetKeyState(6) > 1)


Tiny but works. but remember to include windows.h.

Edit2: forgot to say: you can use it exactly like the vars mouse_left, mouse_right, etc.

Last edited by Kartoffel; 08/03/15 19:00. Reason: typos

POTATO-MAN saves the day! - Random
Re: mouse button 4 and 5? [Re: Kartoffel] #453612
08/03/15 19:34
08/03/15 19:34
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
better use if(GetKeyState(5) & 0x8000)
msdn says thats high order bit and its set when the key is pressed

Re: mouse button 4 and 5? [Re: Ch40zzC0d3r] #453615
08/03/15 20:48
08/03/15 20:48
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Yeah, there are two bits used. One for pressed/not pressed and one as a button toggle (pressing the key switches between on and off)


POTATO-MAN saves the day! - Random
Re: mouse button 4 and 5? [Re: Kartoffel] #453623
08/04/15 13:37
08/04/15 13:37
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
It works very nicely, thanks! And I learned something extra about define laugh


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1