18.02.2013 Views

NCURSES ile Yazılım Geli¸stirme NASIL

NCURSES ile Yazılım Geli¸stirme NASIL

NCURSES ile Yazılım Geli¸stirme NASIL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}WIN;<br />

void init_win_params(WIN *p_win);<br />

void print_win_params(WIN *p_win);<br />

void create_box(WIN *win, bool flag);<br />

int main(int argc, char *argv[])<br />

{ WIN win;<br />

int ch;<br />

<strong>NCURSES</strong> <strong>ile</strong> Yazılım Geli¸stirme <strong>NASIL</strong><br />

initscr(); /* curses ilklendirme */<br />

start_color(); /* Renk özelli˘gini ba¸slat */<br />

cbreak(); /* Satır önbelle˘gi etkisiz, *<br />

* her¸seyi bana gönder */<br />

keypad(stdscr, TRUE); /* ¸Su ¸seker F1’e ihtiyacım var */<br />

noecho();<br />

init_pair(1, COLOR_CYAN, COLOR_BLACK);<br />

/* Pencere parametrelerini ilklendir */<br />

init_win_params(&win);<br />

print_win_params(&win);<br />

attron(COLOR_PAIR(1));<br />

printw("Çıkmak için F1’e basınız");<br />

refresh();<br />

attroff(COLOR_PAIR(1));<br />

create_box(&win, TRUE);<br />

wh<strong>ile</strong>((ch = getch()) != KEY_F(1))<br />

{ switch(ch)<br />

{ case KEY_LEFT:<br />

create_box(&win, FALSE);<br />

––win.startx;<br />

create_box(&win, TRUE);<br />

break;<br />

case KEY_RIGHT:<br />

create_box(&win, FALSE);<br />

++win.startx;<br />

create_box(&win, TRUE);<br />

break;<br />

case KEY_UP:<br />

create_box(&win, FALSE);<br />

––win.starty;<br />

create_box(&win, TRUE);<br />

break;<br />

case KEY_DOWN:<br />

create_box(&win, FALSE);<br />

++win.starty;<br />

create_box(&win, TRUE);<br />

break;<br />

}<br />

}<br />

endwin(); /* Curses kipi sonu */<br />

return 0;<br />

}<br />

void init_win_params(WIN *p_win)<br />

{<br />

http://belgeler.org Linux Kitaplı˘gı 26 / 90

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!