316
Programming / Re: My roguelike idea - The zombie survivalist.
« on: December 02, 2008, 08:36:42 PM »BTW does anybody have a link to a good pdcurses tutorial? I havent been able to find one.
Code: [Select]
#include <curses.h>
char *map[]={
"***************",
"* * *",
"* *",
"* *** ****",
"**** *** * *",
"* * *",
"* * *",
"* *",
"* * *",
"***************"
};
main() {
keypad(initscr(),1);
int y=1;
int x=1;
int c;
while('q'!=(c=getch())){
for(int yy=0;yy<10;yy++)
for(int xx=0;xx<15;xx++)
mvaddch(yy,xx,map[yy][xx]);
if(KEY_UP==c && ' '==map[y-1][x])
y--;
if(KEY_DOWN==c && ' '==map[y+1][x])
y++;
if(KEY_LEFT==c && ' '==map[y][x-1])
x--;
if(KEY_RIGHT==c && ' '==map[y][x+1])
x++;
mvaddch(y,x,'@');
}
}