fixes
This commit is contained in:
parent
99cd961d44
commit
d2431e9f1c
@ -29,11 +29,10 @@
|
|||||||
"touchTransparency": 0,
|
"touchTransparency": 0,
|
||||||
"visible": 0,
|
"visible": 0,
|
||||||
"zLevel": 10,
|
"zLevel": 10,
|
||||||
"marginTop" : 20,
|
"marginLeft" : 0,
|
||||||
"marginBottom" : 20,
|
|
||||||
"marginLeft" : 20,
|
|
||||||
"marginRight" : 20,
|
|
||||||
"itemSpacing": 20,
|
"itemSpacing": 20,
|
||||||
|
"horizontalAlignment": "HA_LEFT",
|
||||||
|
"verticalAlignment": "VA_BOTTOM",
|
||||||
"children" : [
|
"children" : [
|
||||||
{
|
{
|
||||||
"type": "Button",
|
"type": "Button",
|
||||||
|
@ -766,7 +766,7 @@ void TGameLevel::InitLevel(int screenWidth, int screenHeight)
|
|||||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||||
ReflectorPos = { 0.5f, 43.5 / Application->GetGameLevelScreenHeight() }; // Vector2f(screenWidth*0.5f, 16 * LEVEL_VIEWPORT_HEIGHT / 320.f + 13 * LEVEL_VIEWPORT_HEIGHT / 320.f);
|
ReflectorPos = { 0.5f, 43.5 / Application->GetGameLevelScreenHeight() }; // Vector2f(screenWidth*0.5f, 16 * LEVEL_VIEWPORT_HEIGHT / 320.f + 13 * LEVEL_VIEWPORT_HEIGHT / 320.f);
|
||||||
Vector2f ballPos = Vector2f(screenWidth*0.5f, 80* 480/320.f);
|
Vector2f ballPos = Vector2f(768*0.5f, 80* 480/320.f);
|
||||||
|
|
||||||
BallList.clear();
|
BallList.clear();
|
||||||
BallList.push_back(TBall(ballPos, Vector2f(0, 0), BallColor));
|
BallList.push_back(TBall(ballPos, Vector2f(0, 0), BallColor));
|
||||||
@ -1183,13 +1183,32 @@ void TGameLevel::DrawBuffer()
|
|||||||
RenderUniform1f("Brightness", brightness);
|
RenderUniform1f("Brightness", brightness);
|
||||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->FrameManager.GetFrameTexture("LevelBuffer"));
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->FrameManager.GetFrameTexture("LevelBuffer"));
|
||||||
|
|
||||||
|
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||||
|
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||||
|
Vector2f offset;
|
||||||
|
float scale;
|
||||||
|
if (screenRatioToFixedRatio > 1.f)
|
||||||
|
{
|
||||||
|
offset[0] = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||||
|
offset[1] = 0;
|
||||||
|
scale = Renderer->GetMatrixHeight() / 480.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset[0] = 0;
|
||||||
|
offset[1] = 0;// (screenHeight - screenHeight * screenRatioToFixedRatio) / 2.f;
|
||||||
|
scale = Renderer->GetMatrixWidth() / 768.f;
|
||||||
|
}
|
||||||
|
|
||||||
//Matrix switched to identity
|
//Matrix switched to identity
|
||||||
//Vector2f RectPos = Vector2f(-1, -1);
|
//Vector2f RectPos = Vector2f(-1, -1);
|
||||||
//Vector2f RectSize = Vector2f(2, 2);
|
//Vector2f RectSize = Vector2f(2, 2);
|
||||||
float x_levelScreenCenter = Renderer->GetScreenWidth()*0.5f;
|
float x_levelScreenCenter = Renderer->GetScreenWidth()*0.5f;
|
||||||
float y_levelScreenCenter = Renderer->GetScreenHeight()*0.5f;
|
float y_levelScreenCenter = Renderer->GetScreenHeight()*0.5f;
|
||||||
|
float x_levelScreenSize = x_levelScreenCenter - offset[0];
|
||||||
|
float y_levelScreenSize = y_levelScreenCenter - offset[1];
|
||||||
Vector2f RectPos = Vector2f(x_levelScreenCenter, y_levelScreenCenter);
|
Vector2f RectPos = Vector2f(x_levelScreenCenter, y_levelScreenCenter);
|
||||||
Vector2f RectSize = Vector2f(x_levelScreenCenter, y_levelScreenCenter);
|
Vector2f RectSize = Vector2f(x_levelScreenSize, y_levelScreenSize);
|
||||||
|
|
||||||
Renderer->DrawRect(RectPos-RectSize, RectPos+RectSize);
|
Renderer->DrawRect(RectPos-RectSize, RectPos+RectSize);
|
||||||
|
|
||||||
|
@ -139,6 +139,23 @@ void TMyApplication::InnerChangeWidthHeight(int screenWidth, int screenHeight, f
|
|||||||
{
|
{
|
||||||
Menu.GalaxMenu.UpdateGalaxyMenu(matrixWidth, matrixHeight, 0);
|
Menu.GalaxMenu.UpdateGalaxyMenu(matrixWidth, matrixHeight, 0);
|
||||||
SetGameLevelScreenScale();
|
SetGameLevelScreenScale();
|
||||||
|
|
||||||
|
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||||
|
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||||
|
float marginLeft;
|
||||||
|
if (screenRatioToFixedRatio > 1.f)
|
||||||
|
{
|
||||||
|
marginLeft = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
marginLeft = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameState == CONST_GAMESTATE_LEVEL)
|
||||||
|
{
|
||||||
|
ResourceManager->newGuiManager.findWidgetByName("buttonList")->setMargin(0, 0, marginLeft, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMyApplication::InnerInit()
|
void TMyApplication::InnerInit()
|
||||||
@ -605,6 +622,20 @@ void TMyApplication::InnerUpdate(size_t dt)
|
|||||||
auto gameFrame = (WidgetAncestor*)ResourceManager->newGuiManager.findWidgetByName("gameFrame").get();
|
auto gameFrame = (WidgetAncestor*)ResourceManager->newGuiManager.findWidgetByName("gameFrame").get();
|
||||||
auto pauseBackground = (WidgetAncestor*)ResourceManager->newGuiManager.findWidgetByName("buttonList").get();
|
auto pauseBackground = (WidgetAncestor*)ResourceManager->newGuiManager.findWidgetByName("buttonList").get();
|
||||||
|
|
||||||
|
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||||
|
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||||
|
float marginLeft;
|
||||||
|
if (screenRatioToFixedRatio > 1.f)
|
||||||
|
{
|
||||||
|
marginLeft = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
marginLeft = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pauseBackground->setMargin(0, 0, marginLeft, 0);
|
||||||
|
|
||||||
pauseButton->onMouseDownSignal.connect([this, gameFrame, pauseBackground](Vector2f, int) {
|
pauseButton->onMouseDownSignal.connect([this, gameFrame, pauseBackground](Vector2f, int) {
|
||||||
GameLevel->SetPause();
|
GameLevel->SetPause();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user