Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411415 Posts in 69361 Topics- by 58415 Members - Latest Member: sophi_26

April 16, 2024, 03:07:33 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Content Management
Pages: [1]
Print
Author Topic: Content Management  (Read 592 times)
Colm
Level 0
*



View Profile WWW
« on: October 19, 2017, 11:18:11 AM »

Hey, I was wondering what other people do for managing assets in their games.

At the moment I just have a ContentManager class with a getImage() function that loads images from a specified path and makes sure you don't take up extra memory by having more than one copy of an image loaded at once. This certainly isn't the greatest method, because if I rename a directory, then I have to change every getImage() call that references something from that directory to use the new names.

Any better ideas? What do you personally use in your games?
Logged
ferreiradaselva
Level 3
***



View Profile
« Reply #1 on: October 19, 2017, 02:31:28 PM »

Why not detect the directory the program started from and store that string during the program life-time. Then, when you use any loading function, you just call by the relative directory:

getImage(context, "/texture.png"). The function will append that argument string to the directory string that you had saved.

Any better ideas? What do you personally use in your games?

I personally stopped loading content from external files. Now, I just convert the content into C headers (char array) and load from there. No need to redistribute files other than the executable itself + I don't need to worry about error checking if the program doesn't find the assets files, bc it's already in memory.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic