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

Author Topic: Loading texture failing  (Read 2131 times)

0 Members and 1 Guest are viewing this topic.

noaboa

  • Newbie
  • *
  • Posts: 14
    • View Profile
Loading texture failing
« on: July 28, 2015, 11:32:55 pm »
Hi, im new to SFML and trying to load a texture. But I get an error message
failed to load image "images/SplashScreen.png". Reason: Unable to open file.
I have added the images folder to every class but it wont work. Does anyone know why? I use SDML 2.3

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Loading texture failing
« Reply #1 on: July 29, 2015, 02:21:54 am »
SDML? :D

Make sure to have the file in the working directory with the correct access rights.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Re: Loading texture failing
« Reply #2 on: July 29, 2015, 05:34:03 pm »
also it can be caused by doyble slash (//) instead of
"images\SpalshScreen.png"
use
"images\\SpalshScreen.png"

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Loading texture failing
« Reply #3 on: July 29, 2015, 05:38:57 pm »
Please don't advocate \\ for file paths. Using backslashes is Windows specific where as frontslash / is cross platform.
But yes, a single \ is probably not what's intended.
« Last Edit: July 29, 2015, 05:46:32 pm by Jesper Juhl »

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Re: Loading texture failing
« Reply #4 on: July 30, 2015, 02:14:32 pm »
Yes, you are right, Jesper Juhl, he should use
"\\"
on windows platform and
 "/"
for crossplatform app. ;)

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Loading texture failing
« Reply #5 on: July 30, 2015, 02:16:17 pm »
No. Not even on Windows should he use \\ - he should always use / even on Windows.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Loading texture failing
« Reply #6 on: July 30, 2015, 04:10:31 pm »
he should use "\\" on windows platform
There's no reason to use backslashes on Windows for paths. Just because when you copy and paste from its file explorer, it gives you backslashes, doesn't mean you can't change them, especially since you'd be adding extra backslashes in anyway.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*