Keyboard Input with UNIX And Windows

Started by
4 comments, last by 31337 20 years, 8 months ago
What''s the easiest way to get keyboard input management working on UNIX and Windows? I know how to do it for windows, there is some GetKey() command or something (I forget the exact syntax). However, how could I do keyboard (and mouse!) input with UNIX? This is all for my new 3D engine, MoonShine. I was thinking about using SDL, however i''ve developing under FreeBSD 5.1 and they don''t have libraries for BSD or Linux (THEY HAVE RPM''s!! How retarded!!). I tried buidling the source using the commands - ./configure, make, make install, make clean however I can''t tell if they libraries and includes got installed on my system or not. Any help would be greatly appreciated. Thanks
OpenGL Revolutions http://students.hightechhigh.org/~jjensen/
Advertisement
There is no magical way to do this, before you start coding anithing on nix/nux, you should know the basics about installing libraries and getting them to work, if you''re programming for X you should know *something* about it too. Only then you can start thinking about programming something.
[size="2"]I like the Walrus best.
Agreed, I am learning as fast as I can. I just started dominantly using unix but I have past experience so I''m moving pretty quickly.

So I''m assuming if I ran a "make install" that the libraries should be in the nessecary directory right now. I am going to pull up a search and see...

Right now I''m really just programming the stuff that should compile on any OS such as the kernel, the memory management, and error logging. So have I needed immidiate knowledge of my environment? No, however I definatly agree that I am going to need some.

In UNIX is the keyboard handling done via xfree86? That would make a lot of sense. If I have to I can bust out some int commands in assembly language for direct control over the keyboard and the typing buffer, but I don''t think thats the best way to do it especially for constrictive operating systems like window$ xp and 2k.

DOH! No results for SDL.lib. So can you point me in any direction or give me some advice? I can''t believe the SDL people didn''t bother to put in some documentation for BSD users. Grr...
OpenGL Revolutions http://students.hightechhigh.org/~jjensen/
I don't know a bit about BSD. The libraries should be .o and .a, and should be in /usr/lib or /usr/local/lib

There *is* documentation in the SDL homepage about installing the libs on linux. take a look at it. Try get some sdl sample sources and try to compile them, and after that study them a little.

try some searches like this one

luckª

EDIT: i guess you can also use the --prefix parameter to specify where you want the libs to be installed.

[edited by - xaxa on July 27, 2003 2:14:51 AM]
[size="2"]I like the Walrus best.
As mentioned, the files you''re looking for are probably in /usr/lib or /usr/local/lib and are called libSDL.a, libSDL.la, libSDL.so and a whole lot of other .so.* stuff which are mostly links to each other.

Not being able to install their files properly does not make THEM retarded (guess who''s retarded...). And really, doesn''t FreeBSD''s ports system cover SDL?

If you still don''t want to use SDL, look for documentation on xlib and input. You''ll probably want to create some wrapper system that is implemented with xlib on *nix and directinput on windows.

A note of caution as well: When programming input under X, you''ll want to grab the keyboard and mouse input. Once you do, and your program crashes or locks, you''ll have a real hard time trying to get control back. So do save alot if you need to kill X to regain control.
Yes, lol I am retarded. The reason why I was critical is because rpm''s are really only dominant on two linux distributions that I know of, Redhat and Mandrake.

Grr, I did a search for libSDL and I havn''t gotten any results. In kdevelop I include SDLmain.h and I set the linker to use the additional library libSDL, however I just get a bunch of errors claiming that functions in the SDLmain.h file are not defined. Anymore ideas?

OpenGL Revolutions http://students.hightechhigh.org/~jjensen/

This topic is closed to new replies.

Advertisement