OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 7:50 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Windoze Programming.
PostPosted: Thu Jan 10, 2002 9:06 pm 
While working on the next release of AGIL, I have run into a problem in implementing the multi-slot saved games.  They work great on Linux and DOS/DJGPP, but Windoze (Mingw32) does not have getwd().  I was going to use this for the default directory for the saved games (Unix uses ~/.agil/<gameid>), DJGPP has getwd().

Any help would be appreciated (substitute for getwd).

Also people the SDL driver's key handling is broken.  (event.key.keysym.sym is always zero, and therefore cannot be used)  If anyone can help with this it would be greatly appreciated.


Top
  
 
 Post subject: Re: Windoze Programming.
PostPosted: Thu Jan 10, 2002 9:39 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 22, 2004 11:00 pm
Posts: 1076
have you looked at the sarien SDL driver? we handle key events differently but you should get some idea of a working driver.

_________________
-- Stu --


Top
 Profile  
 
 Post subject: Re: Windoze Programming.
PostPosted: Fri Jan 11, 2002 1:13 am 
df: I will look at the Sarien SDL driver now.  I may also checkout the sound code.  The sound in AGIL (OSS only) plays for longer than it should.

Forget about the getwd() thing, I'm just using the gamedir as the default savegame directory.  This is given on the command line, or defaults ot "./"


Top
  
 
 Post subject: Re: Windoze Programming.
PostPosted: Fri Jan 11, 2002 3:36 am 
Just been looking at Sarien SDL driver.  Also the checkkeys.c that comes with SDL.

Sarien driver works on same principle as mine, although the design is different.
I can't figure out why event.key.keysym.sym is always zero.  It isn't in Sarien, nor checkkeys.c.
Copying code strait from checkkeys.c does not event give the save results.

It also seems that If I don't waste enough time in driver_kb_update() I get sementation faults.
ie.
     SDL_Event event;
     while(SDL_PollEvent(&event) {
     }

causes a segmentation fault.

Has anyone looked at my code?


Top
  
 
 Post subject: Re: Windoze Programming.
PostPosted: Fri Jan 11, 2002 8:24 am 
I have looked at your code did not understand some of it I guess now is a good time as any to get back into c and try to remember what is what.


Top
  
 
 Post subject: Re: Windoze Programming.
PostPosted: Sat Jan 12, 2002 1:56 am 
Hey, I figured out the keyboard problem.

It's that AGIL was compiled with -fshort_enums, and SDL was not.  So AGIL's SDL_Event was smaller that SDL's SDL_Event.  This is what caused segmentation faults with SDL_PollEvent().

Working great now, I lost backward compatibility with saved games anyway adding the multi-slot code.

For people complaining about the small window, the window unlikely to be any larger in next release, but (if I can get it to work) I will add a "Press F11 to toggle full screen mode".  Full screen mode does not work on my box (not even in NAGI), it says no graphics mode large enough for 320x200, when 'doze is running 640x480.  I'll see, I'll put the code in the next release even if it doesn't work properly.


Top
  
 
 Post subject: Re: Windoze Programming.
PostPosted: Mon Feb 11, 2002 6:51 am 
What does getwd() do? Does it return the working directory? As a general rule, if you want to find a Windows API function to do something, the name will be spelled out completely (so you unfortunately don't have such easily understood names as axftostp() or whatever). The Windows API command to get the current directory for a process is GetCurrentDirectory(). It takes a number of characters to retrieve followed by an appropriately sized buffer (needs to be a char buffer for Windows 95/98/Me and a wchar_t buffer if you compile for Windows NT).


Top
  
 
 Post subject: Re: Windoze Programming.
PostPosted: Mon Feb 11, 2002 10:50 pm 
Thanks for your help. Oh how I hate windoze.

getwd() does get the working directory.  It's a POSIX function, who would have thought that Micros**t could give the funtions their real names.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 53 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group