资源简介
2048.rar

代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#define UP 1
#define DOWN 2
#define LEFT 3
#define RIGHT 4
int *plcd = NULL;
char *bmp_name[] =
{
“color_x80_2.bmp“
“color_x80_4.bmp“
“color_x80_8.bmp“
“color_x80_16.bmp“
“color_x80_32.bmp“
“color_x80_64.bmp“
“color_x80_128.bmp“
“color_x80_256.bmp“
“color_x80_512.bmp“
“color_x80_1024.bmp“
“color_x80_2048.bmp“
“color_x80_4096.bmp“
“color_x80_8192.bmp“
“color_x80_16384.bmp“
“color_x80_32768.bmp“
“color_x80_65536.bmp“
“color_x80_131072.bmp“
“color_x80_262144.bmp“
“color_x80_524288.bmp“
};
int matrix[4][4] =
{
0000
0200
0000
0004
};
//
/*
@dis 在坐标为(xy)画一个颜色为color的点
@x 横坐标
@y 纵坐标
@return void
*/
void lcd_draw_point(int x int y int color)
{
*(plcd + x + 800*y) = color;
}
//实现一个函数,在坐标为x0,y0的位置显示一个矩形,宽度为w,高度为h,颜色为color
void lcd_draw_rect(int x0 int y0 int w int h int color)
{
int x y;
for (y = y0; y < y0+h; y++)
{
for (x = x0; x < x0+w; x++)
lcd_draw_point(x y color);
}
}
//在顶点为x0y0画一个n*n的颜色矩阵,每个矩形的大小是w*w//矩形和矩形之间的间隔为dis
void lcd_draw_drect(int x0 int y0 int n int w int dis int color)
{
int i j;
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
lcd_draw_rect(x0+(w+dis)*j y0+(w+dis)*i ww color);
}
}
//在坐标为(x0y0)的位置显示一张100*100的bmp图片
void lcd_draw_bmp(char *file int x0 int y0)
{
//打开bmp图片
int fd;
fd = open(file O_RDWR);
if (-1 == fd)
{
printf(“open %s error !\n“ file);
return ;
}
//读取bmp图片
char pixel[100*100*3 + 54];
read(fd pixel 100*100*3 + 54);
int j = 0x y;
int color;
char r g b;
for (y = 0; y < 100; y++)
{
for (x = 0; x < 100; x++)
{
b = pixel[54 + j];
j++;
g = pixel[54 + j];
j++;
r = pixel[54 + j];
j++;
color = (r << 16) | (g << 8) | b;
lcd_draw_point(x+x0 99-y+y0 color);
}
}
close(fd);
}
char *get_filename_by_digit(int digit)
{
int index;
switch (digit)
{
case 2:
index = 0;
break;
case 4:
index = 1;
break;
case 8:
index = 2;
break;
case 16:
index = 3;
break;
case 32:
index = 4;
break;
case 64:
index = 5;
break;
case 128:
index = 6;
break;
case 256:
index = 7;
break;
case 512:
index = 8;
break;
case 1024:
index = 9;
break;
case 2048:
index = 10;
break;
case 4096:
index = 11;
break;
case 8192:
index = 12;
break;
case 16384:
index = 13;
break;
case 32768:
index = 14;
break;
case 65536:
index = 15;
break;
case 131072:
index = 16;
break;
case 262144:
index = 17;
break;
case 524288:
index = 18;
break;
default:
index = 0;
break;
}
return bmp_name[index];
}
void lcd_draw_matrix(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 134853 2017-04-18 21:47 2048\2048黑框框版.exe
文件 4268 2017-04-18 21:36 2048\2048黑框框版.c
文件 30054 2017-04-18 20:47 2048\图片\color_x80_524288.bmp
文件 30054 2017-04-18 20:44 2048\图片\color_x80_2.bmp
文件 30054 2017-04-18 20:44 2048\图片\color_x80_4.bmp
文件 30054 2017-04-18 20:45 2048\图片\color_x80_8.bmp
文件 30054 2017-04-18 20:45 2048\图片\color_x80_16.bmp
文件 30054 2017-04-18 20:45 2048\图片\color_x80_32.bmp
文件 30054 2017-04-18 20:45 2048\图片\color_x80_64.bmp
文件 30054 2017-04-18 20:45 2048\图片\color_x80_128.bmp
文件 30054 2017-04-18 20:46 2048\图片\color_x80_256.bmp
文件 30054 2017-04-18 20:46 2048\图片\color_x80_512.bmp
文件 30054 2017-04-18 20:46 2048\图片\color_x80_1024.bmp
文件 30054 2017-04-18 20:46 2048\图片\color_x80_2048.bmp
文件 30054 2017-04-18 20:46 2048\图片\color_x80_4096.bmp
文件 30054 2017-04-18 20:46 2048\图片\color_x80_8192.bmp
文件 30054 2017-04-18 20:46 2048\图片\color_x80_16384.bmp
文件 30054 2017-04-18 20:47 2048\图片\color_x80_32768.bmp
文件 30054 2017-04-18 20:47 2048\图片\color_x80_65536.bmp
文件 30054 2017-04-18 20:47 2048\图片\color_x80_131072.bmp
文件 30054 2017-04-18 20:47 2048\图片\color_x80_262144.bmp
文件 30054 2017-04-18 21:21 2048\图片\false.bmp
文件 9743 2017-04-18 21:44 2048\2048linux.c
文件 643 2017-04-29 15:40 2048\算是笔记吧.txt
目录 0 2017-04-17 21:36 2048\图片
目录 0 2017-04-18 21:54 2048
----------- --------- ---------- ----- ----
750587 26
- 上一篇:天然水侵量的计算程序
- 下一篇:学生信息管理系统.txt
相关资源
-
开机速度优化工具Startup Dela
yer3.0中 - tomcat 8.0 32位 绿色版
- 四路抢答器
- SolidWorks-100多个
- delphi源码-检测是否运行了多个程序
- 希捷硬盘套件助系统构建商把握Vist
- 可以在XE下使用的DosCommand,捕获控制
- 如何使用VC和OD调试OCX控件
- 计算机三级-网络技术-第4大题题库-共
- 雷柏v700s机械键盘驱动 v1.0.0.1 官方版
- weui手机商城模板在线
- BMA250手册word和PDF(博文配到资源)
- Delphi时钟助手源码,定时关机、提醒
- Cisco无线AP全部配置文件(AIR-1200系列
- 安卓手机PC端一键重启工具
- ManualIciMapping_v3.1
- 集客9341固件ap
- 遍历USB设备,获取USB序列号
- delphi源码-实现软件注册机
- Microservices_Designing_Deploying
-
Design for em
bedded Image Processing on FPG - GNU/Linux系统开发者需要从桌面突破
- Concurrency in Go(EarlyRelease) 无水印p
- cfx中ccl语言使用手册
- 单元测试一条龙1.50final
- 金丰300T级进冲床电气控制原理图1
- DSP实验(10次实验有详细步骤)
- HP Compaq 8200 Elite 系列商用台式机
- 2019年软考高级下半年信息系统项目管
- Assembly Language for x86 Processors (7th Ed
评论
共有 条评论