Beispiel #1
0
void CmdHelper::PostJsonDatasToRpc()
{
	TCHAR strFileName[MAX_PATH];
	if(acedGetString(0, _T("请指定数据文件名称:"), strFileName) != RTNORM) return;

	std::ifstream infile(W2C(strFileName));
	if(!infile) return;

	//有些请求可能需要传递给cad一些参数
	std::string input_datas = "{}";
	infile >> input_datas;

	//服务器生成的密钥
	std::string secret_key = "#";
	infile >> secret_key;
	infile.close();

	acutPrintf(_T("\n1:%s\n2:%s"), C2W(input_datas), C2W(secret_key));
	if(secret_key == "#") return;

	// 收集数据(根据input_datas的内容进行判断:input_datas是一个json数据)

	//发送rpc服务器进行缓存
	std::string out_datas = "{'name':'dlj'}";
	CbmClientHelper::PostJsonDatasFromCAD(secret_key, input_datas, out_datas);
}
Beispiel #2
0
 void AnsiToUtf8(char** dest, const char* src)
 {
	ASSERT(dest!= NULL || src != NULL);
	WCHAR* pwszStr = NULL;
	C2W(&pwszStr, src);
	UnicodeToUtf8(dest, pwszStr);
	SAFE_ARRYDELETE(pwszStr);
 }
Beispiel #3
0
bool xaeBlockScene::render()
{
    if(m_pNake != NULL) m_pNake->render();
    for(int i = 0; i < g_Setting.Block.m_nBlockRowCount; i++)
    {
        for(int j = 0; j < g_Setting.Block.m_nBlockColCount; j++)
        {
            if(m_bClothes[i][j])
            {
                m_pCloth->get_sprite()->SetTextureRect(j * g_Setting.Block.m_nBlockWidth, i * g_Setting.Block.m_nBlockHeight, g_Setting.Block.m_nBlockWidth, g_Setting.Block.m_nBlockHeight);
                m_pCloth->render(j * g_Setting.Block.m_nBlockWidth, i * g_Setting.Block.m_nBlockHeight);
            }
        }
    }

    m_Treasure.render();
    for(size_t i = 0; i < m_dwFlapNum; i++)
    {
        m_pFlap->render(m_fFlapX + i * g_Setting.Block.m_nFlapLength, m_fFlapY);
    }
#ifdef __DEBUG
    if(g_bDebugStop)
    {
        g_pDebugFont->Print(m_fFlapX, m_fFlapY, "(%d, %d)", (int)m_fFlapX, (int)m_fFlapY);
    }
#endif
    //m_pBall->render(m_fBallX, m_fBallY);
    m_pBall->render_stretch(m_fBallX - g_Setting.Block.m_nBallLength / 2, m_fBallY - g_Setting.Block.m_nBallLength / 2, m_fBallX + g_Setting.Block.m_nBallLength / 2, m_fBallY + g_Setting.Block.m_nBallLength / 2);
#ifdef __DEBUG
    if(g_bDebugStop)
    {
        g_pDebugFont->Print(m_fBallX, m_fBallY, "(%d, %d)", (int)m_fBallX, (int)m_fBallY);
    }
#endif

    if(m_emStatus == XBPS_LOSE)
    {
        m_pLoseBG->render();
    }

    m_pGUI->render(0, 0);

    /** 剩余砖块 */
    char szScore[16];
    sprintf(szScore, "%d", m_dwBlockLeft);
    m_pScoreFont->printf(700, 80, HGETEXT_CENTER, szScore);

    /** 关卡 */
    char szLevel[128];
    sprintf(szLevel, "Level %s", m_szLevelName.c_str());
    SIZE levelFontSize = m_pLevelFont->GetTextSize(C2W(szLevel));
    m_pLevelFont->Print(600 + (200 - levelFontSize.cx) / 2, 155, szLevel);

    xaeGUIObject::render_mouse();

    return false;
}
Beispiel #4
0
void C2T(TCHAR** dest, const char* src)
{
#ifdef _UNICODE
	C2W(dest, src);
#else 
	//多字节TCHAR就是 char 
	int len = strlen(src)+1;
	*dest = new char[len];
	strcpy(*dest, src);
#endif
}
Beispiel #5
0
xaeGUITextButton::xaeGUITextButton(int id, string key, string path_format, int x, int y, string text, string font_name /* =  */, int font_size /* = 12 */, DWORD font_color /* = 0xff000000 */, DWORD font_hover_color /* = 0xff000000 */, bool bold /* = false */, bool italian /* = false */, bool anti /* = true */, string sound_hover /* =  */, string sound_click /* =  */, string enter_mouse /* = */ ) :
    xaeGUIButton(id, key, path_format, x, y, sound_hover, sound_click, enter_mouse),
    m_szText(text),
    m_dwColor(font_color),
    m_dwHoverColor(font_color)
{
    m_pFont = new xaeFont(font_name.c_str(), font_size, bold, italian, anti);

    SIZE sz = m_pFont->GetTextSize(C2W(text.c_str()));
    m_szTextPos.cx = (m_tagRect.x2 - m_tagRect.x1 - sz.cx) / 2;
    m_szTextPos.cy = (m_tagRect.y2 - m_tagRect.y1 - sz.cy) / 2;
}
Beispiel #6
0
void xaeAVGTextbox::render()
{
    /** 对话框 */
    if(m_szCurrentTalker != "" || m_szDisplayTextBuffer != "")
    {
        m_pTextbox->render();
    }

    /** 说话者 */
    if(m_szCurrentTalker != "")
    {
        SIZE m_szTalkerSize = m_pTalkerFont->GetTextSize(C2W(m_szCurrentTalker.c_str()));
        int left = g_Setting.AVG.m_nTalkerLeft + (g_Setting.AVG.m_nTalkerRight - g_Setting.AVG.m_nTalkerLeft - m_szTalkerSize.cx) / 2;
        m_pTalkerFont->Printf(left, g_Setting.AVG.m_nTalkerTop, C2W(m_szCurrentTalker.c_str()));
    }

    /** 文本 */
    if(m_szDisplayText != "")
    {
        m_pTextFont->Printf(g_Setting.AVG.m_nTextLeft, g_Setting.AVG.m_nTextTop, C2W(formatTextboxString(m_szDisplayText).c_str()));
    }
}
Beispiel #7
0
void xaeGUITextButton::on_render(int x, int y)
{
    xaeGUIButton::on_render(x, y);

    if(this->get_mouse_capture_control() == this)
    {
        m_pFont->SetColor(m_dwHoverColor);
    }
    else m_pFont->SetColor(m_dwColor);

    m_pFont->Printf(x + m_tagRect.x1 + m_szTextPos.cx, y + m_tagRect.y1 + m_szTextPos.cy, C2W(m_szText.c_str()));
}