Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » MinGW time issues, etc.

This thread is locked; no one can reply to it. rss feed Print
MinGW time issues, etc.
Bill Morris
Member #3,734
July 2003

I've got my alternative GUI up and running with MinGW (ported over from DJGPP) and Allegro and got the keyboard tamed, using a combination of Allegro keyboard functions, allowing differentiation of things like shift+ctrl+[some arrow key] and clearing the keyboard buffer to rein in runaway scrolling with a text editor.

Screenshot:
http://i6.photobucket.com/albums/y247/LCARS24user/LC24W.png

But I still have some issues to work out. I have ideas, but some of you must know the proper way to do these things.

1. Getting GCC to give me the local time instead of UCT.

2. Letting the program set the time and date as input by the user. I don't see settimeofday in the headers.

3. Running a child process. I tried this with a small test program. The parent receives and displays the return value but then hangs, even with SWITCH_BACKAMNESIA set.

4: I suspect that my main loop has to constantly check some designated pixel and redraw the screen if it's not the right color, in case Windows power management grabs the screen and trashes its video memory. It that true? I haven't experimented with it yet.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

1. Getting GCC to give me the local time instead of UCT.

localtime

Quote:

3. Running a child process. I tried this with a small test program. The parent receives and displays the return value but then hangs, even with SWITCH_BACKAMNESIA set.

Provide more information. This should probably be another thread.

Quote:

4: I suspect that my main loop has to constantly check some designated pixel and redraw the screen if it's not the right color, in case Windows power management grabs the screen and trashes its video memory. It that true? I haven't experimented with it yet.

Err, use this:set_display_switch_callback

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Bill Morris
Member #3,734
July 2003

Thanks, CGamesPlay.

That should cover it. I missed localtime. I must have been looking at the wrong time.h somehow and didn't notice exswitch in the Allegro examples. Once I get child processes to work smoothly, I can make up for any holes with DJ support programs, if necessary.

It's only been a few days since I downloaded MinGW, installed Allegro, and threw in over a megabyte of my DJ sources to compile. So that qualifies me as a newbie.

The test of a child process was added to my GetKey test program, like this:

set_display_switch_mode(SWITCH_BACKAMNESIA);

ReturnFromChild=spawnl(_P_WAIT, "nine.exe", "nine.exe", NULL);
textprintf_ex(screen, font, 480, 566, WHITE, -1, "%d", ReturnFromChild);

Nine.c is just this:
int main(int argc, char *argv[])
{
return 9;
}

The full-screen parent displays the value from the child but then shows a Windows taskbar and hangs, even though it's supposed to be still in an otherwise perfectly functional main loop.

Go to: