OVERRiDE Posted April 4, 2023 Share Posted April 4, 2023 Hi guys, It seems that after any call to rapPrint in one vsync, the text is retained through all subsequent vsync cycles and displayed on all frames thereafter. I need to know how to truncate the internal text buffer used by the API. I'm not seeing any documentation on how to clear this text buffer, but this is producing some odd artifacts in my project: If I am printing different text on the same line across different frames, I have to add whitespaces in the text to clear extra characters from the previous frame. Example; in one frame I print "Hello, world!" on a line, if on the next frame I print "123" on the same line, "123lo, world!" is actually displayed. To mitigate this, I am having to add whitespaces as "123 " to get my expected result. If I want to remove an entire line of text that was rendered in a previous frame, I have to print an entire line of text that is all whitespaces to get this cleared from the screen. This is far from optimal. This happens even if I am pointing js_r_textbuffer to different character arrays(strings) in RAM - so there must be some internal caching in the API that needs to be cleared. I can post examples if needed, but I think this explains it pretty well. As always, any help appreciated! Quote Link to comment Share on other sites More sharing options...
Fadest Posted April 4, 2023 Share Posted April 4, 2023 The test is printed in a frame buffer that you have to clear by yourself. This is usefull for user interface stuff that don't change every frame, juste print once, and keep them forever. To clear the frame buffer, just call cls() 1 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted April 4, 2023 Share Posted April 4, 2023 (edited) Hi, It's not cached, the print commands "draw" the text directly to the particle layer. So they will persist once you have printed. There is a CLS() command to clear the whole buffer, or as you've already been doing, you can print "whitespace" over old text, which is actually quicker than clearing the whole particle layer with CLS, if it's only a few areas. Edit: As Fadest said, you're better off printing once and just print over values that change as and when. If you CLS and print everything every frame, you will notice slowdown (just printing every frame is ok though). Edited April 4, 2023 by Sporadic Quote Link to comment Share on other sites More sharing options...
LordKraken Posted April 5, 2023 Share Posted April 5, 2023 That is a pretty neat implementation, considering how heavy printing text can be on the cpu Quote Link to comment Share on other sites More sharing options...
+CyranoJ Posted April 5, 2023 Share Posted April 5, 2023 9 hours ago, OVERRiDE said: I'm not seeing any documentation on how to clear this text buffer, but this is producing some odd artifacts in my project: If I am printing different text on the same line across different frames, I have to add whitespaces in the text to clear extra characters from the previous frame. Example; in one frame I print "Hello, world!" on a line, if on the next frame I print "123" on the same line, "123lo, world!" is actually displayed. To mitigate this, I am having to add whitespaces as "123 " to get my expected result. If I want to remove an entire line of text that was rendered in a previous frame, I have to print an entire line of text that is all whitespaces to get this cleared from the screen. This is far from optimal. This happens even if I am pointing js_r_textbuffer to different character arrays(strings) in RAM - so there must be some internal caching in the API that needs to be cleared. This is working as intended, as others above have responded. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.