Level screen scaling
This commit is contained in:
parent
0717486119
commit
f246d1a710
BIN
assets/wall_left_mod1.png
Executable file
BIN
assets/wall_left_mod1.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
BIN
assets/wall_right_mod1.png
Executable file
BIN
assets/wall_right_mod1.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
BIN
assets/wall_up_mod1.png
Executable file
BIN
assets/wall_up_mod1.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
@ -85,7 +85,7 @@ void TBrick::TryDrawAppear(int ipos, int jpos)
|
|||||||
*SE::Console << "TBrick::TryDrawAppear";
|
*SE::Console << "TBrick::TryDrawAppear";
|
||||||
Vector2f centerPos = GetPosFrom(ipos, jpos);
|
Vector2f centerPos = GetPosFrom(ipos, jpos);
|
||||||
|
|
||||||
Vector2f blockHalfSize = Vector2f(0.5f*CONST_BRICK_WIDTH * Renderer->GetScreenWidth()/480.f, 0.5f*CONST_BRICK_HEIGHT * Renderer->GetScreenHeight()/320.f);
|
Vector2f blockHalfSize = Vector2f(0.5f*CONST_BRICK_WIDTH * (Renderer->GetScreenWidth()/480.f), 0.5f*CONST_BRICK_HEIGHT * (Renderer->GetScreenHeight()/320.f));
|
||||||
|
|
||||||
std::string texName;
|
std::string texName;
|
||||||
if (Locked == 2)
|
if (Locked == 2)
|
||||||
@ -153,9 +153,9 @@ Vector4f TBrick::GetColor()
|
|||||||
Vector2f TBrick::GetPosFrom(int ipos, int jpos)
|
Vector2f TBrick::GetPosFrom(int ipos, int jpos)
|
||||||
{
|
{
|
||||||
*SE::Console << "TBrick::GetPosFrom";
|
*SE::Console << "TBrick::GetPosFrom";
|
||||||
const Vector2f BorderShift(CONST_BRICK_SHIFT_X * Renderer->GetScreenWidth()/480.f, CONST_BRICK_SHIFT_Y * Renderer->GetScreenHeight()/320.f);
|
const Vector2f BorderShift(CONST_BRICK_SHIFT_X * (Renderer->GetScreenWidth()/480.f), CONST_BRICK_SHIFT_Y * (Renderer->GetScreenHeight()/320.f));
|
||||||
|
|
||||||
return BorderShift+Vector2f(CONST_BRICK_WIDTH*Renderer->GetScreenWidth()/480.f*ipos + 0.5f*CONST_BRICK_WIDTH*Renderer->GetScreenWidth()/480.f, Renderer->GetScreenHeight() - CONST_BRICK_HEIGHT*Renderer->GetScreenHeight()/320.f*(jpos)-0.5f*CONST_BRICK_HEIGHT*Renderer->GetScreenHeight()/320.f);
|
return BorderShift+Vector2f(CONST_BRICK_WIDTH*(Renderer->GetScreenWidth()/480.f)*ipos + 0.5f*CONST_BRICK_WIDTH*(Renderer->GetScreenWidth()/480.f), Renderer->GetScreenHeight() - CONST_BRICK_HEIGHT*(Renderer->GetScreenHeight()/320.f)*(jpos)-0.5f*CONST_BRICK_HEIGHT*(Renderer->GetScreenHeight()/320.f));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,8 +489,8 @@ void TGameLevel::ReloadBlockInstansingList()
|
|||||||
itr--;
|
itr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2f posFrom = BlockMatrix[i][j].GetPosFrom(i,j) + Vector2f(-0.5f*CONST_BRICK_WIDTH*Renderer->GetScreenWidth()/480.f, -0.5f*CONST_BRICK_HEIGHT*Renderer->GetScreenHeight()/320.f);
|
Vector2f posFrom = BlockMatrix[i][j].GetPosFrom(i,j) + Vector2f(-0.5f*CONST_BRICK_WIDTH*(Renderer->GetScreenWidth()/480.f), -0.5f*CONST_BRICK_HEIGHT*(Renderer->GetScreenHeight()/320.f));
|
||||||
Vector2f posTo = BlockMatrix[i][j].GetPosFrom(i,j) + Vector2f(+0.5f*CONST_BRICK_WIDTH*Renderer->GetScreenWidth()/480.f, +0.5f*CONST_BRICK_HEIGHT*Renderer->GetScreenHeight()/320.f);
|
Vector2f posTo = BlockMatrix[i][j].GetPosFrom(i,j) + Vector2f(+0.5f*CONST_BRICK_WIDTH*(Renderer->GetScreenWidth()/480.f), +0.5f*CONST_BRICK_HEIGHT*(Renderer->GetScreenHeight()/320.f));
|
||||||
|
|
||||||
itr->second.Data += MakeDataTriangleList(posFrom, posTo);
|
itr->second.Data += MakeDataTriangleList(posFrom, posTo);
|
||||||
|
|
||||||
@ -508,8 +508,9 @@ void TGameLevel::ReloadBlockInstansingList()
|
|||||||
Vector2f TGameLevel::GetBlock(const Vector2f& pos)
|
Vector2f TGameLevel::GetBlock(const Vector2f& pos)
|
||||||
{
|
{
|
||||||
*SE::Console << "TGameLevel::GetBlock";
|
*SE::Console << "TGameLevel::GetBlock";
|
||||||
int x = static_cast<int>((pos(0) - CONST_BRICK_SHIFT_X*Renderer->GetScreenWidth()/480.f) / CONST_BRICK_WIDTH*Renderer->GetScreenWidth()/480.f);
|
int x = static_cast<int>((pos(0) - CONST_BRICK_SHIFT_X*(Renderer->GetScreenWidth()/480.f)) / (CONST_BRICK_WIDTH*(Renderer->GetScreenWidth()/480.f)));
|
||||||
int y = static_cast<int>((Renderer->GetScreenHeight() + CONST_BRICK_SHIFT_Y*Renderer->GetScreenHeight()/320.f - pos(1)) / CONST_BRICK_HEIGHT*Renderer->GetScreenHeight()/320.f);
|
int y = static_cast<int>((Renderer->GetScreenHeight() + CONST_BRICK_SHIFT_Y*(Renderer->GetScreenHeight()/320.f) - pos(1)) / (CONST_BRICK_HEIGHT*(Renderer->GetScreenHeight()/320.f)));
|
||||||
|
|
||||||
|
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = 0;
|
x = 0;
|
||||||
@ -523,6 +524,7 @@ Vector2f TGameLevel::GetBlock(const Vector2f& pos)
|
|||||||
if (y > CONST_BRICKMATRIX_HEIGHT-1)
|
if (y > CONST_BRICKMATRIX_HEIGHT-1)
|
||||||
y = CONST_BRICKMATRIX_HEIGHT-1;
|
y = CONST_BRICKMATRIX_HEIGHT-1;
|
||||||
|
|
||||||
|
|
||||||
return Vector2f(x, y);
|
return Vector2f(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -813,30 +815,31 @@ void TGameLevel::Draw()
|
|||||||
|
|
||||||
float tSW = Renderer->GetScreenWidth(); // Screen Width
|
float tSW = Renderer->GetScreenWidth(); // Screen Width
|
||||||
float tSH = Renderer->GetScreenHeight(); // Screen Height
|
float tSH = Renderer->GetScreenHeight(); // Screen Height
|
||||||
float lWTW = tSW / static_cast<float>(ResourceManager->TexList.GetTextureHeight(CONST_WALL_LEFT_TEXTURE)) * static_cast<float>(ResourceManager->TexList.GetTextureWidth(CONST_WALL_LEFT_TEXTURE)) * tSH/tSW; // left Wall Texture Width
|
float lrFBO = 4 * tSH/320.f; // Left/Right Wall Textures offset from bottom
|
||||||
|
float uWTW = tSW * (static_cast<float>(ResourceManager->TexList.GetTextureHeight(CONST_WALL_UP_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureWidth(CONST_WALL_UP_TEXTURE))); // up Wall Texture Width
|
||||||
|
float lWTW = (static_cast<float>(ResourceManager->TexList.GetTextureWidth(CONST_WALL_LEFT_TEXTURE))/static_cast<float>(ResourceManager->TexList.GetTextureHeight(CONST_WALL_LEFT_TEXTURE))) * (tSH-uWTW-lrFBO); // left Wall Texture Width
|
||||||
float rWTW = lWTW; // right Wall Texture Width
|
float rWTW = lWTW; // right Wall Texture Width
|
||||||
float uWTW = (tSW - (lWTW + rWTW)) / static_cast<float>(ResourceManager->TexList.GetTextureWidth(CONST_WALL_UP_TEXTURE)) * static_cast<float>(ResourceManager->TexList.GetTextureHeight(CONST_WALL_UP_TEXTURE)) * tSW/tSH; // up Wall Texture Width
|
|
||||||
float bWTO = (lWTW+rWTW) * 0.5f; // bonus Wall x-Offset
|
float bWTO = (lWTW+rWTW) * 0.5f; // bonus Wall x-Offset
|
||||||
float bWTW = (tSW-bWTO)/static_cast<float>(ResourceManager->TexList.GetTextureWidth(CONST_WALL_BONUS_TEXTURE)) * static_cast<float>(ResourceManager->TexList.GetTextureHeight(CONST_WALL_BONUS_TEXTURE)) * tSW/tSH; // bonus Wall Texture Width
|
float bWTW = (tSW - bWTO) * (static_cast<float>(ResourceManager->TexList.GetTextureHeight(CONST_WALL_BONUS_TEXTURE))/static_cast<float>(ResourceManager->TexList.GetTextureWidth(CONST_WALL_BONUS_TEXTURE))); // bonus Wall Texture Width
|
||||||
|
|
||||||
//const Vector2f wallUpPos1(240.f-256.f, 320.f-64.f);
|
//const Vector2f wallUpPos1(240.f-256.f, 320.f-64.f);
|
||||||
//const Vector2f wallUpPos2(240.f+256.f, 320.f);
|
//const Vector2f wallUpPos2(240.f+256.f, 320.f);
|
||||||
const Vector2f wallUpPos1(lWTW, tSH-uWTW);
|
const Vector2f wallUpPos1(0.f, tSH-uWTW);
|
||||||
const Vector2f wallUpPos2(tSW - rWTW, tSH);
|
const Vector2f wallUpPos2(tSW, tSH);
|
||||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_UP_TEXTURE]);
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_UP_TEXTURE]);
|
||||||
Renderer->DrawRect(wallUpPos1, wallUpPos2);
|
Renderer->DrawRect(wallUpPos1, wallUpPos2);
|
||||||
|
|
||||||
//const Vector2f wallLeftPos1(0.f, 320.f - 512.f);
|
//const Vector2f wallLeftPos1(0.f, 320.f - 512.f);
|
||||||
//const Vector2f wallLeftPos2(32.f, 320.f);
|
//const Vector2f wallLeftPos2(32.f, 320.f);
|
||||||
const Vector2f wallLeftPos1(0.f, 0.f);
|
const Vector2f wallLeftPos1(0.f, lrFBO);
|
||||||
const Vector2f wallLeftPos2(lWTW, tSH);
|
const Vector2f wallLeftPos2(lWTW, tSH - uWTW);
|
||||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_LEFT_TEXTURE]);
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_LEFT_TEXTURE]);
|
||||||
Renderer->DrawRect(wallLeftPos1, wallLeftPos2);
|
Renderer->DrawRect(wallLeftPos1, wallLeftPos2);
|
||||||
|
|
||||||
//const Vector2f wallRightPos1(480.f-32.f, 320.f - 512.f);
|
//const Vector2f wallRightPos1(480.f-32.f, 320.f - 512.f);
|
||||||
//const Vector2f wallRightPos2(480.f, 320.f);
|
//const Vector2f wallRightPos2(480.f, 320.f);
|
||||||
const Vector2f wallRightPos1(tSW-rWTW, 0.f);
|
const Vector2f wallRightPos1(tSW-rWTW, lrFBO);
|
||||||
const Vector2f wallRightPos2(tSW, tSH);
|
const Vector2f wallRightPos2(tSW, tSH-uWTW);
|
||||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_RIGHT_TEXTURE]);
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_RIGHT_TEXTURE]);
|
||||||
Renderer->DrawRect(wallRightPos1, wallRightPos2);
|
Renderer->DrawRect(wallRightPos1, wallRightPos2);
|
||||||
|
|
||||||
@ -985,6 +988,7 @@ bool TGameLevel::IsPaused()
|
|||||||
void TGameLevel::Update(size_t dt)
|
void TGameLevel::Update(size_t dt)
|
||||||
{
|
{
|
||||||
*SE::Console << "TGameLevel::Update";
|
*SE::Console << "TGameLevel::Update";
|
||||||
|
*SE::Console << "before_upd LEVEL_STATE::== " << tostr(LevelState);
|
||||||
if (LevelState == CONST_LEVELSTATE_NODRAW)
|
if (LevelState == CONST_LEVELSTATE_NODRAW)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1164,7 +1168,7 @@ void TGameLevel::Update(size_t dt)
|
|||||||
{
|
{
|
||||||
SetStandBy();
|
SetStandBy();
|
||||||
}
|
}
|
||||||
|
*SE::Console << "after_upd LEVEL_STATE::== " << tostr(LevelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1381,7 +1385,7 @@ void TGameLevel::UpdateBallList(size_t dt)
|
|||||||
{
|
{
|
||||||
mustReloadBalls = true;
|
mustReloadBalls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BonusFloorTimer == 0.f)
|
if (BonusFloorTimer == 0.f)
|
||||||
{
|
{
|
||||||
Vector2f ballPos;
|
Vector2f ballPos;
|
||||||
@ -1392,6 +1396,8 @@ void TGameLevel::UpdateBallList(size_t dt)
|
|||||||
{
|
{
|
||||||
ballPos = iBall->GetPos();
|
ballPos = iBall->GetPos();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ballPos(1)<0.f)
|
if (ballPos(1)<0.f)
|
||||||
{
|
{
|
||||||
iBall = BallList.erase(iBall);
|
iBall = BallList.erase(iBall);
|
||||||
@ -1417,7 +1423,7 @@ void TGameLevel::UpdateBallList(size_t dt)
|
|||||||
Vector2f ballPos = iBall->GetPos();
|
Vector2f ballPos = iBall->GetPos();
|
||||||
|
|
||||||
|
|
||||||
if (ballPos(0) > Renderer->GetScreenWidth()-15.f)
|
if (ballPos(0) > Renderer->GetScreenWidth()-15.f*(Renderer->GetScreenWidth()/480.f))
|
||||||
{
|
{
|
||||||
iBall->ReflectToLeft();
|
iBall->ReflectToLeft();
|
||||||
}
|
}
|
||||||
@ -1427,14 +1433,14 @@ void TGameLevel::UpdateBallList(size_t dt)
|
|||||||
iBall->ReflectToRight();
|
iBall->ReflectToRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ballPos(1) > Renderer->GetScreenHeight()-16.f)
|
if (ballPos(1) > Renderer->GetScreenHeight()-16.f * (Renderer->GetScreenHeight()/320.f))
|
||||||
{
|
{
|
||||||
iBall->ReflectToDown();
|
iBall->ReflectToDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BonusFloorTimer > 0.f)
|
if (BonusFloorTimer > 0.f)
|
||||||
{
|
{
|
||||||
if (ballPos(1) < 13.0f)
|
if (ballPos(1) < 13.0f* (Renderer->GetScreenHeight()/320.f))
|
||||||
{
|
{
|
||||||
iBall->ReflectToUp();
|
iBall->ReflectToUp();
|
||||||
}
|
}
|
||||||
@ -1470,7 +1476,6 @@ void TGameLevel::UpdateBallList(size_t dt)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
canThrowBonus = (BlockMatrix[i][j].GetLocked() == 0);
|
canThrowBonus = (BlockMatrix[i][j].GetLocked() == 0);
|
||||||
|
|
||||||
BlockMatrix[i][j].Hit();
|
BlockMatrix[i][j].Hit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ const float CONST_BRICK_APPEAR_TIME = 200.f;
|
|||||||
|
|
||||||
const int CONST_BRICKMATRIX_WIDTH = 12;
|
const int CONST_BRICKMATRIX_WIDTH = 12;
|
||||||
const int CONST_BRICKMATRIX_HEIGHT = 13;
|
const int CONST_BRICKMATRIX_HEIGHT = 13;
|
||||||
const float CONST_BRICK_WIDTH = 37.5f;
|
const float CONST_BRICK_WIDTH = 38.65f;
|
||||||
const float CONST_BRICK_HEIGHT = 0.5f*CONST_BRICK_WIDTH;
|
const float CONST_BRICK_HEIGHT = 0.5f*CONST_BRICK_WIDTH;
|
||||||
const float CONST_BRICK_SHIFT_X = 15.f;
|
const float CONST_BRICK_SHIFT_X = 8.2f;
|
||||||
const float CONST_BRICK_SHIFT_Y = -16.f;
|
const float CONST_BRICK_SHIFT_Y = -16.f;
|
||||||
|
|
||||||
const float CONST_BONUS_APPEAR_TIME = 400.f;
|
const float CONST_BONUS_APPEAR_TIME = 400.f;
|
||||||
|
@ -32,17 +32,18 @@ const std::string CONST_BALL_TEXTURE = "ball_mod1";
|
|||||||
|
|
||||||
const std::string CONST_BALLGLOW_TEXTURE = "ball_glow";
|
const std::string CONST_BALLGLOW_TEXTURE = "ball_glow";
|
||||||
|
|
||||||
const std::string CONST_REFLECTOR_TEXTURE = "reflector_mod1";
|
const std::string CONST_REFLECTOR_TEXTURE = "reflector";
|
||||||
/*
|
|
||||||
const std::string CONST_WALL_LEFT_TEXTURE = "wall_left";
|
|
||||||
const std::string CONST_WALL_RIGHT_TEXTURE = "wall_right";
|
|
||||||
const std::string CONST_WALL_UP_TEXTURE = "wall_up";
|
|
||||||
const std::string CONST_WALL_BONUS_TEXTURE = "wall_bonus";
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
const std::string CONST_WALL_LEFT_TEXTURE = "wall_left_mod1";
|
||||||
|
const std::string CONST_WALL_RIGHT_TEXTURE = "wall_right_mod1";
|
||||||
|
const std::string CONST_WALL_UP_TEXTURE = "wall_up_mod1";
|
||||||
|
//const std::string CONST_WALL_BONUS_TEXTURE = "wall_bonus";
|
||||||
|
|
||||||
|
/*
|
||||||
const std::string CONST_WALL_LEFT_TEXTURE = "left_frame_fragment";
|
const std::string CONST_WALL_LEFT_TEXTURE = "left_frame_fragment";
|
||||||
const std::string CONST_WALL_RIGHT_TEXTURE = "right_frame_fragment";
|
const std::string CONST_WALL_RIGHT_TEXTURE = "right_frame_fragment";
|
||||||
const std::string CONST_WALL_UP_TEXTURE = "top_frame_fragment";
|
const std::string CONST_WALL_UP_TEXTURE = "top_frame_fragment";
|
||||||
|
*/
|
||||||
const std::string CONST_WALL_BONUS_TEXTURE = "bottom_frame_fragment";
|
const std::string CONST_WALL_BONUS_TEXTURE = "bottom_frame_fragment";
|
||||||
|
|
||||||
const std::string CONST_BACK_BTN_TEXTURE = "back_btn";
|
const std::string CONST_BACK_BTN_TEXTURE = "back_btn";
|
||||||
|
@ -27,9 +27,9 @@ void TGameMenu::Draw()
|
|||||||
RenderUniform1f("Transparency", 1.f);
|
RenderUniform1f("Transparency", 1.f);
|
||||||
float bkgShift = MenuPos*0.1f - 100.f;
|
float bkgShift = MenuPos*0.1f - 100.f;
|
||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["main_menu_bkg_left"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["main_menu_bkg_left"]);
|
||||||
Renderer->DrawRect(Vector2f(bkgShift,0.f), Vector2f(480.f+bkgShift,320.f));
|
Renderer->DrawRect(Vector2f(bkgShift,0.f), Vector2f(Renderer->GetScreenWidth()+bkgShift,Renderer->GetScreenHeight()));
|
||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["main_menu_bkg_right"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["main_menu_bkg_right"]);
|
||||||
Renderer->DrawRect(Vector2f(480.f+bkgShift,0.f), Vector2f(960.f+bkgShift,320.f));
|
Renderer->DrawRect(Vector2f(Renderer->GetScreenWidth()+bkgShift,0.f), Vector2f(960.f+bkgShift,Renderer->GetScreenHeight()));
|
||||||
|
|
||||||
|
|
||||||
if (SelectedGame == 0)
|
if (SelectedGame == 0)
|
||||||
|
@ -8,7 +8,7 @@ int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst,
|
|||||||
LPSTR lpszCmdLine, int nCmdShow)
|
LPSTR lpszCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = 800;
|
int width = 700;
|
||||||
int height = 480;
|
int height = 480;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user