tst3.cpp
来自「英创386的LCD控制协议和函数,还有例程」· C++ 代码 · 共 108 行
CPP
108 行
/*//////////////////////////////////////////////////////////////////////////
Orgnization: Emtronix Incorporated
Filename: TST1.CPP
Compiler: BC3.1
Authors: Wang Ping
Date: April, 2001
Revised: ...
Description: This is a test routine for 128X64 DOT_LCD
///////////////////////////////////////////////////////////////////////////*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <graphics.h>
#include <string.h>
#include <math.h>
#include "lcd_api.h"
#include "key.h"
#include "menu.h"
void ScreenWelcome( );
int main()
{
int status;
KEY key;
status = MENUManager.SysMenuInit( );
if( status < 0 ) return status;
ScreenWelcome( );
MENUManager.ShowMenu( 0 );
for(;;)
{
key = GetKey( );
switch( key )
{
case _Up:
MENUManager.MenuItemBarUp( );
break;
case _Down:
MENUManager.MenuItemBarDn( );
break;
case _Left:
MENUManager.MenuItemInc( );
break;
case _Right:
MENUManager.MenuItemDec( );
break;
case _Enter:
MENUManager.MenuDrivedManualPro( );
break;
case _Esc:
MENUManager.AbnormalPro( );
break;
case _Add:
MENUManager.MenuItemINC( );
break;
case _Minus:
MENUManager.MenuItemDEC( );
break;
}
}
return 0;
}
void ScreenWelcome( )
{
// goto graghic mode
int x, y;
/* initialize graphics mode */
LCD_Init( "mlib.chr", "ascii.chr" );
LCD_SetMode( 1 ); // set to XOR mode
// show chinese char at center position
char BufStr[20];
strcpy( BufStr, "** 欢迎测试 **" );
x = (128-strlen(BufStr)*8)/2;
y = 8;
LCD_WriteString( x, y, BufStr, 1 );
//_Writestring( x, y, BufStr, LCD_BACK, LCD_DOT );
strcpy( BufStr, "嵌入式网络模块" );
x = (128-strlen(BufStr)*8)/2;
y = 24;
LCD_WriteString( x, y, BufStr, 0 );
// draw lines
LCD_DrawLine( 0, 42, 127, 42, 1 );
LCD_DrawLine( 0, 63, 127, 63, 1 );
// draw curve
for( x=0; x<128; x++ )
{
y = 53 - 10.0*sin( 2.0*M_PI*x/24.0 );;
LCD_PutPixel( x, y, 1 );
}
// exit
getch( );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?