You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
1.4 KiB
101 lines
1.4 KiB
#define __LIBRARY__
|
|
#include<stdio.h>
|
|
#include<unistd.h>
|
|
#include<stdlib.h>
|
|
#include<errno.h>
|
|
#include<time.h>
|
|
#include<linux/tty.h>
|
|
#define vga_graph_memstart 0xA0000
|
|
#define vga_graph_memsize 64000
|
|
#define cursor_side 6
|
|
#define vga_width 320
|
|
#define vga_height 200
|
|
|
|
#define BIRD_X 120
|
|
#define BIRD_Y 100
|
|
#define BIRD_WIDTH 10
|
|
#define BIRD_HEIGHT 8
|
|
#define MAX 40
|
|
|
|
char *p;
|
|
int i,j,x_pos,y_pos,k;
|
|
struct message *msg;
|
|
int cnt;
|
|
int bird_y;
|
|
int px[MAX];
|
|
int py[MAX];
|
|
int h[MAX];
|
|
char *pp;
|
|
int ii,jj;
|
|
int nn;
|
|
|
|
_syscall0(int,init_graphics)
|
|
_syscall1(int,get_message,struct message * ,msg)
|
|
_syscall3(int,repaint,int ,x,int ,y,int ,h)
|
|
int main()
|
|
{
|
|
x_pos=20;
|
|
y_pos=20;
|
|
bird_y=BIRD_Y;
|
|
init_graphics();
|
|
px[0]=BIRD_X;
|
|
py[0]=bird_y;
|
|
h[0]=BIRD_HEIGHT;
|
|
cnt=30;
|
|
for(i=1;i<cnt;i++)
|
|
{
|
|
if(i%2==0)
|
|
{
|
|
px[i]=120+20*i;
|
|
py[i]=0;
|
|
h[i]=90+i*2;
|
|
}
|
|
else
|
|
{
|
|
px[i]=30+20*i;
|
|
h[i]=h[i-1]-13*i%17;
|
|
py[i]=200-1-h[i];
|
|
}
|
|
}
|
|
msg=NULL;
|
|
nn=50;
|
|
while(--nn)
|
|
{
|
|
repaint(px[0],py[0],h[0]);
|
|
for(i=1;i<cnt;i++)
|
|
{
|
|
px[i]-=20;
|
|
repaint(px[i],py[i],h[i]);
|
|
}
|
|
k=3;
|
|
while(k>0)
|
|
{
|
|
--k;
|
|
get_message(msg);
|
|
if(msg!=NULL)py[0]-=10;
|
|
sleep(2);
|
|
}
|
|
sleep(4);
|
|
for(k=1;k<cnt;k++)
|
|
{
|
|
if(k%2==0)
|
|
if(px[0]+6>px[k] && px[0]+6<px[k]+10 && py[0]<h[k])
|
|
{
|
|
repaint(44,44,44);
|
|
return 0;
|
|
}else{
|
|
if(px[0]+6>px[k] && px[0]+6<px[k]+10 && py[0]+6+h[k]>199)
|
|
{
|
|
repaint(44,44,44);
|
|
return 0;
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
repaint(44,44,44);
|
|
return 0;
|
|
}
|
|
|