Hi Guys, using the following codes i was able to create a coordinate map system. but i an stuck at getting the coordinates marked. now i will get (x,y) from the user and i need to mark it inside the map with " * ". the user would be give several (x,y) coordinates and i need to mark. I am unable to do so. I understand i need to modify the loop but if i modify it gets totally messy. Please advice. i am using the ncurses.
mvaddstr(3 - 2, 3 + 5, "Main Board");
mvaddstr(3 - 1, 3 - 3, numbers);
for (y = 0; y < 7; ++y) {
mvaddch(3 + y, 3 - 3, (chtype) (y + '0'));
attron(COLOR_PAIR(COLOR_RED));
addch(' ');
for (x = 0; x < 7; x++) {
(void) addstr(" . ");
}
(void) attrset(0);
(void) addch(' ');
(void) addch((chtype) (y + '0'));
}
How about seperating the model. e.g. Keep the state in a different object or struct and create a function to draw the model. It might be easier to maintain and change. :).