Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4083501

Need Input Polling for Games (keyboard, etc)

XMLWordPrintable

    • Fix Understood
    • generic, x86
    • generic, windows_nt

      Name: rm29839 Date: 10/02/97


      I've found that Java is actually fast enough for
      *action* games on some JITs. (I've gotten
      upwards of even around 90 frames per second.)

      But I need keyboard/mouse/joystick *polling*
      (equivalent of GetAsyncKeyState()/joyGetInfoEx()
      on Win32) to make the games playable at all
      (as action games, that is).

      Please add them. Those games depends on them.

      Thank you.


      company - Acorn Associates , email - ###@###.###
      ======================================================================

      Name: krT82822 Date: 12/30/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      I need the ability to poll to find the mouse position. I need this to support
      an autoscroller, and there are plenty of people who would like to use it for
      other purposes as well; see bug 4083501, for instance.

      Here is the reason I need this for an autoscroller. My autoscroller currently
      triggers when the mouse is in a certain area. Because there is no way to poll
      the current position of the mouse I must use a Timer, and in that Timer I must
      repost mouseDrag events. When I do this for a view that takes a long time to
      draw, the timer reposting mouse events takes precedence over actual mouse
      motion.

      (I think that is a bug also anyway, and I will submit a seperate report for it;
      the bottom line, IMHO, is that your input event loop should be running in a
      seperate thread from the paint event system; since it's not, the UI feels very
      sluggish and unresponsive; I'm aware of the reasons you didn't do that, but I
      think in the long run it was the wrong choice. But if I could poll it wouldn't
      matter as much.)

      The result is that autoscroll events pile up and are handled before "real"
      mouse drag events, so that when I move the mouse out of the autoscroll area to
      stop autoscrolling, it takes 30sec-1min to stop scrolling, which is not very
      user friendly.

      If I could poll the mouse position, I wouldn't have to post a new mouse event
      and my autoscroller would stop scrolling immediately.

      As pointed out in bug 4083501, there are many other reasons people might want
      to poll hardware input devices, and they all come down to the same reason:
      eliminating innacuracy due to long event queue length. But special support for
      mouse/keyboard/joystick polling without having to do something radical like JNI
      would be very nice.
      (Review ID: 99448)
      ======================================================================

            Unassigned Unassigned
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: