36 lines
		
	
	
		
			459 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			459 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <ncurses.h>
 | |
| #include "world.h"
 | |
| 
 | |
| static int width, height;
 | |
| 
 | |
| void init_world(int w, int h) {
 | |
|     width = w;
 | |
|     height = h;
 | |
|     initscr();
 | |
|     noecho();
 | |
|     curs_set(FALSE);
 | |
|     timeout(100);
 | |
|     keypad(stdscr, TRUE);
 | |
| }
 | |
| 
 | |
| void clear_world() {
 | |
|     clear();
 | |
| }
 | |
| 
 | |
| void draw_character(char c, int x, int y) {
 | |
|     mvaddch(y, x, c);
 | |
| }
 | |
| 
 | |
| void refresh_world() {
 | |
|     refresh();
 | |
| }
 | |
| 
 | |
| int world_width() {
 | |
|     return width;
 | |
| }
 | |
| 
 | |
| int world_height() {
 | |
|     return height;
 | |
| }
 | |
| 
 |