Maps are back and have color now. TileCell needs a rework.
This commit is contained in:
parent
27bb08d62c
commit
a4c13f7fc9
4 changed files with 6 additions and 10 deletions
|
@ -123,6 +123,8 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) {
|
|||
if(drawEndY >= $height) drawEndY = $height - 1;
|
||||
|
||||
int texX = int(textureWidth * (drawStartX - (-spriteWidth / 2 + spriteScreenX)) * textureWidth / spriteWidth) / textureWidth;
|
||||
int texRenderWidth = texX_end - texX;
|
||||
if(texRenderWidth <= 0) continue;
|
||||
|
||||
float x = float(drawStartX + RAY_VIEW_X);
|
||||
float y = float(drawStartY + RAY_VIEW_Y);
|
||||
|
@ -133,7 +135,7 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) {
|
|||
int texY = ((d * textureHeight) / spriteHeight) / textureHeight;
|
||||
|
||||
sf_sprite->setScale({sprite_w, sprite_h});
|
||||
$anim.step(*sf_sprite, texX, texY, texX_end - texX, textureHeight);
|
||||
$anim.step(*sf_sprite, texX, texY, texRenderWidth, textureHeight);
|
||||
sf_sprite->setPosition({x, y});
|
||||
|
||||
$brightness.setUniform("offsetFactor", sf::Glsl::Vec2{0.0f, 0.0f});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue