📄 brewlib.cpp
字号:
MEMSET(m_MultiLine[m_StrlineY], 0 , 30 );
MEMSET(strA, 0 , 3 );
MEMSET(strB, 0 , 2 );
j = STRLEN(Ptstr);
for( i = 0; i < j; i++ )
{
k = Ptstr[i];
if( k < 0 || k > 0x80 ) // 茄臂老锭
{
if ( m_StrlineX > Width-Widthsize )
{
m_StrlineX = 0;
m_StrlineY++;
MEMSET(m_MultiLine[m_StrlineY], 0, 30);
}
MEMCPY( strA, Ptstr+i, 2 );
i++;
STRCAT(m_MultiLine[m_StrlineY], strA);
m_StrlineX += 12;
}
else // 茄臂捞 酒匆锭
{
if( k == '|' && !userinput ) // 茄沫 顿扁
{
m_StrlineX = 0;
m_StrlineY++;
MEMSET(m_MultiLine[m_StrlineY], 0, 30);
continue;
}
if ( m_StrlineX > Width-Widthsize )
{
m_StrlineX = 0;
m_StrlineY++;
MEMSET(m_MultiLine[m_StrlineY], 0, 30);
}
MEMCPY( strB, Ptstr+i, 1 );
STRCAT(m_MultiLine[m_StrlineY],strB);
m_StrlineX += 6;
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 抄荐 惯积 窃荐
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
uint32 MainApp::_RAND(uint32 max)
{
m_Nextseed = m_Nextseed * 1103515245L + 12345;
return((uint32)(m_Nextseed / 65536L) % (max + 1));
}
void MainApp::InitRand()
{
m_Seed = (unsigned long)GET_TIMEMS();
m_Nextseed = m_Seed;
}
uint32 MainApp::_RAND1(uint32 max)
{
m_Nextseed1 = m_Nextseed1 * 1103515245L + 12345;
return((uint32)(m_Nextseed1 / 65536L) % (max + 1));
}
void MainApp::InitRand1()
{
m_Seed1 = (unsigned long)GET_TIMEMS();
m_Nextseed1 = m_Seed1;
}
uint32 MainApp::K_Rand(uint32 max)
{
uint32 rnd;
if( m_Randuse )
{
rnd = _RAND1( max );
m_Randuse = 0;
}
else
{
rnd = _RAND( max );
m_Randuse = 1;
}
return rnd;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 巩磊免仿
// a, b = 荤阿屈 矫累痢
// width, height = 荤阿屈 气,辨捞
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::D_Ktext(int x, int y, const char* ktext, AEEFont Font, uint32 tflag)
{
AECHAR actemp[100];
int len;
MEMSET( actemp, 0, 200 );
len = STRLEN(ktext);
if(!len)
return;
_STR_TO_WSTR(ktext, actemp, len);
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x, y, NULL, tflag );
}
/*
void MainApp::D_Krecttext( int x, int y, int a, int b, int width, int height, char* ktext, AEEFont Font, uint32 tflag )
{
AECHAR actemp[100];
int len;
AEERect jotdo;
MEMSET( actemp, 0, 200 );
len = STRLEN(ktext);
if(!len)
return;
_STR_TO_WSTR(ktext, actemp, len);
SETAEERECT( &jotdo, a, b, width, height );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x, y, &jotdo, tflag );
}
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 皋葛府免仿
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::D_Memory()
{
// IDISPLAY_SetColor(m_pIDisplay, CLR_USER_TEXT, MAKE_RGB(255, 255, 0));
// IDISPLAY_SetColor(m_pIDisplay, CLR_USER_BACKGROUND, MAKE_RGB(0, 0, 0));
// D_TextInt( 5, 2, m_pRam, AEE_FONT_NORMAL, NULL );
// m_FreeRam = IHEAP_GetMemStats(m_pHeap);
// D_TextInt( 5, 12, m_FreeRam, AEE_FONT_NORMAL, NULL );
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AEEchar屈阑 char屈栏肺
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::P_Aechartochar( char* des, AECHAR* src, int len )
{
int i;
int temp;
uint16 subtracter = 0;
MEMCPY(des, src, len );
temp = WSTRLEN(src);
for( i = 0; i < temp*2; i++ )
{
*(des+i-subtracter) = *(des+i);
if( *(des+i-subtracter) == 0x00)
subtracter++;
}
*(des+i-subtracter) = '\0';
}
//void MainApp::P_CharToAECHAR(unsigned char* src, AECHAR* des, int src_len)
//{
// int i = 0;
// for(i = 0 ; i < src_len ; ++i)
// {
// if(*src & 0x80) //茄臂捞搁...
// {
// MEMCPY(des, src, sizeof(AECHAR));
// src += 2;
// }
// else //康巩捞搁...
// {
// *des = *src;
// ++src;
// }
// ++des;
// }
// des = 0;
//}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MainApp::P_PlaySound(int16 ResId)
{
if( m_sound )
{
m_SoundResId = ResId;
if(m_pBrewMedia!=NULL)
{
m_pBrewMedia->Stop();
m_pBrewMedia->Release();
delete m_pBrewMedia;
m_pBrewMedia = NULL;
}
if(m_pBrewMedia==NULL)
{
m_pBrewMedia = new CBrewMedia();
m_pBrewMedia->Init( m_pIShell, AEECLSID_MEDIAMMF, "bullstr.bar", ResId, 100 );
}
if(m_bSoundSleep)
{
m_bSoundSleep = FALSE;
Sleep(300);
}
m_pBrewMedia->Play();
}
}
void MainApp::P_StopSound()
{
if(m_sound)
{
if(m_pBrewMedia)
{
m_pBrewMedia->Stop();
}
}
}
void MainApp::Sleep( int delay )
{
int FirstTime = GET_UPTIMEMS();
int SecondTime;
while(1)
{
SecondTime = GET_UPTIMEMS();
if((SecondTime-FirstTime)>=delay)
break;
}
}
void MainApp::D_KtextBold(int x, int y, const char* ktext, RGBVAL br, RGBVAL fr, AEEFont Font, uint32 tflag)
{
AECHAR actemp[100];
int len;
MEMSET( actemp, 0, 200 );
len = STRLEN(ktext);
if(!len)
return;
_STR_TO_WSTR(ktext, actemp, len);
IDISPLAY_SetColor( m_pIDisplay, CLR_USER_TEXT, fr );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x-1, y, NULL, tflag );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x+1, y, NULL, tflag );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x, y-1, NULL, tflag );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x, y+1, NULL, tflag );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x-1, y-1, NULL, tflag );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x+1, y+1, NULL, tflag );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x-1, y+1, NULL, tflag );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x+1, y-1, NULL, tflag );
IDISPLAY_SetColor( m_pIDisplay, CLR_USER_TEXT, br );
IDISPLAY_DrawText( m_pIDisplay, Font, actemp, -1, x, y, NULL, tflag );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -