I'm using ncurses to do a sort of sim city simulator.
I have ascii map in a .txt and I need to load it on the terminal.
The loading is good but it doesn't display the right caracters(for some caracters only).
for example:
in .txt -> in terminal
│ -> �~T~B
═ -> �~U~P
( -> (
I'm using http://www.theasciicode.com.ar/ for the ascii map
bellow is the code to display the map in terminal
nt setUpMap(){
FILE *fp;
int c;
fp = fopen("./files/map.txt", "r+");
cbreak();
// Read and display data
while ((c = fgetc(fp)) != EOF)
{
switch(c){
case 'p' :
// todo : emoji
break;
default:
printw("%c", c);
break;
}
}
fclose(fp);
return 0;
}
example of the content of the .txt :
┌───────────────────────┐
│ [] [] [] [] │
│ [] [] [] [] [] │
│ [] [] [] [] │
│ │
│ ┌──┐ ┌──┐ │
└───┘ └───────┘ └─────┘
output in terminal :
�~T~L�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@ �~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~P
�~T~B [] [] [] [] �~T~B
�~T~B [] [] [] [] [] �~T~B
�~T~B [] [] [] [] �~T~B
�~T~B �~T~B
�~T~B �~T~L�~T~@�~T~@�~T~P �~T~L�~T~@�~T~@�~T~P �~T~B
�~T~T�~T~@�~T~@�~T~@�~T~X �~T~T�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~@�~T~X �~T~T�~T~@�~T~@�~T~@�~T~@�~T~@�~T~X
thanks for any ideas