raidho36 wrote:You, of course, shouldn't load graphics for all 3.2k cards all at once - a measly 256x256 image is full 256 kilobytes of data, times 3.2k that becomes 800 megs of graphics memory. Only load it when it has to show up on the screen.
Yes, card pics will only be loaded when they show up. Decks consist of 30 cards and you can repeat them up to 3 times, so that's usually less than 60 card images per match. Deck edit screen won't show every the images right away either...
-----
Can I ask one more question? I realized that having two tables was not practical at all so I merged them together before going back to löve to test if I can keep any data from the db file in a table in lua, but even working with the callback function, there are some errors:
Code: Select all
--require stuff
local sqlite3 = require "sqlite3"
local db = sqlite3.open("cards.db")
local cards = {}
function love.load()
--build the cards table
if db then
local sQuery = 'SELECT * FROM base;'
db:exec(sQuery,to_table)
end
--print(cards[13].name) --this is commented out because it caused the error
end
--callback for the db:exec
function to_table(udata,cols,values,names)
print('table for a card created')
cards[values[1]] = {}
for i=1,cols do
cards[values[1]][names[i]] = values[i]
print('table element: ' .. cards[values[1]][names[i]])
end
return 0
end