background texture scaling
This commit is contained in:
1 parent
bdb032c970
commit
d8518bd7b9
27 files changed
+91
-12
No files matched your search
+24
-1
@@ -816,8 +816,31 @@ void TGameLevel::Draw()
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
// Level background
|
||||
// :::::::::::
|
||||
float bkgTW = (float)ResourceManager->TexList.GetTextureWidth(BkgTexture);
|
||||
float bkgTH = (float)ResourceManager->TexList.GetTextureHeight(BkgTexture);
|
||||
float bkgSW; // Background Secreen Width
|
||||
float bkgSH; // Background Secreen Height
|
||||
float bkgSWO; // Background Secreen Width Offset
|
||||
float bkgSHO; // Background Secreen Height Offset
|
||||
|
||||
if ((bkgTW/bkgTH) >= 1.6f/*screen ratio*/) {
|
||||
bkgSW = (tSH/bkgTH) * bkgTW;
|
||||
bkgSH = tSH;
|
||||
bkgSWO = (((float)Renderer->GetScreenWidth()) - bkgSW) * 0.5f;
|
||||
bkgSHO = ylOffset;
|
||||
} else {
|
||||
bkgSH = (tSW / bkgTW) * bkgTH;
|
||||
bkgSW = tSW;
|
||||
bkgSWO = xlOffset;
|
||||
bkgSHO = ylOffset;
|
||||
}
|
||||
|
||||
// :::::::::::
|
||||
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(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));
|
||||
|
||||
std::list<TBall>::iterator iBall;
|
||||
|
||||
|
||||
+25
-1
@@ -234,10 +234,20 @@ void TMyApplication::LoadResources()
|
||||
{
|
||||
|
||||
TextureNamesToLoad.clear();
|
||||
|
||||
// :::::::::::::::::::::::::::::::::::::
|
||||
// :::::::::::::PTREE LOAD::::::::::::::
|
||||
|
||||
boost::property_tree::ptree Textures_pt;
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + "bg_textures_config.json", Textures_pt);
|
||||
std::string bg_ext = ".jpeg";
|
||||
|
||||
// :::::::::::::::::::::::::::::::::::::
|
||||
|
||||
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"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock3.png", "shutterstock3"));
|
||||
@@ -247,10 +257,24 @@ void TMyApplication::LoadResources()
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock7.png", "shutterstock7"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock8.png", "shutterstock8"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock9.png", "shutterstock9"));
|
||||
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock10.png", "shutterstock10"));
|
||||
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>("levelshot1.png", "levelshot1"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("levelshot2.png", "levelshot2"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("levelshot3.png", "levelshot3"));
|
||||
|
||||
+2
-1
@@ -92,7 +92,8 @@ protected:
|
||||
int levelScreenHeight;
|
||||
float levelScreenRatio = 1.6;
|
||||
|
||||
ParticleEffect lsparkler, rsparkler, tsparkler, bsparkler; // Different directed reflection effects
|
||||
ParticleEffect lsparkler, rsparkler, tsparkler, bsparkler; // Different directed reflection
|
||||
|
||||
ParticleEffect lvlFirework; // Level finished effect
|
||||
|
||||
TGameMenu Menu;
|
||||
|
||||
Reference in new issue
Block a user