1
General / Re: Texture is not loading
« on: Today at 02:36:21 pm »
You can't just put an object outside of any scope and expect it to just work.
You need to learn a bit more about scopes and lifetime, plus compilation units.
It's recommended to not use global variables, but use the class scope, if you want to share something across multiple functions.
Maybe you actually wanted to load the texture on the tile class instead of bgtex that lives outside of everything?
Personally, I recommend to use something like a ResourceHolder and pass a reference to where you want to use a texture.
You need to learn a bit more about scopes and lifetime, plus compilation units.
It's recommended to not use global variables, but use the class scope, if you want to share something across multiple functions.
Maybe you actually wanted to load the texture on the tile class instead of bgtex that lives outside of everything?
Personally, I recommend to use something like a ResourceHolder and pass a reference to where you want to use a texture.