paint.c

来自「嵌入式系统基础课件」· C语言 代码 · 共 29 行

C
29
字号
#include "libepc.h"
#include "tetris.h"

#define	BLOCK		0xDB

/* ------------------------------------------------------------ */
/* Paints the tetris object whose upper left corner is at row,	*/
/* col, with rotation rot, using color clr.  If on is TRUE, it	*/
/* paints the object; if on is FALSE, it erases the object.	*/
/* ------------------------------------------------------------ */
void PaintObject(int row, int col, int rot, BOOL on, char clr)
	{
	WORD16 cell ;
	int r ;

	cell = on ? CELL(BLOCK, clr) : EMPTY ;
	for (r = 0; r < 2; r++)
		{
		int c ;

		for (c = 0; c < 4; c++)
			{
			if (!On(rot, r, c)) continue ;
			*Cell(row + r, col + c) = cell ;
			}
		}
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?