Jump to content

[C++ client] Modo janela centrado


tierrilopes
 Share

Recommended Posts

Serve para que quando abram o jogo em modo janela, este apareça centrado magicamente:Kreygasm::Kreygasm::Kreygasm:

 

Ir até ao ficheiro UserInterface/PythonApplication.cpp

Em

bool CPythonApplication::Create(PyObject * poSelf, const char * c_szName, int width, int height, int Windowed)

Procurar por:

int windowWidth = (rc.right - rc.left);
int windowHeight = (rc.bottom - rc.top);

CMSApplication::SetPosition(GetScreenWidth() - windowWidth, GetScreenHeight() - 60 - windowHeight);

Modificar para:

int windowWidth = (rc.right - rc.left);
int windowHeight = (rc.bottom - rc.top);
windowWidth = (GetScreenWidth() - windowWidth);
windowWidth = (windowWidth / 2);
windowWidth = windowWidth - 8;
windowHeight = (GetScreenHeight() - windowHeight);
windowHeight = (windowHeight / 2);
windowHeight = (windowHeight - 61);

CMSApplication::SetPosition(windowWidth, windowHeight); //Centrado + esconder barra de programa na parte superior do ecrã
//CMSWindow::SetCenterPosition(); //Apenas centrado

 

Cumprimentos,

Tierri Lopes :HeyGuys:

Link to comment
Share on other sites

  • 1 year later...
1 hour ago, noobexp said:

Honestamente isso não funciona para mim .. A janela continua a abrir sempre no canto esquerdo

No tutorial, nesta parte:

CMSApplication::SetPosition (windowWidth, windowHeight); //Centrado + esconder barra de programa
//CMSWindow::SetCenterPosition(); //Apenas centrado

Deixa assim:

//CMSApplication::SetPosition (windowWidth, windowHeight); //Centrado + esconder barra de programa
CMSWindow::SetCenterPosition(); //Apenas centrado

 

Na mesma função do tutorial (esta abaixo)

CPythonApplication::Create

Procura por:

else {
		m_isWindowed = false;
		SetPosition (0, 0);
	}

Edita para:

else {
		m_isWindowed = false;
		//SetPosition (0, 0);
		CMSWindow::SetCenterPosition();
	}

 

 

Ainda na mesma função, procura por:

CGrannyMaterial::CreateSphereMap (0, "d:/ymir work/special/spheremap.jpg");
CGrannyMaterial::CreateSphereMap (1, "d:/ymir work/special/spheremap01.jpg");
return true;

E edita desta maneira (ignora se já estiver):

CGrannyMaterial::CreateSphereMap (0, "d:/ymir work/special/spheremap.jpg");
CGrannyMaterial::CreateSphereMap (1, "d:/ymir work/special/spheremap01.jpg");
CMSWindow::SetCenterPosition();
return true;

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...