Open DhruvaSambrani opened 2 years ago
Also, ALSA lib conf.c:4563:(snd_config_update_r) cannot access file /usr/share/alsa/alsa.conf
pops up just before this error is thrown. Note that I have applied the fix as suggested in #42, and audio works well until this error.
Hi. I'm having the same problem with fonts. It seems like the following function loads a new instance of the same font file every time we create a new TextActor. The second line of the function creates a new TextActor and it never closes the TextActor.
function TextActor(text::String, font_name::String; font_size=24, color=Int[255,255,0,255], kv...)
font = TTF_OpenFont(file_path(font_name, :fonts), font_size)
sf = TTF_RenderText_Blended(font, text, SDL_Color(color...))
w, h = size(sf)
a = Actor(
text,
sf,
Rect(0, 0, Int(w), Int(h)),
[1.,1.],
0,
255,
Dict{Symbol,Any}()
)
for (k, v) in kv
setproperty!(a, k, v)
end
return a
end```
@MrZarfir good find. Can you try adding a TTF_CloseFont(font)
call after the sf = TTF_Render_Text(...)
call and test if your problem goes away?
@MrZarfir good find. Can you try adding a
TTF_CloseFont(font)
call after thesf = TTF_Render_Text(...)
call and test if your problem goes away?
Indeed, my problem goes away after adding a closing call. I don't have access to push the new change to a new branch, but it would be appreciated if you can add this small change (unless you can give me access so I can push it).
Thank you for your quick response.
don't have access to push the new change to a new branch
@MrZarfir You don't need push access to collaborate on an open source repository. You typically create a fork, and make a pull request from there. See this github documentation
Hower, in this case, I have created this pull request here: #64
I made my own version of the flappy bird game, and I face this issue if I play it for a while. It looks like GameZero is not GC-ing some images(?)
Note, I change the bird image everytime I press space, and for a game like flappy bird, that is quite often. I thought the image will be reused?