⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gui.c

📁 《嵌入式Linux应用开发详解》中的源代码
💻 C
字号:
/* gui.c: Graphics demos
 * 
 *	Programmed By Chen Yang (support@hhcn.com)
 *	
 * 	
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */
#include "gui.h"

main(int argc,char*argv[])
{
   short i,j,w,h;	
   PatternIndex p=BlackPattern;
   char buf[512];
   if(initgraph())
   {
   if(argc>1)
   {
	ShowBMP(argv[1]);
	for(i=1;i<160;i++)
	{
		V_scroll_screen(1);
	}
	ShowBMP(argv[1]);
	for(i=1;i<160;i++)
	{
		V_scroll_screen(-1);
	}
 	textout(0,0,"Press Enter To Show File.");	   
	ShowBMP(argv[1]);
	
	for(i=1;i<160;i++)
	{
	  H_scroll_screen(1);
	}
	ShowBMP(argv[1]);
	for(i=1;i<160;i++)
	{
	  H_scroll_screen(-1);
	}
   }
   clearscreen();
   for(;p<InvalidPattern;p++) 
   {
   setfillpattern(p);	   
   sprintf(buf,"%d",p);
   textout(120,0,buf);
   fillrect(0,0,120,120);
   }
   clearscreen();
   
   textout(0,0,"华恒科技");
   
   for(i=0;i<16;i++)
     memcpy(buf+i*8,0x400+i*20,8);	     
    
   for(i=0;i<16;i++)
     memcpy(0x400+320+i*20,buf+i*8,8);	     
   	    
   srand(0);
   for(;;)
   {
     i=rand()%160;
     j=rand()%160;
     if(i<96)
       if(j<144)
         bitblt(0,0,64,16,i,j,buf,8,0x400,20);	     
     else
       if(j>=144)     
 	bitblt(0,0,64,159-j,i,j,buf,8,0x400,20);
     else
       if(j<144)
         bitblt(0,0,159-i,j,i,j,buf,8,0x400,20);	     
     else
       if(j>=144)     
 	bitblt(0,0,159-i,159-j,i,j,buf,8,0x400,20);
   }
   closegraph();
   } 
}

⌨️ 快捷键说明

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