- better handling of map preview for different resolutions

This commit is contained in:
Mark Vejvoda 2011-02-08 20:17:16 +00:00
parent 17e2a87890
commit 5623866779
2 changed files with 5 additions and 4 deletions

View File

@ -4457,6 +4457,7 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
float playerCrossSize = 2;
float clientW = renderMapWidth * cellSize;
float clientH = renderMapHeight * cellSize;;
float minDimension = std::min(metrics.getVirtualW(), metrics.getVirtualH());
// stretch small maps to 128x128
if(map->getW() < map->getH()) {
@ -4477,7 +4478,7 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
Texture2DGl *texture = static_cast<Texture2DGl *>(*renderToTexture);
texture->setMipmap(false);
Pixmap2D *pixmapScreenShot = texture->getPixmap();
pixmapScreenShot->init(metrics.getVirtualW(), metrics.getVirtualH(), 4);
pixmapScreenShot->init(minDimension, minDimension, 4);
texture->setForceCompressionDisabled(true);
texture->init(textureFilter,maxAnisotropy);
texture->setup_FBO_RBO();
@ -4492,8 +4493,8 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
if(supportFBOs == true && renderToTexture != NULL) {
cellSize =1;
clientW = metrics.getVirtualW();
clientH = metrics.getVirtualH();
clientW = minDimension;
clientH = minDimension;
int mapMaxDimensionSize = std::max(map->getW(),map->getH());
switch(mapMaxDimensionSize) {
case 8:

View File

@ -1214,7 +1214,7 @@ void MenuStateCustomGame::render() {
renderer.renderTextureQuad(800,600,200,150,factionTexture,0.7f);
}
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");
}