clay icon indicating copy to clipboard operation
clay copied to clipboard

Raylib example broke

Open EmmanuelMess opened this issue 10 months ago • 7 comments

The raylib example is broken and doesn't scroll

Image

EmmanuelMess avatar Feb 23 '25 15:02 EmmanuelMess

Okay, I was missing the font file, but I think it broke more than it should have (see the overwriting text at the bottom.)

EmmanuelMess avatar Feb 23 '25 15:02 EmmanuelMess

I just had this issue too, I copied the resources folder to be next to the program file, and it looks like it should. Perhaps the build system should copy those files to the output folder for us?

hexmaster111 avatar Mar 03 '25 22:03 hexmaster111

I just had this issue too, I copied the resources folder to be next to the program file, and it looks like it should. Perhaps the build system should copy those files to the output folder for us?

Even without the resources it shouldn't look like this. It should copy the resources when building.

EmmanuelMess avatar Mar 04 '25 12:03 EmmanuelMess

If you take a look at the Raylib_MeasureText Method here, it looks like when the font had failed to load, it returns Clay_Dimensions textSize = { 0 }; as the font size, so the text stacking up like that makes sense, as clay would have gotten a measurement of zero height.

Perhaps adding a IsFontValid() call to where the font is loaded to check and then the application exits with a missing font message would help with user confusion?

hexmaster111 avatar Mar 04 '25 14:03 hexmaster111

Perhaps adding a IsFontValid() call to where the font is loaded to check and then the application exits with a missing font message would help with user confusion?

yes, and the text is visible, so the return value of 0 is wrong.

EmmanuelMess avatar Mar 04 '25 14:03 EmmanuelMess

so the return value of 0 is wrong

True, I think i'll work to update the render to measure the default RayLib font then if a loaded font is invalid. Thanks for pointing that out to me!

hexmaster111 avatar Mar 04 '25 14:03 hexmaster111

If you check out #305

Now we can use the default raylib font and it looks kinda alright.

Image

turns into

Image

hexmaster111 avatar Mar 04 '25 15:03 hexmaster111