pvjc25/du8/world.c
2025-06-11 12:22:15 +02:00

40 lines
865 B
C

#include <ncurses.h>
#include <stdarg.h>
#include <stdio.h>
#include "world.h"
void world_init() {
initscr(); // inicializácia ncurses
raw(); // vypne linkový režim (bez enter)
keypad(stdscr, TRUE); // povolí šípky
noecho(); // nevypisuje znaky
curs_set(1); // viditeľný kurzor
}
void world_end() {
endwin(); // ukončí ncurses
}
void world_clear() {
clear(); // vyčistí obrazovku
refresh(); // prekreslí
}
void world_print(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
vw_printw(stdscr, fmt, args);
va_end(args);
refresh();
}
void world_set_cursor(int x, int y) {
move(y, x);
refresh();
}
char world_read_key() {
return getch(); // načítanie jedného znaku
}