Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Event/Input handling

    I'm doing a slight bit of graphics in php, but I've had trouble finding an input package to manage keyboard events. For example, suppose I have a ball stationary in position, I hit the left key, then the ball moves to the left. What key event package could I use to detect a keypress and keyrelease in php? I hope my question isn't confusing. I'm looking for a key event handler extension for php, or some way to add that support. I've been running through a few extensions in php but haven't found anything too straight forward. Any helpful links that lead to tutorials, pages, etc would be of great help.

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,092
    Thanks
    2
    Thanked 322 Times in 314 Posts
    You are not going to find anything specific to PHP that does this.

    The closest you will find that involves PHP would be AJAX that sends http requests to PHP on the web server.

    To just move a object on the screen in a browser, you would typically do this completely using javascript as the programming to cause the motion in response to the input is not dependent on any realtime information that is present on the web server. This would also provide the quickest response and accuracy in positioning. Sending requests through the web server would suffer random time lags and would be dependent on the connection speed.

    If the resultant position needs to be sent to the web server, you could then either submit it using a form or using AJAX techniques.
    Last edited by CFMaBiSmAd; 02-25-2007 at 05:16 PM. Reason: additional specific info
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Quote Originally Posted by CFMaBiSmAd View Post
    You are not going to find anything specific to PHP that does this.

    The closest you will find that involves PHP would be AJAX that sends http requests to PHP on the web server.

    To just move a object on the screen in a browser, you would typically do this completely using javascript as the programming to cause the motion in response to the input is not dependent on any realtime information that is present on the web server. This would also provide the quickest response and accuracy in positioning. Sending requests through the web server would suffer random time lags and would be dependent on the connection speed.

    If the resultant position needs to be sent to the web server, you could then either submit it using a form or using AJAX techniques.

    thanks, that helped tremendously


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •