Closed BlizzardBunny closed 2 months ago
I have an issue similar to this, unless I misunderstood OP's problem.
I use Raylib with Odinlang:
main :: proc() {
ray.InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, TITLE)
defer ray.CloseWindow()
ray.ClearBackground(Color.background)
for !ray.WindowShouldClose() {
ray.BeginDrawing()
defer ray.EndDrawing()
if !ray.IsMusicStreamPlaying(Music.song_loaded) {
ray.GuiLabel(
{
Pos.label_no_song_playing.x,
Pos.label_no_song_playing.y,
Size.label_no_song_playing.w,
Size.label_no_song_playing.h,
},
Gui.label_no_song_playing,
)
}
}
}
I have posted only the relevant code snippets.
The label shows upon launching my program, which is expected, but when I play a song and the condition is no longer fulfilled, the label persists and is never cleared.
If I reverse the condition, only showing the label when the song plays, the label does not show upon launching my program, and shows when I play a song, but upon pausing the song it also is not cleared.
What do I have to do in order to clear the label?
Hello.
Why is this closed as completed? Has there been a solution to this issue?
Thanks!
@BlizzardBunny This is closed because it is not a raygui issue but a user code issue.
@raysan5 what is the issue with the code?
@BlizzardBunny GuiLoadStyle()
loaded 60 times per second, EndDrawing()
called twice, CloseWindow()
called twice...
EndDrawing() and CloseWindow() are not called twice. There are two calls in the code because it is called in case EXIT and then main() returns. But they are never called twice in the same case.
I will see if moving the GuiLoadStyle() fixes the issue. However, Vonixxx experienced the same issue without calling GuiLoadStyle() at all. Is there also a user code issue in their code block?
@BlizzardBunny I'm afraid that code is not in C, so the language could influence the result.
Could you provide a simple example illustrating the issue?
Also, did you try debugging the code?
Hello. When making a simple test code, the issue does not show up. So it is a user code issue.
Perhaps it has something to do with the switch case or with function calls. Either way, I will continue to debug. Thank you for your help.
Hello! I'm trying to make the screen change when I press a button. I was able to do this using raylib before. However, I recently converted my primitive buttons to raygui buttons. And now, when I press the button, the raygui objects do not disappear when the screen is changed. Currently, I have an enum that determines when the buttons are drawn. But for some reason, they are drawn anyways. I would greatly appreciate any help on this! Thank you!
Here is my code: