Chat global

Chat
Loading the chat ...
Cinematic Letterbox...
 
Notifications
Clear all

Cinematic Letterbox ( Wartale )

1 Posts
1 Usuários
4 Reactions
36 Visualizações
Zorik
(@zorik)
Posts: 4
Apoiador Ativo
Topic starter
 

Algo simples, totalmente funcional, mas você pode aprimorar/melhorar como quiser!

Este é o Letterbox animado na tela de Login que o Wartale utiliza, obviamente não ficou igual, mas você pode melhorar e adaptar conforme o seu gosto.

 

 

cinematicletterbox

 

Já contem a animação da direita para esquerda.

No seu HoOpening.h Dentro da classe, na seção private (antes depublic:): adicione isso

    float					TickerScrollOffset;
    int						TickerAnimationCounter;
    BOOL					TickerPausedFlag;
    int						LastScreenWidth;

 

Na seção public, apósint Draw();: adicione isso:

	int		DrawLetterboxBars();
	int		DrawTickerText();
	int		UpdateTickerAnimation();

Agora em seu HoOpening.cpp No construtor HoOpening::HoOpening(), antes do fechamento }:

	TickerScrollOffset = 0.0f;
	TickerAnimationCounter = 0;
	TickerPausedFlag = FALSE;
	LastScreenWidth = 0;

Adicione também no final do arquivo ou onde desejar:

int HoOpening::UpdateTickerAnimation()
{
	int barHeight = 60;
	int screenHeight = SETTINGSHANDLER->getHeight();
	int screenWidth = SETTINGSHANDLER->getWidth();
	int tickerY = screenHeight - barHeight;
	
	
	if (screenWidth != LastScreenWidth)
	{		
		TickerScrollOffset = (float)screenWidth;
		LastScreenWidth = screenWidth;
	}
	
	if (pCursorPos.y >= tickerY && pCursorPos.y <= screenHeight)
	{
		TickerPausedFlag = TRUE;
	}
	else
	{
		TickerPausedFlag = FALSE;
	}
	
	if (!TickerPausedFlag)
	{
		TickerScrollOffset -= 0.02f;
	}
	
	const char* tickerMessage = "Did you know about the market on Wartale.com forums? Buy and sell your items there! Keep yourself updated with the latest news and upcoming events on Wartale!";
	int textWidth = strlen(tickerMessage) * 8;
	
	if (TickerScrollOffset < -(textWidth + screenWidth))
	{
		TickerScrollOffset = (float)screenWidth;
	}
	
	TickerAnimationCounter++;
	return TRUE;
}

int HoOpening::DrawLetterboxBars()
{
	int barHeight = 60;
	int screenWidth = SETTINGSHANDLER->getWidth();
	int screenHeight = SETTINGSHANDLER->getHeight();
	
	dsDrawTexImage(BlackBoxImage, 0, 0, screenWidth, barHeight, 255);
	
	dsDrawTexImage(BlackBoxImage, 0, screenHeight - barHeight, screenWidth, barHeight, 255);
	
	return TRUE;
}

int HoOpening::DrawTickerText()
{
	int barHeight = 60;
	int screenHeight = SETTINGSHANDLER->getHeight();
	int screenWidth = SETTINGSHANDLER->getWidth();
	
	const char* tickerMessage = "Did you know about the market on Wartale.com forums? Buy and sell your items there! Keep yourself updated with the latest news and upcoming events on Wartale!"; //Texto a ser exibido
	
	int textY = screenHeight - barHeight + (barHeight - 16) / 2;
	
	int textX = (int)TickerScrollOffset;
	
	COLORREF textColor = RGB(218, 165, 32);  // Cor amarelo/Gold
	
	SetFontOpacity(255);
	
	DrawFontText(textX, textY, tickerMessage, textColor, 1);
	
	int textWidth = strlen(tickerMessage) * 8;
	DrawFontText(textX + textWidth, textY, tickerMessage, textColor, 1);
	
	return TRUE;
}


E por último, em FastFade(), antes do return TRUE; final:

	UpdateTickerAnimation();
	DrawLetterboxBars();
	DrawTickerText();

Este tópico foi modificado 2 semanas atrás 2 vezes by Zorik

Code. Learn. Evolve.

 
Postado : 18/11/2025 11:41 pm
datway, Raka, ViGo and 1 people reacted
Compartilhar:

Anúncio