for me it only works if I switch the windows (some other, e.g. terminal) and then switch back.hasFocus is not being initialised (https://github.com/tmsbrg/adventure3d/blob/master/src/main.cpp#L180) and is only being set when the window focus changes so if the application starts with the window having focus already then hasFocus has the value that it started with (uninitialised). In your case, it's being false.
Something with hasFocus is wrong.
Edit: I do think it could be a problem initializing it to true if for some people the window is started in the background. But I'm not sure how to fix that. Is there anyway to know whether you're being started in the foreground with SFML 2.1?i didn't face this problem in my OS, windows always start on focus. for those who has different OS , i not so familiar with SFML, but i think it can be done by creating extra Boolean variable just for first run and "hasFocus" can do its job later on,
Yeah, I was thinking of adding sky and floor similarly. Though I'd also like maybe adding floor and ceiling textures as in the second tutorial (http://lodev.org/cgtutor/raycasting2.html).i haven't covered second tutorial yet, i'm sill stuck in first. :-\
However, the way he does it there is very CPU-focused and would require me to render differently then the line-based rendering I'm doing now. I like that rendering, so I'd rather not change it to something slower! I'm wondering if there's a good fast way to do that with the GPU(Maybe shaders, but I don't have much experience with those).well, the optimization is Evil, i would not recommend it. dont bother yourself with it specially in such early stage of make this game, unless the performance drops down for any reason, that time you may looking for alternatives such as shaders but as far as i know SFML doesn't support vertices shaders, i had made a game similar to what you going to do, i have over +2000 game object i didn't witness any performance except when i implemented the collision as showing here Car racing (http://en.sfml-dev.org/forums/index.php?topic=19433.15), it wasn't big deal it can be solved easy. even though the raycaster doesn't cost much. it was used in 286's, 386's computers,
I'm not sure what you mean with the extra boolean value. I'd still need a way to ask the window whether it's in focus or not right after it was created. Some people can have their system set so new windows don't steal focus. But it's probably not too important. If you start the raycaster you'll be wanting it in focus anyway.sorry i couldn't understand this issue. i thought the problem was if window start without focus then "bool hasFocus" will be initialized to false by "sf::Event::LostFocus", i think this can be solved as i said.
Thanks fer_t for reporting and Hapax for the suggested fix.You're welcome :)
I do think it could be a problem initializing it to true if for some people the window is started in the background. But I'm not sure how to fix that. Is there anyway to know whether you're being started in the foreground with SFML 2.1?window.hasFocus() (http://www.sfml-dev.org/documentation/2.3.2/classsf_1_1Window.php#ac4dce670f07c5039a732ba0903ce3a77)
window.hasFocus() (http://www.sfml-dev.org/documentation/2.3.2/classsf_1_1Window.php#ac4dce670f07c5039a732ba0903ce3a77)
It's in the documentation :P