LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-18-2006, 07:46 PM   #1
pda_h4x0r
Member
 
Registered: Feb 2006
Location: somewhere in cyberspace
Distribution: Debian, Familiar
Posts: 380

Rep: Reputation: 31
Faster, more direct keyboard reading.


Hello everyone,

I'm attempting to develop a better pinball game for Linux that will use GLX. I can get hardware-accelerated OpenGL graphics without any problems, but keyboard event handling through the program's event handler is far too slow . Is there a way to bypass the event handler and asynchronously read the keyboard, kind of like the SDL_GetKeyState() function, or the GetAsyncKeyState() function from the MFC? Nothing against SDL, but I'd like to avoid using it for now, to help familiarize myself with OpenGL.

Thank you
 
Old 05-18-2006, 11:57 PM   #2
pda_h4x0r
Member
 
Registered: Feb 2006
Location: somewhere in cyberspace
Distribution: Debian, Familiar
Posts: 380

Original Poster
Rep: Reputation: 31
Specifically, the program is designed to work with X11. I'd like to be able to quickly read keystrokes from the keyboard without using X protocol events. I'd like to asynchronously determine if a key is being pressed or released without having to go through the event handler (way, way too slow for gaming). Is there a function ANYWHERE that will let me do this? Could I do something like this in Linux:

//hande keyboard input
void HandleKeys(void) {

if(KEY_PRESSED(KEY_LEFT)) {
//do something if the left arrow key is pressed
}
if(KEY_PRESSED(KEY_RIGHT)) {
//do something if the right arrow key is pressed
}

}

How is it typically done in Linux games?

Thank you
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: Faster and Faster Compilation jeremy LinuxAnswers Discussion 5 12-06-2005 01:41 AM
Reading from the keyboard Hugo Orlando Programming 1 12-20-2004 05:53 AM
Reading cds that were formated with direct cd deepsix Linux - Software 4 09-03-2003 11:19 PM
Best way to ALOT of files in a direct to other direct? packman Linux - General 2 10-21-2002 07:31 PM
console keyboard configuration\ terminal switching off \ faster booting jamaso Linux - Newbie 5 10-27-2001 08:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration