-
Notifications
You must be signed in to change notification settings - Fork 0
/
dane.c
53 lines (48 loc) · 862 Bytes
/
dane.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "silnik_gry.h"
#include "dane.h"
#include "menu.h"
#include "rysuj.h"
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
void snake()
{
jedzenie_funkcja();
nodelay(stdscr,true);
curs_set(0);
noecho();
raw();
cbreak();
refresh();
dane();
while(1)
{
kierunek();
gra_dalej();
zjedzenie_pokarmu();
if(zdzerzenie()==true)
break;
if(kanibal()==true)
break;
rysuj();
}
nodelay(stdscr,false);
koniec_gry();
}
void dane ()
{
if(waz.szybkosc==NULL)
waz.szybkosc = 2;
waz.kierunek = prawo;
waz.wielkosc = 1;
waz.cialo = malloc (ekran.szerokosc*ekran.wysokosc * sizeof (struct kawalek_weza)*waz.wielkosc);
if (waz.cialo == NULL)
{
mvprintw(25,25,"Blad alokacji pamieci");
}
waz.cialo[0].x = ekran.szerokosc/2;
waz.cialo[0].y = ekran.wysokosc/2;
}