Giter VIP home page Giter VIP logo

Comments (14)

Ancurio avatar Ancurio commented on May 19, 2024

And this is on Windows, yes?

from mkxp.

khkramer avatar khkramer commented on May 19, 2024

This is on Windows yes.

I've managed a temporary fix after some tinkering, by including another call to Win32API:

GetKeyState=Win32API.new("user32", "GetKeyState", "I", "I")
GetKeyState.call(0)

This makes input work just fine it has just one very big side-effect.

It continues grabbing and updating keystrokes even when the application isn't active/minimized.

Do you have any plans of adding full-keyboard input to mkxp, perhaps?

from mkxp.

Ancurio avatar Ancurio commented on May 19, 2024

Do you have any plans of adding full-keyboard input to mkxp, perhaps?

Yes, see #70. I'm still thinking about the best way to write something generic that can cover as many use cases as possible. I will probably open a separate issue for it soon.

from mkxp.

Ancurio avatar Ancurio commented on May 19, 2024

I created an issue for general keyboard input: #73. As for your specific problem khkramer, it could be related to how SDL sets up its window and processes messages on Windows. Why do you need it to work so badly btw., I thought you were trying to port the code over to mkxp anyway?

from mkxp.

khkramer avatar khkramer commented on May 19, 2024

Well I had to have the chat functional to test a lot of things, and I didn't know if you were going to add full keyboard input or something that allows us to use those full keyboard input scripts, so my plan was originally to first fix it on windows and then look up if there are similar api calls on Linux.

I'm pretty sure it's how SDL set up its windows then, since I'm checking the thread id of the caller (so the game) and then checking the thread id of the foreground window, and then comparing them to see if the game has focus and is in the foreground. However even when it is the foreground window it returns another thread id for the window than the 'normal' thread id if that makes sense

from mkxp.

Ancurio avatar Ancurio commented on May 19, 2024

Added full keyboard support to mkxp, you can check my win32 wrapper for how to use it.

from mkxp.

khkramer avatar khkramer commented on May 19, 2024

Cool.

I'll try it out later today, and let you know how it worked.

from mkxp.

Ancurio avatar Ancurio commented on May 19, 2024

Closing this for now, reopen if you need to.

from mkxp.

khkramer avatar khkramer commented on May 19, 2024

Very very late response from me :)

It works like a charm, however it breaks mouseclicks for me.
I've found the cause as well, in Input.h, MouseLeft has scancode 0x38, while in the RMX-OS input script and your win32-wrapper the 'Up' key has scancode 0x38. So whenever I press the up key it thinks the left mouse is being clicked as well, while clicking the actual left mouse does nothing.

from mkxp.

Ancurio avatar Ancurio commented on May 19, 2024

Oh, I see, it's because you're overriding Input functions so my wrapper ends up calling your modified code. The proper fix on the mkxp side is to just completely remove the mouse extensions from Input and stash them into MKXP (which I should have done from the start), but until that change has landed, the quick fix is to save an alias to the original update function and call that in the win32 wrapper instead.

from mkxp.

khkramer avatar khkramer commented on May 19, 2024

Input.update isn't being called in the win32-wrapper??

from mkxp.

Ancurio avatar Ancurio commented on May 19, 2024

Oh sorry, brainfart. I meant press? of course.

from mkxp.

khkramer avatar khkramer commented on May 19, 2024

I saved an alias like this

module Input
  class << self
    alias_method(:win32wrap_press?, :press?)
    def press?(num)
      win32wrap_press?(num)
    end
  end
end

And called that instead and it's not detecting arrow keys as mouse buttons anymore, however actual mouse clicks still aren't detected.

Edit: Tried another input script with which it does work. So this problem is pretty much fixed on my end.

from mkxp.

Ancurio avatar Ancurio commented on May 19, 2024

I'd still be interested into why Mouse input didn't work the first time, but oh well.

from mkxp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.