Witam mam problem z napisaniem programu rysującego dywan sierpińskiego.
Przy kompilacji wyskakuje:
zad2.c: In function ‘main’:
zad2.c:57: error: too few arguments to function ‘screen_init’
Kod źródłowy:
#include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>
#include <time.h>
/* WINDOW *newwin(nlines, ncols, begy, begx) */
int current_getch;
int doloop = 1;
static WINDOW *mainwindow;
WINDOW *screen;
void init(void)
{
mainwindow = initscr();
noecho();
cbreak;
nodelay(screen, TRUE);
wrefresh(screen);
}
void screen_init(int x, int y, int width, int height)
{
int x2, y2;
x2 = x * 3 / width;
y2 = y * 3 / height;
x -= (x2 * width+2) / 3;
y -= (y2 * height+2) / 3;
width = (width +2-x2)/3;
height = (height+2-y2)/3;
screen = newwin( width, height, y, x);
box(screen, ACS_VLINE, ACS_HLINE);
curs_set(0);
wrefresh(screen);
refresh();
return screen_init(x, y, width, height);
}
void screen_end(void)
{
endwin();
}
int main()
{
screen_init();
while(doloop)
{
current_getch = getch();
if(current_getch == 113) doloop = 0; // wcisniecie q powoduje zakonczenie programu
init();
screen_init(0, 0, 50, 100);
sleep(1);
}
screen_end();
return 0;
}