This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/MCU/MCU_REAL _FINAL/block.h

36 lines
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