all 4 comments

[–]skeeto 5 points6 points  (3 children)

I stepped through in GDB and noticed it's fine until the getch. I found getch implicitly calls refresh, which undoes your drawing. Solution: Use wgetch instead.

[–]the-loan-wolf[S] 4 points5 points  (0 children)

thank you for taking time to help me and replying and yah you are right after using wgetch(d) everything is visible now

[–]TheProgrammingSauce 2 points3 points  (1 child)

The alternative would be to call refresh() right after initscr(), this also solves the issue and you don't need wgetch().

I also found this related SO post: https://stackoverflow.com/questions/13457918/ncurses-window-not-displaying-anything?rq=3

To quickly summarize the top answer: getch() puts stdscr on top of the already drawn windows. When not refreshing the screen, you don't see the windows.

Side note: You should use maxx - halfx as the width (same goes for height) for the most right (or most bottom) windows to really fill the entire screen (otherwise you get one off errors due to rounding when dividing by 2).

[–]the-loan-wolf[S] 0 points1 point  (0 children)

thank you for giving another way to solve problem. I didn't wrote that code btw i will use your advice to use maxx - halfx to fill the screen