Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
90
GameTools/NeoRylClient/GUITooltipButton.cpp
Normal file
90
GameTools/NeoRylClient/GUITooltipButton.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
// GUITooltipButton.cpp: implementation of the CGUITooltipButton class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "ClientMain.h"
|
||||
#include "GUITextEdit.h"
|
||||
#include "WinInput.h"
|
||||
#include "GUITooltipButton.h"
|
||||
#include <string.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CGUITooltipButton::CGUITooltipButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CGUITooltipButton::~CGUITooltipButton()
|
||||
{
|
||||
DestroyTooltip();
|
||||
}
|
||||
|
||||
void CGUITooltipButton::InitTooltip(const char *strTooltip)
|
||||
{
|
||||
char seps[] = "\\";
|
||||
char *token;
|
||||
char strTemp[MAX_PATH * 4];
|
||||
char *strTempTooltip;
|
||||
|
||||
DestroyTooltip();
|
||||
|
||||
if(!strcmp(strTooltip, "")) { m_bShow = FALSE; return; }
|
||||
|
||||
strcpy(strTemp, strTooltip);
|
||||
token = strtok(strTemp, seps);
|
||||
|
||||
m_dwMaxLength = 0;
|
||||
unsigned long dwLength;
|
||||
for(;;)
|
||||
{
|
||||
if(!token) break;
|
||||
|
||||
strTempTooltip = new char[strlen(token) + 1];
|
||||
memcpy(strTempTooltip, token, strlen(token));
|
||||
strTempTooltip[strlen(token)] = '\0';
|
||||
dwLength = g_TextEdit.GetStringLength(strTempTooltip) + 4;
|
||||
if(dwLength >= m_dwMaxLength) m_dwMaxLength = dwLength;
|
||||
m_lstTooltip.push_back(strTempTooltip);
|
||||
token = strtok(NULL, seps);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CGUITooltipButton::GetIsTooltip(void)
|
||||
{
|
||||
if(m_lstTooltip.empty())
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CGUITooltipButton::DestroyTooltip(void)
|
||||
{
|
||||
vector<char *>::iterator it;
|
||||
|
||||
for(it = m_lstTooltip.begin(); it != m_lstTooltip.end(); it++)
|
||||
{
|
||||
if((*it)) { delete (*it); (*it) = NULL; }
|
||||
}
|
||||
|
||||
m_lstTooltip.clear();
|
||||
}
|
||||
|
||||
void CGUITooltipButton::Render(LPDIRECT3DDEVICE8 lpD3DDevice)
|
||||
{
|
||||
POINT *ptMousePos = g_DeviceInput.GetMousePosition();
|
||||
unsigned short SizeX = ptMousePos->x + 7;
|
||||
unsigned short SizeY = ptMousePos->y + 11;
|
||||
if(SizeX + m_dwMaxLength + 6 > BaseGraphicsLayer::m_lScreenSx) { SizeX -= (SizeX + m_dwMaxLength + 6) - BaseGraphicsLayer::m_lScreenSx; }
|
||||
if(SizeY + m_lstTooltip.size() * 18 + 6 > BaseGraphicsLayer::m_lScreenSy) { SizeY -= (SizeY + m_lstTooltip.size() * 18 + 6) - BaseGraphicsLayer::m_lScreenSy; }
|
||||
g_ClientMain.m_lpCommonInterface->RenderRect(lpD3DDevice, SizeX, SizeY, SizeX + m_dwMaxLength + 6, SizeY + m_lstTooltip.size() * 18 + 6, 0x00000000, 0x99);
|
||||
|
||||
RECT rcRect;
|
||||
for(long i = 0; i < m_lstTooltip.size(); i++)
|
||||
{
|
||||
::SetRect(&rcRect, SizeX + 3, SizeY + i * 18 + 3, SizeX + m_dwMaxLength, SizeY + i * 18 + 18 + 3);
|
||||
g_TextEdit.DrawText(m_lstTooltip[i], &rcRect, m_dwAlign | DT_VCENTER, D3DCOLOR_RGBA(255, 255, 255, 255));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user