- better handling of map preview for different resolutions
This commit is contained in:
parent
17e2a87890
commit
5623866779
|
@ -4457,6 +4457,7 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
|
||||||
float playerCrossSize = 2;
|
float playerCrossSize = 2;
|
||||||
float clientW = renderMapWidth * cellSize;
|
float clientW = renderMapWidth * cellSize;
|
||||||
float clientH = renderMapHeight * cellSize;;
|
float clientH = renderMapHeight * cellSize;;
|
||||||
|
float minDimension = std::min(metrics.getVirtualW(), metrics.getVirtualH());
|
||||||
|
|
||||||
// stretch small maps to 128x128
|
// stretch small maps to 128x128
|
||||||
if(map->getW() < map->getH()) {
|
if(map->getW() < map->getH()) {
|
||||||
|
@ -4477,7 +4478,7 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
|
||||||
Texture2DGl *texture = static_cast<Texture2DGl *>(*renderToTexture);
|
Texture2DGl *texture = static_cast<Texture2DGl *>(*renderToTexture);
|
||||||
texture->setMipmap(false);
|
texture->setMipmap(false);
|
||||||
Pixmap2D *pixmapScreenShot = texture->getPixmap();
|
Pixmap2D *pixmapScreenShot = texture->getPixmap();
|
||||||
pixmapScreenShot->init(metrics.getVirtualW(), metrics.getVirtualH(), 4);
|
pixmapScreenShot->init(minDimension, minDimension, 4);
|
||||||
texture->setForceCompressionDisabled(true);
|
texture->setForceCompressionDisabled(true);
|
||||||
texture->init(textureFilter,maxAnisotropy);
|
texture->init(textureFilter,maxAnisotropy);
|
||||||
texture->setup_FBO_RBO();
|
texture->setup_FBO_RBO();
|
||||||
|
@ -4492,8 +4493,8 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
|
||||||
|
|
||||||
if(supportFBOs == true && renderToTexture != NULL) {
|
if(supportFBOs == true && renderToTexture != NULL) {
|
||||||
cellSize =1;
|
cellSize =1;
|
||||||
clientW = metrics.getVirtualW();
|
clientW = minDimension;
|
||||||
clientH = metrics.getVirtualH();
|
clientH = minDimension;
|
||||||
int mapMaxDimensionSize = std::max(map->getW(),map->getH());
|
int mapMaxDimensionSize = std::max(map->getW(),map->getH());
|
||||||
switch(mapMaxDimensionSize) {
|
switch(mapMaxDimensionSize) {
|
||||||
case 8:
|
case 8:
|
||||||
|
|
|
@ -1214,7 +1214,7 @@ void MenuStateCustomGame::render() {
|
||||||
renderer.renderTextureQuad(800,600,200,150,factionTexture,0.7f);
|
renderer.renderTextureQuad(800,600,200,150,factionTexture,0.7f);
|
||||||
}
|
}
|
||||||
if(mapPreviewTexture != NULL) {
|
if(mapPreviewTexture != NULL) {
|
||||||
renderer.renderTextureQuad(5,165,180,180,mapPreviewTexture,1.0f);
|
renderer.renderTextureQuad(5,185,150,150,mapPreviewTexture,1.0f);
|
||||||
//printf("=================> Rendering map preview texture\n");
|
//printf("=================> Rendering map preview texture\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user