vitaflo
YaBB Newbies
Offline
Posts: 10
Scrolling and Clipping Text?
Dec 28th , 2005, 9:44pm
Ok, I've tried just about everything I can think of here and nothing seems to be working. Let me preface this by saying my main coding experience comes from Javascript and DHTML, so I know that Processing in itself is a different way to think about how to interact with things, and I think that difference is stumping me. What I want to do (at least in theory) seems rather easy. I have a string I'm outputting to the screen. This works well enough. However one thing I want to do is clip the text, so that it's contained in say a 400x300 px box. Any text overflow outside that box is not shown (clipped). I then want to be able to scroll the text inside that clipped box. Basically I want it to work like a Javascript scroller, similar to what I can do online, like I did here (click the arrows to scroll): http://brentgustafson.com/dump/dom/ASM_Scroller3/scroller.html I can "move" the text in P5 by overwriting it slightly higher or lower on screen, but I have to wipe the entire screen and redraw all my other elements every frame to do this. Is this the only way to move anything in Processing? In JS I can just tell it to move the Div with the text in it. Is there any way I can just make the text some sort of object where I can just move it up or down and not have to redraw everything? I also noticed the default renderer (Java2d is it?) is pretty slow when writing out text. P3D is much faster but the text isnt' antialiased. Is that just how it is? Can I get antialiased text in P3D, or would that slow it down? Anyway, if anyone could set me on the right path I'd appreciate it. If you look at that javascript example, that's basically exactly what I'm trying to do (though note the JS example uses an img of text, not real text, but it would work if there were normal text in that scrolling div). I'm just at a loss as to how to do it, especially the clipping and whatnot. As an asside, if anyone knows how to make rounded rectangles as well, I'd appreciate that info too. I can make them with some arcs and a few rects, but if there's code to just do a simple rounded rect that I'm missing it'd be great to know. Thanks for any help. Sorry for all the questions.