Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Rytif

Pages: [1]
1
Graphics / [Solved] Sprite Rendering Problem
« on: August 11, 2010, 09:41:13 pm »
Hello, I'm loading a 1024x1024 tilemap that is divided into 16x16 tiles. Each tile is drawn with the sf::Sprite using a subrect of the tilemap. All tiles are being retrieved correctly, but the quality of the tiles are very low. Here is the difference between the sfml (left) and c# gdi+ (right) versions:



It looks like maybe the tiles are being stretched or it could be something with my window settings.

Code: [Select]


         tile->sprite.SetImage(tileMap->GetTexture());
 
         sf::IntRect rect;

/* Set position */
tile->sprite.SetPosition((float)(tile->column * tileWidth), (float)(tile->row * tileHeight));

/* Grab the tile definition from the tilemap */
int tileRow = tile->index / tilesPerRow;
int tileColumn = tile->index % tilesPerRow;

rect.Left = tileColumn * tileWidth;
rect.Right = (tileColumn * tileWidth) + tileWidth;
rect.Top = tileRow * tileHeight;
rect.Bottom = (tileRow * tileHeight) + tileHeight;

tile->sprite.SetSubRect(rect);


Code: [Select]


/* Initialize window */
sf::WindowSettings settings;
settings.DepthBits         = 24; // Request a 24 bits depth buffer
settings.StencilBits       = 16;  // Request a 8 bits stencil buffer
settings.AntialiasingLevel = 2;  // Request 2 levels of antialiasing

window = new RenderWindow(
VideoMode(Globals::ScreenWidth,
Globals::ScreenHeight, 32), "Game Window",
sf::Style::Close, settings);



I'd appreciate any help on this.

Thanks

Pages: [1]