From: Lionel Pinkhard (lionelp@worldonline.co.za)
Date: Fri 11 Aug 2000 - 21:35:00 IDT
Okay, I settled for 320x200x16, looks okay, but maybe I'll have to adjust the palette later on (my development system has a monochrome monitor, but I have three other monitors). I'm having a little trouble with the keyboard, I tried your piece of code (thanks a lot, BTW!), and I include <ncurses.h> as well, and got this output: /tmp/cca020801.o: In function `gameloop': /tmp/cca020801.o(.text+0x2f2): undefined reference to `noecho' /tmp/cca020801.o(.text+0x2f7): undefined reference to `cbreak' Any idea what's going on here? Also, I checked out the man page for gettimeofday, I'm just having a little trouble understanding it, what type of variable should I set up to store it in? Can you give me an example of how I can get the time from it? Sorry, the man page is talking about struct's, and I don't have that much experience with it (well, I've never returned a struct, but I have used them before). Thanks for the help! Ciao, Lionel On Fri, 11 Aug 2000, Bart Oldeman wrote: > On Fri, 11 Aug 2000, Lionel Pinkhard wrote: > > [just saw that Matan Ziv-Av already answered while I was writing this, > so some of this overlaps a bit] > > > Firstly, my game uses CGA mode 4h, which it doesn't look like SVGALIB > > supports, is there a way of setting this mode? I saw a function in the > > source code called vga_addmode(), does this have anything to do with it? > > If not, what's it for? And how can I use it? Or is it only for internal > > use? > > As far as I could see, vga_addmode just adds (maxx, maxy, bpp, > etc.) information to the internal mode database. Whilst it is possible > to add support for it by programming the chipset, you can easily simulate > CGA mode 4h by using G320x200x16 or G320x200x256 and just using 4 colors. > > > Secondly, my routine for trapping keystrokes doesn't work under Linux, > > here's the code I tried: > > > > while (kbhit()) { > > keypressed = getch(); > > > > Why doesn't it work? Or what do I need to include? > > If you use ncurses you can use getch. See man getch. You could do the > following: > > noecho(); > cbreak(); /* set cbreak mode (don't wait for return key) */ > while (1) { > keypressed=getch(); /* getch waits for the key */ > > The DOS method is very dirty in Linux since it continuously polls > kbhit() and therefore eats a lot of CPU cycles. > > Or use vga_getch() instead. Then you don't need ncurses. > If you need certain keys not available through ncurses/vga_getch then you > need to use raw keyboard handling. See man svgalib + individual manpages. > > > Thirdly, my timing doesn't work, for the old DOS version, I used Interrupt > > 1ah, is there a way I can get the time in the same format under Linux? > > processor time used by program: clock(3) > seconds since 1 January 1970: time(2) > most accurate: gettimeofday(2) > > > Fourthly, how can I determine whether a joystick is installed? And if so, > > how can I get it's axis? I have never programmed ports on Linux before, > > and the outport() and inport() functions don't seem to work, or would I > > have to rewrite the entire function differently? If so, how? > > svgalib has joystick functions. It's better to use them. > joystick_getaxis(3) is the obvious function to get its axis. > > Regards, > Bart >
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST