forked from ntxtung/SnakeVer2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphicAPI.cpp
37 lines (32 loc) · 761 Bytes
/
graphicAPI.cpp
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
#include "Declaration.h"
#include "GraphicAPI.h"
void initGraphic()
{
initwindow(W, H, "THIS IS A SNAKE GAME!");
}
void drawBlock(int x, int y, fill_styles pattern, int color)
{
setfillstyle(pattern, color);
bar((x + scrX -1) * unitLength + 1 ,
(y + scrY -1) * unitLength + 1 ,
(x + scrX -1) * unitLength + unitLength ,
(y + scrY -1) * unitLength + unitLength);
}
void drawImage(int left, int top, int right, int bottom, char *fileName)
{
readimagefile(fileName, left, top, right, bottom);
}
void gradientStyle1()
{
int b=0;
int g=0;
for (int i=0; i<=W; i+=W/400)
{
for (int j=0; j<=H; j+=W/400)
{
putpixel(i,j,RGB(i,g,b));
g++;
}
b++;
}
}