Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7858505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:28:18+00:00 2026-06-02T21:28:18+00:00

So I got tileset like this: Tileset How do I load only one tile

  • 0

So I got tileset like this: Tileset

How do I load only one tile from it in SFML?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:28:19+00:00Added an answer on June 2, 2026 at 9:28 pm

    Load the image into a texture (either sf::Image if using SFML 1.6, or sf::Texture if using SFML 2.0), and then set the sub-rect for the sprite. Something like this (using SFML 2.0):

    sf::Texture texture;
    texture.loadFromFile("someTexture.png"); // just load the image into a texture
    
    sf::IntRect subRect;
    subRect.left = 100; // of course, you'll have to fill it in with the right values...
    subRect.top = 175;
    subRect.width = 80;
    subrect.height = 90;
    
    sf::Sprite sprite(texture, subRect);
    
    // If you ever need to change the sub-rect, use this:
    sprite.setTextureRect(someOtherSubRect);
    

    For SFML 1.6, it’s more like this:

    sf::Image image;
    image.LoadFromFile("someTexture.png"); // just load the image into a texture
    
    sf::IntRect subRect;
    subRect.Left = 100; // of course, you'll have to fill it in with the right values...
    subRect.Top = 175;
    subRect.Right = 180;
    subrect.Bottom = 265;
    
    sf::Sprite sprite(image);
    sprite.SetSubRect(subRect);
    

    Note that you may want to disable smoothing for the image/texture, depending on how you’re using your sprites. If you don’t disable smoothing, the edges may bleed (like texture.setSmooth(false) or image.SetSmooth(false)).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got a query like this: SELECT * FROM job WHERE status!=2 AND status!=3 UNION
Got this as an interview question from Amazon to test basic SQL skills and
Got it from php.net, but I am not sure is this how everybody destroy
Got something like this <div class=something> <div></div> <p> Some text here </p> </div> This
got code looking like this: // This is com.n.common.Networking.downloadBmp( ) function // ... byte[]
Got a partial answer from searching in this thread: Viewing raw RSS feed? But
Got an exception during migration Web application from WAS 6.1 to WAS 7. This
Got a weird one. I've managed a bring it down to a very simple
Got this: http://jsfiddle.net/NdsF8/ Want it to be dynamic so when you click a new
Got this error while trying to get the variables out of a class. Using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.