前期工作打好了基础,都已经可以画图了,想要显示鼠标和字符知识需要一个字库就可以了。
一、显示字符
新建一个文件夹,叫做font文件夹,以后我们还要增加中文字体的显示等,这样会比较条理。文件夹下新建font.c,font.h,font_code.c,font.c是对显示文字进行操作的一些函数,font_code.c保存有字库数组,font.h头文件。
显示字符的理论非常的简单,首先需要一个字库,我把我使用的字库直接传上来了,百度文库下载的,嫌不好看的可以百度字模生成软件,自己生成想要的字体。把这个字库保存在font_code.c,不要忘记声明头文件。
#include "font.h"
const char font_code_global[94][16]={
//Ó¢ÎÄ»ò±êµã·ûºÅ //0x21 -- 0x7e
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x80,},//!
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xa0,0xa0,},//"
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0x28,0xfc,0x28,0x50,0xfc,0x50,0x50,},//#
{
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x78,0xa8,0xa0,0x60,0x30,0x28,0xa8,0xf0,0x20,},//$
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0xa8,0xb0,0x50,0x28,0x34,0x54,0x48,},//%
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x50,0x78,0xa8,0xa8,0x90,0x6c,},//&
{
0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,},//'
{
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x20,},//(
{
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80,},//)
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0x70,0xa8,0x20,},//*
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0xf8,0x20,0x20,0x20,},//+
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,},//,
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,},//-
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,},//.
{
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,},///
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,},//0
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xc0,0x40,0x40,0x40,0x40,0x40,0xe0,},//1
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x40,0x80,0xf8,},//2
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,},//3
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x30,0x50,0x50,0x90,0x78,0x10,0x18,},//4
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x80,0x80,0xf0,0x08,0x08,0x88,0x70,},//5
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x90,0x80,0xf0,0x88,0x88,0x88,0x70,},//6
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x90,0x10,0x20,0x20,0x20,0x20,0x20,},//7
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,},//8
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x48,0x70,},//9
{
0x0