textures fix
This commit is contained in:
1 parent
c8d69040b3
commit
1abfa608b2
9 files changed
+97
-59
No files matched your search
+15
-5
@@ -90,8 +90,8 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) {
|
||||
*SE::Console << "galaxy_" + std::to_string(i);
|
||||
Eigen::Vector2f tex_size = textureSizeNormalize(
|
||||
Eigen::Vector2f(
|
||||
((float)SE::ResourceManager->TexList.GetTextureWidth("galaxy_" + std::to_string(i))),
|
||||
((float)SE::ResourceManager->TexList.GetTextureHeight("galaxy_" + std::to_string(i))))
|
||||
((float)SE::ResourceManager->TexList.GetTextureOriginalWidth("galaxy_" + std::to_string(i))),
|
||||
((float)SE::ResourceManager->TexList.GetTextureOriginalHeight("galaxy_" + std::to_string(i))))
|
||||
); // normalized
|
||||
galaxies_params.push_back(std::make_pair(
|
||||
Eigen::Vector2f(
|
||||
@@ -380,7 +380,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
||||
starIndex = -1;
|
||||
menuState = 0;
|
||||
planetHoverIndex = -1;
|
||||
Application->GoFromMenuToGame(lvl);
|
||||
Application->GoFromMenuToGame(lvl-1);
|
||||
}
|
||||
else if (!checkMenuBound(lastTapPos)) {
|
||||
// back to state 0
|
||||
@@ -602,7 +602,12 @@ void GalaxyMenu::drawSelectionMenu(int index) {
|
||||
|
||||
// buttons
|
||||
for (int j = 0; j < galaxies[0].Stars[i].selectionMenu.buttons.size(); j++) {
|
||||
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList["black_square"]);
|
||||
std::string levelNum;
|
||||
size_t itr = galaxies[0].Stars[i].selectionMenu.levels[j].find("_");
|
||||
for (int z = itr + 1; z < galaxies[0].Stars[i].selectionMenu.levels[j].size(); z++) {
|
||||
levelNum += galaxies[0].Stars[i].selectionMenu.levels[j][z];
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList["shutterstock" + levelNum]);
|
||||
SE::Renderer->DrawRect(
|
||||
Eigen::Vector2f(
|
||||
galaxies[0].Stars[i].selectionMenu.buttons[j].first(0) - galaxies[0].Stars[i].selectionMenu.buttons[j].second(0) / 2,
|
||||
@@ -627,7 +632,12 @@ int GalaxyMenu::findLevelButtonByPos(Eigen::Vector2f pos) {
|
||||
|
||||
if (pos(0) >= x_l && pos(0) <= x_r) {
|
||||
if (pos(1) >= y_b && pos(1) <= y_t) {
|
||||
return i;
|
||||
std::string lvlname = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.levels[i];
|
||||
std::string lvlNum;
|
||||
for (int z = lvlname.find("_")+1; z < lvlname.size(); z++) {
|
||||
lvlNum+=lvlname[z];
|
||||
}
|
||||
return atoi(lvlNum.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ private:
|
||||
Eigen::Vector2f totalTapShift; // reset
|
||||
|
||||
/*..coefficients..*/
|
||||
Eigen::Vector2f menu_offset;
|
||||
Eigen::Vector2f menu_offset = Eigen::Vector2f(0, 0);
|
||||
|
||||
/*..Interact methods..*/
|
||||
void takeInFocus(int g_index, int s_index = -1);
|
||||
|
||||
+36
-7
@@ -736,6 +736,32 @@ bool TGameLevel::IsLoaded()
|
||||
return (LevelState == CONST_LEVELSTATE_STANDBY);
|
||||
}
|
||||
|
||||
void TGameLevel::drawOutline() {
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["black_square"]);
|
||||
Renderer->DrawRect(
|
||||
Vector2f(
|
||||
0.0f,
|
||||
0.0f
|
||||
),
|
||||
Vector2f(
|
||||
(Renderer->GetScreenWidth() - Application->GetGameLevelScreenWidth())*0.5f,
|
||||
Renderer->GetScreenHeight()
|
||||
)
|
||||
);
|
||||
|
||||
Renderer->DrawRect(
|
||||
Vector2f(
|
||||
Renderer->GetScreenWidth() - (Renderer->GetScreenWidth() - Application->GetGameLevelScreenWidth())*0.5f,
|
||||
0.f
|
||||
),
|
||||
Vector2f(
|
||||
Renderer->GetScreenWidth(),
|
||||
Renderer->GetScreenHeight()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void TGameLevel::Draw()
|
||||
{
|
||||
*SE::Console << "TGameLevel::Draw";
|
||||
@@ -747,11 +773,11 @@ void TGameLevel::Draw()
|
||||
//float ylOffset = (Renderer->GetScreenHeight() - tSH)*0.5f; // Level Screen y-offset
|
||||
float ylOffset = 0.f;
|
||||
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 uWTW = tSW * (static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_UP_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_UP_TEXTURE))); // up Wall Texture Width
|
||||
float lWTW = (static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_LEFT_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_LEFT_TEXTURE))) * (tSH - uWTW - lrFBO); // left Wall Texture Width
|
||||
float rWTW = lWTW; // right Wall Texture Width
|
||||
float bWTO = (lWTW + rWTW) * 0.5f; // bonus Wall x-Offset
|
||||
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
|
||||
float bWTW = (tSW - bWTO) * (static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_BONUS_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_BONUS_TEXTURE))); // bonus Wall Texture Width
|
||||
|
||||
if (LevelState == CONST_LEVELSTATE_NODRAW)
|
||||
{
|
||||
@@ -818,8 +844,8 @@ void TGameLevel::Draw()
|
||||
|
||||
// Level background
|
||||
// :::::::::::
|
||||
float bkgTW = (float)ResourceManager->TexList.GetTextureWidth(BkgTexture);
|
||||
float bkgTH = (float)ResourceManager->TexList.GetTextureHeight(BkgTexture);
|
||||
float bkgTW = (float)ResourceManager->TexList.GetTextureOriginalWidth(BkgTexture);
|
||||
float bkgTH = (float)ResourceManager->TexList.GetTextureOriginalHeight(BkgTexture);
|
||||
float bkgSW; // Background Secreen Width
|
||||
float bkgSH; // Background Secreen Height
|
||||
float bkgSWO; // Background Secreen Width Offset
|
||||
@@ -841,6 +867,8 @@ void TGameLevel::Draw()
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[BkgTexture]);
|
||||
//Renderer->DrawRect(Vector2f(xlOffset, ylOffset), Vector2f(xlOffset+tSW, ylOffset+tSH),Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
Renderer->DrawRect(Vector2f(bkgSWO, bkgSHO), Vector2f(bkgSWO + bkgSW, bkgSHO + bkgSH), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
drawOutline();
|
||||
|
||||
std::list<TBall>::iterator iBall;
|
||||
|
||||
@@ -891,12 +919,12 @@ void TGameLevel::Draw()
|
||||
Renderer->DrawRect(wallUpPos1, wallUpPos2, Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
const Vector2f wallLeftPos1(xlOffset, lrFBO+ylOffset);
|
||||
const Vector2f wallLeftPos2(lWTW + xlOffset, tSH-ylOffset-(uWTW*0.8f));
|
||||
const Vector2f wallLeftPos2(lWTW + xlOffset, tSH-ylOffset-(uWTW*0.68f));
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_LEFT_TEXTURE]);
|
||||
Renderer->DrawRect(wallLeftPos1, wallLeftPos2, Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
const Vector2f wallRightPos1(tSW+xlOffset-rWTW, lrFBO+ylOffset);
|
||||
const Vector2f wallRightPos2(tSW + xlOffset, tSH-ylOffset-(uWTW*0.8f));
|
||||
const Vector2f wallRightPos2(tSW + xlOffset, tSH-ylOffset-(uWTW*0.68f));
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_WALL_RIGHT_TEXTURE]);
|
||||
Renderer->DrawRect(wallRightPos1, wallRightPos2, Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
@@ -1715,3 +1743,4 @@ void TGameLevel::TryGoToMenu()
|
||||
OutScale = 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,8 @@ protected:
|
||||
void DrawPauseButtons();
|
||||
|
||||
void DrawBallInstancingList();
|
||||
|
||||
void drawOutline();
|
||||
|
||||
bool RenderBufferReady;
|
||||
|
||||
|
||||
+14
-11
@@ -265,6 +265,7 @@ void TMyApplication::LoadResources()
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("main_menu_bkg_left.png", "main_menu_bkg_left"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("main_menu_bkg_right.png", "main_menu_bkg_right"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("select_level.png", "select_level"));
|
||||
|
||||
/*
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock1.png", "shutterstock1"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock2.png", "shutterstock2"));
|
||||
@@ -279,19 +280,21 @@ void TMyApplication::LoadResources()
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock11.png", "shutterstock11"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock12.png", "shutterstock12"));
|
||||
*/
|
||||
|
||||
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock1"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_2") + bg_ext, "shutterstock2"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_11") + bg_ext, "shutterstock3"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_13") + bg_ext, "shutterstock4"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock5"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock6"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock7"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock8"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock9"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock10"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock11"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock12"));
|
||||
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_3") + bg_ext, "shutterstock3"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_4") + bg_ext, "shutterstock4"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_5") + bg_ext, "shutterstock5"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_6") + bg_ext, "shutterstock6"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_7") + bg_ext, "shutterstock7"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_8") + bg_ext, "shutterstock8"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_9") + bg_ext, "shutterstock9"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_10") + bg_ext, "shutterstock10"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_11") + bg_ext, "shutterstock11"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_12") + bg_ext, "shutterstock12"));
|
||||
|
||||
/*..galaxies and stars/planets Init..*/ // tmp
|
||||
std::vector<int> galaxies;
|
||||
galaxies.resize(1);
|
||||
|
||||
Reference in new issue
Block a user