1
Sources Generales / Re: Main 5.2 – Render Number with Thousand Separator (DAMAGE)
« Posteado: August 11, 2025, 10:03:25 AM »Can we do it for SS6 ?
não tenho... ainda
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Can we do it for SS6 ?
.h
void RenderNumberNew(vec3_t Position, int Num, vec3_t Color, float Alpha = 1.f, float Scale = 15.f);
.cpp
void RenderNumberNew(vec3_t Position, int Num, vec3_t Color, float Alpha, float Scale)
{
vec3_t p;
VectorCopy(Position, p);
vec3_t Light[4];
VectorCopy(Color, Light[0]);
VectorCopy(Color, Light[1]);
VectorCopy(Color, Light[2]);
VectorCopy(Color, Light[3]);
if (Num == -1)
{
float UV[4][2];
TEXCOORD(UV[0], 0.f, 32.f / 32.f);
TEXCOORD(UV[1], 32.f / 256.f, 32.f / 32.f);
TEXCOORD(UV[2], 32.f / 256.f, 17.f / 32.f);
TEXCOORD(UV[3], 0.f, 17.f / 32.f);
RenderSpriteUV(BITMAP_FONT + 1, p, 45, 20, UV, Light, Alpha);
}
else if (Num == -2)
{
RenderSprite(BITMAP_FONT_HIT, p, 32 * Scale, 20 * Scale, Light[0], 0.f, 0.f, 0.f, 27.f / 32.f, 15.f / 16.f);
}
else
{
// ==== Novo código para adicionar separador de milhar ====
char buffer[32];
char formatted[32];
itoa(Num, buffer, 10);
SetConsoleTitleA(buffer);
int len = strlen(buffer);
int j = 0;
int count = 0;
// Percorre de trás para frente inserindo pontos
for (int i = len - 1; i >= 0; i--)
{
if (count && count % 3 == 0)
{
formatted[j++] = '.'; // separador de milhar
}
formatted[j++] = buffer[i];
count++;
}
formatted[j] = '\0';
// Inverte a string formatada para ficar na ordem correta
for (int i = 0; i < j / 2; i++)
{
char temp = formatted[i];
formatted[i] = formatted[j - 1 - i];
formatted[j - 1 - i] = temp;
}
// ==== Renderização ====
p[0] -= strlen(formatted) * 5.f;
unsigned int Length = strlen(formatted);
p[0] -= Length * Scale * 0.125f;
p[1] -= Length * Scale * 0.125f;
for (unsigned int i = 0; i < Length; i++)
{
float UV[4][2];
float u = 0;
if (formatted[i] == '.')
{
// Posição do caractere '.' no sprite font (suponha que esteja na posição 10, ajuste conforme seu bitmap)
u = (float)(10) * 16.f / 256.f;
}
else
{
u = (float)(formatted[i] - '0') * 16.f / 256.f;
}
TEXCOORD(UV[0], u, 16.f / 32.f);
TEXCOORD(UV[1], u + 16.f / 256.f, 16.f / 32.f);
TEXCOORD(UV[2], u + 16.f / 256.f, 0.f);
TEXCOORD(UV[3], u, 0.f);
RenderSpriteUV(BITMAP_FONT + 1, p, Scale, Scale, UV, Light, Alpha);
p[0] += Scale * 0.5f;
p[1] += Scale * 0.5f;
}
}
}
Um projeto mais lindo que o outro estão de parabéns !
estamos desenvolvendo um servidor privado http://gxemu.gxgaming.com.br/
bug ao relogar
Você poderia nos mostrar uma imagem de como seria?