Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Curses!

Name: Anonymous 2009-06-02 18:17

I'm writing a simple game in C with ncurses, and there's a problem. I want some things to move (enemies, projectiles) at all time, even while my character is stationary. What I have now is the character moving procedure, then the bullet/enemy moving procedure, one after another, in the main loop, so that the program is waiting for the input that will move the character before moving on to moving the enemies. What's the simplest way to fix this?

Name: Anonymous 2009-06-02 18:22

NODELAY()

by which I mean RTFM

Name: Anonymous 2009-06-02 18:23

>>2
seconded

Name: Anonymous 2009-06-02 18:27

The nodelay option causes getch to be a non-blocking call. If no input is ready, getch returns ERR. If disabled (bf is FALSE), getch waits until a key is pressed.

Name: Anonymous 2009-06-02 18:37

Yeah. What >>2-4 said, look up non-blocking I/O

Name: Anonymous 2009-06-02 19:06

>>5
I don't really think you should include >>3 in the range, since she didn't really contribute anything to this thread...

Name: Anonymous 2009-06-02 19:24

>>6
she
Do you know something that we dont...?

>>1
Also, don't just put input and logic in the same place, it just won't work out in the long run.

Name: Anonymous 2009-06-02 19:24

>>6
she reinforced >>2-san's post. On an anonymous forum such as /prog, where one can not trust the accuracy of respondants' responses, reinforcement is most valuable.

Name: Anonymous 2009-06-02 19:25

>>7
Considering OP is building a curses app, I don't think she's going to be worried about program design :3

Name: Anonymous 2009-06-02 19:26

>>7
LOL MVC FAGGIT

Name: Anonymous 2009-06-02 19:37

>>10
I don't know how you (and the ENTERPRISE) call it, it's just proper design which won't make you have to refactor all of your code thrice.

No, seriously, this kind of things should come to anyone with half a brain and a bit of practice naturally.

Name: Anonymous 2009-06-02 20:12

Okay, so I did that, but it goes so fast that I need to slow it down, and sleep doesn't accept less than one second.

Name: NO WOMEN ON INTERNET 2009-06-02 20:29

she
Go back to wherever the hell you faggots came from.

Name: Anonymous 2009-06-02 21:32

>>13
Back to /b/ please.

Name: Anonymous 2009-06-02 22:03

>>14
This meme is old enough to be Acceptable.

Name: Anonymous 2009-06-02 22:34

>>15
This meme isn't a meme.
This meme is infact a mae-me.

Name: Anonymous 2009-06-03 1:08

>>16
This mae-me is a poorly hidden request of ``maime-me,,

Name: Anonymous 2009-06-03 7:36

>>12
man halfdelay

Name: Anonymous 2009-06-03 8:26

man halfλife

Name: Anonymous 2009-06-03 8:28

>>19
back to /black mesa/

Name: Anonymous 2009-06-03 8:38

Use threads.

Name: Anonymous 2009-06-03 8:58

>>21
Except ncurses isn't thread-safe!

Name: Anonymous 2009-06-03 9:05

>>22
Then use a fork().

Name: Anonymous 2009-06-03 10:25

>>12
look up nanosleep or similar

Name: Anonymous 2009-06-03 10:27

>>15
>>16
>>17
back to /b/, please.

>>19
>>20
back to /v/, please.

Name: Anonymous 2009-06-03 11:27

>>25
Optimize your quoting please.
>>15-17
>>19,20

Name: Anonymous 2009-06-03 11:30

>>26
I would have preferred >>19-20 but whatever, man.

Name: Anonymous 2009-06-03 17:41

>>27
>>19-20 is equivalent to >>19

Name: Trollbot9000 2009-07-01 8:00

Stationary What I have until tuesday to.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List