36 lines
No EOL
480 B
C
36 lines
No EOL
480 B
C
#ifndef _BLOCK_H_
|
|
#define _BLOCK_H_
|
|
#include <stdlib.h>
|
|
|
|
#define MAX_X 8
|
|
#define MAX_Y 8
|
|
|
|
|
|
//点 结构体
|
|
struct _dot
|
|
{
|
|
unsigned char x;
|
|
unsigned char y;
|
|
} ;
|
|
typedef struct _dot Dot;
|
|
|
|
//块 结构体
|
|
struct _group
|
|
{
|
|
unsigned char used;//拥有的点数量
|
|
unsigned char len; //数组申请内存长度
|
|
Dot* list;
|
|
};
|
|
typedef struct _group Group;
|
|
|
|
void groupInit(Group g,unsigned char i)
|
|
{
|
|
retry:
|
|
g.len=i;
|
|
g.used=0;
|
|
g.list=(Dot*)malloc(sizeof(Dot)*g.len);
|
|
if(!g.list)
|
|
goto retry;
|
|
}
|
|
|
|
#endif |