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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - FrankHamill

Pages: [1]
1
General discussions / Project keeps loading old code?
« on: September 22, 2022, 03:49:45 pm »
I had written a simple few lines of code that opened the window and showed a .png file. I had closed out and reopened it and then tried to get the program to show a different sprite, but it still showed the old sprite. After around 10 minutes of fiddling with the code, I deleted all of it in hopes of rebuilding it into something new. When I run the program with new code the old 'code' still loads with the sprite.

I receive no errors that I'm aware of, and I'm at a loss for what to do. I was in 'release' mode if that helps and I tried switching to debug to see if that's changed anything, but for debugging it just states "Hello World.", and for release, it just shows the old sprite. What did I do wrong?

2
Graphics / Is there a function to sort through pngs?
« on: September 18, 2022, 02:55:57 am »
I plan to have say 100 structs inside a vector, and inside each struct, I would like a unique corresponding png file which I have aptly named 000.png - 100.png. At the moment, I have to manually tell each struct to save a texture (ex: texture.loadFromFile(000.png), texture1.loadFromFile(001.png), texture2.loadFromFile(002.png), etc.).

 Is there a faster, quicker, or automated way to do this such as a 'for' or 'while' function/loop? (I realize that not all files should be loaded at once, and I don't plan to do that, but typing out texture.loadFromFile(000.png) 100 individual times because rather monotonous and seems as though it would have an easier solution.)

Thanks for any help, I'm still new to this!

3
General / Function for loading multiple textures?
« on: September 17, 2022, 03:08:15 am »
I've looked on the message boards for a good minute, and perhaps I'm searching for the wrong criteria because I can't find an answer and I'm certain this isn't an original question. (I searched 'Loading Multiple Textures'.)

Is there a faster method of loading textures than simply copying and pasting texture.loadFromFile("C:\...") for each and every texture? I have all my pngs I would need in a large folder with multiple subsets folders, is there a function that would allow me to sort through the contents and assign each one to a texture?

something like:

vector <sf::Texture> saved_text = {};

for (int i = 0; i < folder.size(); i++){

sf::texture new_text.loadFromFile("folder");

saved_text.push_back(new_text);

}

Any advice would be helpful, I'm new to SFML and the SFML page on loading textures doesn't seem to address my particular issue.

Pages: [1]
anything