Hi folks!
With this guide you will be able to combine textlines with images, like rubinum does.
Bitte melden Sie sich an, um diesen Link zu sehen.
Bitte melden Sie sich an, um diesen Link zu sehen.
Usage is simple:
The files are located in the icon pack, so basically the code will load from icon/{GIVEN_PATH}.tga - in the sample the path for the X is: icon/emoji/key_x.tga
Here are the images from rubinum client:
1.) Open EterLib/TextTag.h and add the new tags into the enum there:
2.1.) Open the EterLib/TextTag.cpp and extend the GetTextTag function with the following statements:
2.2.) Extend the GetTextTagOutputString function with the following statements:
2.3.) Repeat the 2.2. in the GetTextTagInternalPosFromRenderPos function:
2.4.) Repeat again in the GetTextTagOutputLen function too:
3.1.) Open EterLib/GrpTextInstance.h and add the following line at the top of the file where the includes are:
3.2.) Add the following struct below of the SHyperlink struct:
3.3.) Below of the m_hyperlinkVector declaration declare a new variable:
4.1.) Open EterLib/GrpTextInstance.cpp and add the following line at the top of the file, where the includes are:
4.2.) In the CGraphicTextInstance::Update function add the following below of this line: m_hyperlinkVector.clear();
4.3.) This is a bit complicated, so first of all look for this line:
This is the else for the Arabic codepage, I could not test it on it, so I didn't make it to arab rtl style.
4.4.) Add the following below of this line: std::wstring hyperlinkBuffer;
4.5.) Replace this
With this
4.6.) Then add the new processor for the new tags:
- else if (ret == TEXT_TAG_EMOJI_START)
- {
- emojiStep = 1;
- emojiBuffer = L"";
- }
- else if (ret == TEXT_TAG_EMOJI_END)
- {
- kEmoji.x = x;
- char retBuf[1024];
- int retLen = Ymir_WideCharToMultiByte(GetDefaultCodePage(), 0, emojiBuffer.c_str(), emojiBuffer.length(), retBuf, sizeof(retBuf) - 1, NULL, NULL);
- retBuf[retLen] = '\0';
- char szPath[255];
- snprintf(szPath, sizeof(szPath), "icon/%s.tga", retBuf);
- if (CResourceManager::Instance().IsFileExist(szPath))
- {
- CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(szPath);
- kEmoji.pInstance = CGraphicImageInstance::New();
- kEmoji.pInstance->SetImagePointer(pImage);
- m_emojiVector.push_back(kEmoji);
- memset(&kEmoji, 0, sizeof(SEmoji));
- for (int i = 0; i < pImage->GetWidth() / (pSpaceInfo->width-1); ++i)
- x += __DrawCharacter(pFontTexture, dataCodePage, ' ', dwColor);
- if (pImage->GetWidth() % (pSpaceInfo->width - 1) > 1)
- x += __DrawCharacter(pFontTexture, dataCodePage, ' ', dwColor);
- }
- emojiStep = 0;
- emojiBuffer = L"";
- }
4.7.) Add the following code to the end of the CGraphicTextInstance::Render function:
- if (m_emojiVector.size() != 0)
- {
- for (std::vector<SEmoji>::iterator itor = m_emojiVector.begin(); itor != m_emojiVector.end(); ++itor)
- {
- SEmoji & rEmo = *itor;
- if (rEmo.pInstance)
- {
- rEmo.pInstance->SetPosition(fStanX + rEmo.x, (fStanY + 7.0) - (rEmo.pInstance->GetHeight() / 2));
- rEmo.pInstance->Render();
- }
- }
- }
4.8.) Add the following into the CGraphicTextInstance::Destroy function:
Have fun
Sorry for arab players :P, for sure they have also developers, so let's go guys, finish it