Basically, I'm assuming you would want your 100x100 flashlight to not always show the same {0,0,100,100} square region of the game world that would get drawn by default. If you instead want the flashlight to show the {100,100,200,200} region instead, you'll have to move the render texture's view 100 pixels down and 100 pixels to the right before you draw() everything onto it.
For details and code, just read the view tutorial: http://sfml-dev.org/tutorials/2.1/graphics-view.php
Ok, so use sf::View to set the area for the RenderTexture, that makes sense. And I meant pseudocode for the drawing of the full window vs the drawing of the RenderTexture. I'll post what my idea of doing this would be so you can evaluate just how incorrect it is:
sf::RenderWindow window;
window.clear(sf::Color::Black);
window.draw(everythingThatExistsInWindow);
sf::View view;
view.setCenter(mousePosition);
sf::RenderTexture renderText;
renderText.setView(view);
renderText.display();
Does that make sense, or do I have the concept wrong?
Ok I tried that, but I'm getting a weird bug. Tiny white dots appear near where my mouse is, and they aren't cleared everytime, rather they stay on screen. Here is the code for drawing:
void Engine::Process(){
while(window.pollEvent(event)){
if(event.type == (sf::Event::Closed)){
window.close();
}
}
sf::Vector2f mousePos(sf::Mouse::getPosition());
//sf::View
view.setCenter(mousePos);
}
void Engine::Render(){
//sf::RenderWindow
window.clear(sf::Color::Black);
//sf::RenderTexture
flashlight.clear(sf::Color::Black);
//comment the setView() out, program works fine
flashlight.setView(view);
flashlight.draw(board.GetWalls()[0].GetWallShape());
flashlight.draw(board.GetTexts()[0].GetText());
const sf::Texture &texture = flashlight.getTexture();
sf::Sprite sprite(texture);
window.draw(sprite);
window.display();
}
I'm confused as to why this isn't working, but it did work (displayed only the top left 75 * 75 pixels) without setting the RenderTexture's view.