Fix C++: Solucionar Botones Duplicados y "Sombras" en Interfaz Custom (MuHelper) - Source Mu - Mu Server Files
 

Fix C++: Solucionar Botones Duplicados y "Sombras" en Interfaz Custom (MuHelper)

Publicado por Dakosmu, Abr 22, 2026, 08:29 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Keywords CMacroUIEx.cppFix

Dakosmu

Fix C++: Solucionar Botones Duplicados y "Sombras" en Interfaz Custom (MuHelper)


Regístrate para ver el enlace


Aprende a solucionar el molesto error visual de los botones duplicados o "sombras fantasma" al desarrollar tu interfaz custom en Mu Online. En este breve tutorial en C++ limpiaremos la función de renderizado para que tu MuHelper luzca profesional y sin gráficos superpuestos.

Síntoma: Al compilar tu main.exe y abrir el juego, notas que los botones del MuHelper (Play, Pause, Config) se ven estirados, sucios o tienen una textura nativa dibujada justo por debajo de tu nuevo diseño.

¿Por qué ocurre esto? Este bug visual pasa cuando dejas el código de renderizado original del juego (RenderBitmap o gInterface.DrawButtonRender) mezclado con tu nuevo sistema de botones (gCMacroUIEx.Drawbutton). El motor gráfico dibuja tu botón nuevo y, acto seguido, dibuja el viejo encima o debajo.

Como siempre, te recomendamos hacer un respaldo de tu archivo CMacroUIEx.cpp en tu entorno de desarrollo antes de borrar bloques grandes de código.

Instrucciones Paso a Paso:

  • Abre tu Source en Visual Studio y dirígete al archivo CMacroUIEx.cpp.
  • Presiona CTRL+F y busca la función principal encargada de dibujar la barra:
    void CMacroUIEx::RenderFrame(int *This)
  • Debes reemplazar toda esa función. Hemos limpiado los gráficos viejos, pero mantuvimos la lógica del OffHelper, el botón de Menú y los textos flotantes (ToolTips). Reemplaza tu función actual con la siguiente:

void CMacroUIEx::RenderFrame(int This)
{
char Cord[256];
float X = (double)((DWORD )This + 5);
float Y = (double)((signed int *)This + 6);
float renderMenu = 15.0f;
EnableAlphaTest(1);
glColor4f(1.0, 1.0, 1.0, 1.0);
renderMenu = 10.0f;

// 1. Dibuja el fondo de la interfaz
gCMacroUIEx.DrawFrame(0xF3001, X + 135, Y, 186, 30, 502, 0, 1024, 256, 1.5 / pWinWidthReal, 1.5 / pWinHeightReal);
gCMacroUIEx.DrawFrame(0xF3001, X, Y, 232, 37, 270, 0, 1024, 256, 1.5 / pWinWidthReal, 1.5 / pWinHeightReal);

// 2. Botón Especial Menu (Restaurado sin duplicar)
gInterface.DrawButtonRender(eMenu, X + 137.0f + renderMenu, Y + 7.0 , 0, 0.0f);
if (gInterface.IsWorkZone(eMenu))
{
    gInterface.DrawToolTip(X + 137.0f + renderMenu, Y + 30, "Especial Menu");
    if (gInterface.Data[eMenu].OnClick)
    {
        RenderBitmap(51553, X + 137.0f + renderMenu, Y + 7.0, 19, 19, 0.0, 0.451f, 0.878, 0.225, 1, 1, 0.0);
    }
    else
    {
        RenderBitmap(51553, X + 137.0f + renderMenu, Y + 7.0, 19, 19, 0.0, 0.2255f, 0.878, 0.225, 1, 1, 0.0);
    }
}
else
{
    RenderBitmap(51553, X + 137.0f + renderMenu, Y + 7.0, 19, 19, 0.0, 0.0, 0.878, 0.225, 1, 1, 0.0);
}

// 3. Botones NUEVOS (Config y Auto) con sus Textos Flotantes
gCMacroUIEx.Drawbutton(gCMacroUIEx.macroConfig, "");
if (gCMacroUIEx.IsWorkZone(gCMacroUIEx.macroConfig->data->X, gCMacroUIEx.macroConfig->data->Y, gCMacroUIEx.macroConfig->data->Width, gCMacroUIEx.macroConfig->data->Height))
{
    gInterface.DrawToolTip(gCMacroUIEx.macroConfig->data->X, gCMacroUIEx.macroConfig->data->Y + 30, "Config Helper");
}

gCMacroUIEx.Drawbutton(gCMacroUIEx.macroAuto, "");
gCMacroUIEx.macroAuto->data->state = pMUHelperStat;

if (!gCMacroUIEx.macroAuto->data->state)
{
    if (gCMacroUIEx.IsWorkZone(gCMacroUIEx.macroAuto->data->X, gCMacroUIEx.macroAuto->data->Y, gCMacroUIEx.macroAuto->data->Width, gCMacroUIEx.macroAuto->data->Height))
    {
        gInterface.DrawToolTip(gCMacroUIEx.macroAuto->data->X, gCMacroUIEx.macroAuto->data->Y + 30, "Play Helper");
    }
}

if (gCMacroUIEx.macroAuto->data->state)
{
    gCMacroUIEx.Drawbutton(gCMacroUIEx.macroPauseAuto, "");
    if (gCMacroUIEx.IsWorkZone(gCMacroUIEx.macroPauseAuto->data->X, gCMacroUIEx.macroPauseAuto->data->Y, gCMacroUIEx.macroPauseAuto->data->Width, gCMacroUIEx.macroPauseAuto->data->Height))
    {
        gInterface.DrawToolTip(gCMacroUIEx.macroPauseAuto->data->X, gCMacroUIEx.macroPauseAuto->data->Y + 30, "Pause Helper");
    }
}

// 4. Lógica de Mapas, Coordenadas y OffHelper
pSetBackgroundTextColor(pTextThis(), 0, 0, 0, 0);
pSetTextColor(pTextThis(), 240, 240, 240, 255);

if (World >= 82 && World <= 100)
{
    pDrawText(pTextThis(), X + 55, Y + 4, pGetTextLine(pTextLineThis, (3810 + World - 82)), 45, 0, (LPINT)3, 0);
}
else
{
    pDrawText(pTextThis(), X + 55, Y + 4, pMapName(World), 45, 0, (LPINT)3, 0);
}

wsprintf(Cord, "%d,%d", gObjUser.lpViewPlayer->MapPosX, gObjUser.lpViewPlayer->MapPosY);
pDrawText(pTextThis(), X + 97.5, Y + 4, Cord, 35, 0, (LPINT)4, 0);

DWORD Color = Color4f(255, 189, 25, 255);
if(gCMacroUIEx.macroAuto->data->state == 1)
    gInterface.DrawFormat(Color, X + 205, Y + 2.5, 27.5, 3, "1");
else
    gInterface.DrawFormat(Color, X + 205, Y + 2.5, 27.5, 3, "0");

if(offhelper == 1)
{
    gMuHelper.RunningOffHelper();
}

pGLSwitch();
EnableAlphaTest(0);
return;
}

¿Qué logramos con esto?
  • Borramos los antiguos renders para evitar que las texturas colisionen.
  • Preservamos tu validación de OffHelper para que tu sistema VIP/Offline funcione sin cortes.
  • Re-vinculamos los Textos Flotantes a las coordenadas dinámicas de tus nuevos gráficos.

¡Felicidades! Compila el proyecto. Ahora tus texturas leerán un solo .ozt y tendrás una barra 100% nítida y funcional.

Description: Tutorial paso a paso en C++ para reparar botones duplicados y sombras visuales en interfaces personalizadas de Mu Online (MuHelper).
Keywords: fix botones duplicados, Mu Online C++, interfaz custom MuHelper, RenderFrame CMacroUIEx, solucionar bug visual mu online, muserverfiles.

¿Pudiste aplicar este fix en tus sources? ¡Si tienes algún problema con otro botón que se rehúsa a desaparecer, déjanos un comentario y te daremos una mano con las coordenadas!
Bon Dia

🡱 🡳
Real Time Web Analytics