📄 brewlib.cpp
字号:
//===========================================================================================
// (林)葛府家橇飘
// 累己磊 : 辫肯荐
// 汲疙 : 扼捞宏矾府, 霸烙父甸锭 亲惑 静霸登绰 窃荐甸 葛澜
// 颇老 : cpp 颇老
//===========================================================================================
#include "MainApp.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 捞固瘤 救傈 肺爹
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::P_ImgLoad( KImage** kimg, const char* barfile, uint32 imgid, int form )
{
if( *kimg != NULL )
return;
*kimg = CImg->LoadImg( barfile, imgid, form );
}
int MainApp::Abs(int abs)
{
if(abs < 0)
abs = abs*(-1);
return abs;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 咆胶飘 救傈 肺爹
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::P_StrLoad( int strid )
{
ISHELL_LoadResString( m_pIShell, "bullstr.bar", strid, m_aContents, 300 );
P_Aechartochar( m_cContents, m_aContents, 300 );
StrProcess( m_cContents, 0, FALSE );
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 涝仿茄 祸彬蔼栏肺 荤阿屈阑 弊赴促.
// flag=TRUE(祸阑 盲况辑 弊覆) , flag=FALSE( 抛滴府父 弊覆 )
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::FillRect(int x, int y, int width, int height, int r, int g, int b, boolean flag)
{
AEERect temprect;
SETAEERECT( &temprect, x, y, width, height );
if(flag)
IDISPLAY_FillRect( m_pIDisplay, &temprect, MAKE_RGB( r, g, b) );
else
IDISPLAY_DrawRect( m_pIDisplay, &temprect, MAKE_RGB(r, g, b), 0, IDF_RECT_FRAME );
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Int箭磊甫 拳搁俊 免仿
// Rect绰 谅快沥纺 东矫, Rect谅钎甫 涝仿秦具达
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
void MainApp::D_TextInt( int x, int y, int value, AEEFont Font, uint32 Textflag )
{
char sz[20];
AECHAR szBuf[40];
SPRINTF(sz,"%d",value);
STR_TO_WSTR(sz,szBuf,sizeof(sz));
IDISPLAY_DrawText(m_pIDisplay, Font,(AECHAR*)szBuf ,-1, x, y, NULL,Textflag );
}
void MainApp::D_RectInt( int x, int y, int a, int b, int width, int height, int value, AEEFont Font, uint32 Textflag )
{
char sz[10];
AECHAR szBuf[10];
AEERect jotdo;
SETAEERECT( &jotdo, a, b, width, height );
SPRINTF(sz,"%d",value);
STR_TO_WSTR(sz,szBuf,sizeof(sz));
IDISPLAY_DrawText( m_pIDisplay, Font, (AECHAR*)szBuf , -1, x, y, &jotdo, Textflag );
}
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 荤阿屈阑 弊覆
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::D_Rect( int x, int y, int width, int height, RGBVAL rgb, RGBVAL rgb1, uint32 dwflags )
{
AEERect rct;
SETAEERECT( &rct, x, y, width, height );
IDISPLAY_DrawRect( m_pIDisplay, &rct , rgb, rgb1, dwflags);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 涝仿茄 祸栏肺 扼牢阑 弊覆
// Horizon=TRUE(荐乞急) , Horizon=FALSE(荐流急)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::D_MultLine(int x, int y, int len, int r, int g, int b, boolean Horizon)
{
AEELine templine;
IGRAPHICS_SetColor( m_pIgraphics, r, g, b, 0);
templine.sx = x;
templine.sy = y;
if(Horizon)
{
templine.ex = x+len;
templine.ey = y;
IGRAPHICS_DrawLine( m_pIgraphics, &templine);
}
else
{
templine.ex = x;
templine.ey = y+len;
IGRAPHICS_DrawLine( m_pIgraphics, &templine);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 沥盔阑 弊覆
// rad -- 馆瘤抚
// flag == TRUE 捞搁 盔阑 盲框
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
void MainApp::D_Circle(int x, int y, int rad, uint8 r, uint8 g, uint8 b, boolean fill)
{
AEECircle cir;
cir.cx=x;
cir.cy=y;
cir.r=rad;
if(fill==TRUE)
IGRAPHICS_SetFillColor(m_pIgraphics, r,g,b, 0);
IGRAPHICS_SetColor( m_pIgraphics, r, g, b, 0);
IGRAPHICS_SetFillMode(m_pIgraphics, fill);
IGRAPHICS_SetPaintMode(m_pIgraphics, AEE_PAINT_COPY);
IGRAPHICS_DrawCircle(m_pIgraphics, &cir);
if(fill==TRUE) IGRAPHICS_SetPaintMode(m_pIgraphics, AEE_PAINT_XOR);
else IGRAPHICS_SetPaintMode(m_pIgraphics, AEE_PAINT_COPY);
}
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 鸥盔阑 弊覆
//
// fill == TRUE 捞搁 盔阑 盲框
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
void MainApp::D_Ellipse(int x, int y, int wd, int hg, uint8 r, uint8 g, uint8 b, boolean fill)
{
AEEEllipse ellipse;
ellipse.cx=x;
ellipse.cy=y;
ellipse.wx=wd;
ellipse.wy=hg;
if(fill==TRUE) IGRAPHICS_SetFillColor(m_pIgraphics, r,g,b, 0);
IGRAPHICS_SetColor( m_pIgraphics, r, g, b, 0);
IGRAPHICS_SetFillMode(m_pIgraphics, fill);
IGRAPHICS_DrawEllipse(m_pIgraphics, &ellipse);
IGRAPHICS_SetPaintMode(m_pIgraphics, AEE_PAINT_COPY);
}
*/
/*
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 滚欺俊 单捞磐 波郴绊 持绰 窃荐
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// --------巩磊凯阑 罐酒坷绊 辨捞甫 府畔窃---------
int MainApp::GetStr(char destbuf[], byte srcbuf[],int ind, int bufsize)
{
int templen;
MEMSET( destbuf, 0, bufsize);
templen = srcbuf[ind];
MEMCPY( destbuf, &srcbuf[ind+1], templen );
destbuf[templen] = '\0';
return templen+1;
}
//-----菊俊 茄官捞飘俊 巩磊凯狼 辨捞甫 呈林绊 促澜俊 巩磊凯阑 持绢淋--------------
int MainApp::PutBytes( int ind, char* str)
{
int temp;
temp = STRLEN(str);
CNetwork->m_Sendbuf[ind] = temp;
MEMCPY(&CNetwork->m_Sendbuf[ind+1], str, temp);
return temp+1+ind;
}
*/
/*
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 傈拳 锅龋 舅酒郴坷绰 窃荐
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::Get_myPhoneNum()
{
#ifdef AEE_SIMULATOR
char PhoneNo[] = "01625627779";
MEMCPY(m_PhoneNum, PhoneNo, 11);
#else
ITAPI *pITAPI;
TAPIStatus status;
// 迄锅龋 啊廉坷扁
if( ISHELL_CreateInstance(m_pIShell, AEECLSID_TAPI, (void **)&pITAPI) == SUCCESS)
{
ITAPI_GetStatus(pITAPI, &status); // status.szMobileID啊 Phone Number
ITAPI_Release(pITAPI);
pITAPI = NULL;
}
MEMCPY(m_PhoneNum, status.szMobileID, 11);
#endif
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// char屈阑 AEEchar屈栏肺 茄臂 免仿矫
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::_STR_TO_WSTR(const char* szIn, AECHAR* wszOut, int nLen)
{
byte *lpSrc = (byte*)szIn;
byte *lpDest= (byte*)wszOut;
if ( szIn == NULL || wszOut == NULL ) return;
if ( nLen == 0 ) return;
while( *lpSrc&& (((AECHAR*)lpDest-wszOut) < nLen))
{
if( *lpSrc >=0x80 ) // 茄臂内靛
{
*lpDest++ = *lpSrc++;
*lpDest++ = *lpSrc++;
}
else
{ // ANSI 内靛
*lpDest++ = *lpSrc++;
*lpDest++ = 0;
}
}
*lpDest++ = 0;
*lpDest = 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 变巩磊凯阑 涝仿茄 拳搁 农扁俊 嘎霸 临寸巩磊硅凯俊 呈绢霖促.
// 窃荐甫 静扁傈俊 临荐甫 悸泼 m_StrlineY
// Widthsize:LCD承捞俊辑 茄临狼 承捞甫 猾蔼 涝仿
// userinput:蜡历啊 涝仿窍搁 临 扒呈顿扁甫 利侩救窃
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::StrProcess( char* Ptstr, int Widthsize, boolean userinput )
{
char k;
char strA[3];
char strB[2];
uint32 i;
uint32 j;
m_StrlineX = 0;
m_StrlineY = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -