More mouse buttons?

0 favourites
  • 14 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • From what I can see, Construct only supports the three main buttons of mice, I am informed that it is possible in JavaScript to get input on all mouse buttons, here: https://www.w3.org/TR/DOM-Level-3-Event ... ouseevents. I was thinking of implmenting this myself with the SDK, but I don't see how that would work without changing the original mouse plugin. So can I request here that the ability to have button codes for the mouse a feature of Construct?

  • It could be useful for more complex games, especially for key rebinding options.

  • You could do this:

    https://dl.dropboxusercontent.com/u/542 ... se_js.capx

    Sadly, the beginner devs won't be able to utilize this. Still, it's very useful, thank you for sharing it.

  • R0J0hound , sorry for being so dumb, but how does your example work? It does nothing in my system, I tried any browser available and nothing gets added on the textbox object when I mouse click!

  • The mouse has to be outside of the Textbox, or the textbox will grab the events, in this example. It doesn't report all buttons though. I have 5 buttons, but only the main three report anything.

  • glerikud

    Why not? A beginner just needs to copy the start of layout event, then any function called "click" will be called when a button is clicked, and the first parameter will be the button number.

    eli0s

    As blackhornet says it only works clicking outside of the textbox.

    blackhornet

    That's interesting. I only have a standard mouse so I couldn't test.I guess it depends of the mouse or something.

  • Why not? A beginner just needs to copy the start of layout event, then any function called "click" will be called when a button is clicked, and the first parameter will be the button number.

    Because the beginner developers won't even know how to use functions. I'm not trying to be picky or anything, I'm just saying it might worth to offically support this with the mouse plugin.

  • R0J0hound , ah, ok! I can confirm what blackhornet said, only button 0, 1 and 2 are registering, nothing happens when I use the thumb buttons... That's a bummer, I had been asking for that feature for so long now...

  • I'm guessing the browsers themselves aren't checking those other buttons perhaps, the spec seems to allow it though. More than three buttons is non-standard so it's probably something more complicated like gamepads, but there doesn't seem to be any other way to access the mouse from js.

    I don't see any issue with giving beginners something new to learn, and in this case it's just a matter of using it like the example provided.

  • And just to reiterate what's already been said, only 0, 1 and 2 registered, tested on Chrome, Firefox, IE, Edge, Opera and NWjs

  • briggybros

    I guess that means you can't access those other buttons from javascript at this time. The spec as you linked mentions it as a possible feature, but I guess none of the browsers check more than the first three.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • R0J0hound is this something that could be fixed with a polyfill? I've looked around, but couldn't find one for it. I assume one could be written, at least for NWjs.

    Addition: Also not working on chrome canary or Mozilla nightly.

    Addition 2: Bought a new mouse with fully programmable keys, this can get around the problem in one sense by binding mouse 4 to say '4' on the keyboard. However, when binding 'mouse 4' to 'mouse 4', it prevents the button from becoming the browser's back button, but it still does not register. (chrome canary)

  • briggybros

    I bet it could, but I'm put off with the process of doing it. As I understand it can be done with:

    1. being able to compile NWjs from it's source

    2. looking up the windows interface to mice and see how to access other buttons.

    3. combining the two.

    2 is the easiest actually, and I'm stuck on 1, mainly because I don't have an os new enough for the required compiler.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)