Fatrat's BeOS Projects: Text Crawler



The Text Crawler screensaver add-on for BeOS moves a string of words around the screen, with some different choices for the way in which the words move.

Current version: 0.31 --- 2005.01.09


Project notes...


2005.01.09 - (v:0.31) A few minor changes to the selection dialogs, and fixed a bug with the way effects were chosen randomly (they weren't random before); minor improvements to code.

2002.03.07 - (v:0.30) Had a chance to hammer out the last few annoying bugs, so this is finally ready for initial release (yay!) I also added the curved text effect I wanted (characters move along a Bezier curve :) ) which wasn't nearly as bad as I thought it would be. Some time spent updating the web pages for this and writing the Readme file, setting up the icon etc. for the binary... It's all ready to go!

I ran into a doozie of a bug that ate up a lot of time debugging today. It was the oddest thing, when I changed the *name* of the screensaver module and tried to run the ScreenSaver Preferences menu, it would crash hard trying to load my module. The bug turned out to be associated with the way I was reading the stored string name from the BMessage that the screensaver system hands you when you start up :/ When the saver was a different name, the string object wouldn't be in the BMessage (or, it would be there but have a length of zero) and bad things would happen...

Things that are left on my "to-do" list (for the next release):

There's some minor optimizations to be made, but for now I just want to get a working version out there and start getting bug reports and feedback. Whee :)


2002.03.05 - (v:0.21) Not much done tonight, only had a little time to work on "fun" stuff. Got the blits between the back buffer and front buffer fixed so that only the region that was updated is changed; big performance boost, but I expected that. Fixed one or two other little bugs, cleaned up some of the code. The big thing that needs to be done now is the custom color picker, and then I'll be happy enough with the screensaver to make an initial release.

I did a little research on color picker widgets, and I think one with an HSV color space is what I'll be happiest with. The picker I have in mind will basically have a vertical slider on the left side for brightness, and a big rectangle of colors to the right of that for selecting hue and saturation values. A color swatch will live on the right side of the widget, indicating the actual color chosen (or two swatches and a button to commit a color to become the currently selected one; the second swatch acts as a refernce for the user to pick their new color against.) I looked into the BControl class a little, since I'll derive my picker from that... shouldn't be too bad, and when it's done I'll probably clean it up and offer it as a widget for anyone to use. Whee.


2002.03.04 - (v:0.20) It's again 3am when I decide it's time to step away from BeIDE and head to bed... Still don't have everything I had hoped for working, so it'll have to be a few more coding sessions before this goes up on BeBits. It's so close this time, though - and it looks better than I had planned. I let it run all night on my machine and it didn't crash, so that's a good sign :)

The tabbed config menu worked out nicely. Unfrotunately the default color picker (BColorControl) that comes in the BeOS Interface Kit is too wide to fit in the limied view space given in the screensaver preferences configuration view, and kinda' sucks IMO. The only screensaver that I've seen use it had a scroll-bar over top of the whole view, to let you pan the tabbed view area to get to the rest of the color picker controls -- very icky. I'm going to end up writing one of my own, I guess; hopefully it won't prove to be too difficult :/ Probably just going to make a block of three color ramps (RGB, leave out the useless Alpha channel that the stock color picker has) and a block to the side showing the current selected color; make it scale properly to the region specified, so it'll work as a solution in future limited layout space situations. I toyed with the idea of making something really fancy like a 3D cube to pick the colors, but that'll be a future endeavor :)

I had pondered just using a set of three sliders for the color values, but I'd like to do something more elegant and intuitive... Currently the default color for the text is white, and there's a checkbox to have the screensaver pick random colors each time it starts up. Background color is always black, don't know if I'm going to allow users to change that or not (the point of a screensaver would be defeated if the background was some solid color other than black, but hey...)

Stumbled over a major memory leak, I was assuming that memory allocated would be freed up when the module was unloaded - not so! Since the ScreenSaver Preferences panel is the 'owner' of the memory, it would just keep allocating more and more memory if you picked another screensaver, and then went back to my module in the checklist... at an alarming rate, actually, because my display back-buffers were being re-allocated each time! I found at least one other screensaver (one not written by me) amongst the many that I have installed that apparently has the same kind of memory leak... Fixed it in mine, just had to delete my stuff when StopSaver() was called. Always remember to call RemoveChild() on a BView attached to a BBitmap before deleting the BView! :)

Another surprise was the way BMessage stores/retrieves strings. Storing is pretty standard with an AddString() call, but the partner FindString() doesn't hand back a string - it hands back a pointer to the string, which it keeps until the BMessage is deleted. Grr. (So you get the pointer, then copy over the data to your own buffer before you finish with the BMessage holding your string.) Yes it's documented in the BeBook, and yes it makes sense to do it this way to keep things consistent (passing a pointer to variable to hold the data to FindInt() etc.) but I still didn't expect it for some reason. Or maybe it was after 2am and I was sleepy. It works now, though.

Speaking of the BeBook... Be's site has gone away save for a message to their stockholders about how the company will be dissolved later this month (sniff, sniff!) so the BeBook isn't there anymore, or any of the other great documentation and tutorials they used to host. Luckily the BeBook comes with BeOS R5 Pro, so I'll always have my copy... still need to find copies of all the old newsletters, etc. that were hosted on be.com and the Classic Be site, though.

The four basic effects I was after (horizontal text crawl, angled text crawl, bouncing, and random positions) all work fine, it cycles between them, renders in any selected font size or color, etc. You can use a text string that you provide, or have it display the wall clock time instead (in 12 or 24 hour format.) Sliders control the font size, delay between drawing (overall animation speed, basically; making it slower also frees up more CPU cycles) and the time before it cycles to a new effect. Checkboxes let you pick which effects you do and don't want used. And the random color selection is there as I mentioned above, but I still need the color picker. It remembers settings between invocations, too.

The remaining bugs are few, but I still want to fix them before releasing this. I want the colors to fade as one effect ends and the next starts, need to get that working. The choice of which effect to use next when one expires is still a little buggy, too - sometimes it'll pick the text crawl effect whether it's selected or not. I changed things so that when the angled text is being drawn, it changes the orientation of the text so that it's facing upwards - this looks better for some short strings, but for longer ones it just looks stupid; I think I'm going to switch it back to the original setting, which allows text that's moving towards the right side of the screen appear upside-down :) And the drawing is still being done by copying the whole back buffer to the current framebuffer, when copying only one part would be enough (and faster.) ... I haven't had a chance to put Bezier curve motion in yet, since I was focusing on the UI for the configuration menu. An overall cleanup of the source code is due as well, there's too many sections of code that either don't have enough comments to remind me of what I was trying to do, or long sections of unused code that are commented out; it's messy.

All in all, it's coming along nicely. Maybe I'll have it done by next weekend... I'm learning and having fun putting it together, and that's what's important! :)

And in somewhat unrelated news, I'm going to be getting a new laptop soon :) The Compaq Presario 1200 I have now has been serving me well for the past year and a half, but it has enough little quirks (buggy audio under BeOS, APM problems, no internal ethernet, no internal CD-RW available) and performance issues (VESA graphics only, and very slow due to shared memory issues!) that I'm going to move up one step to the laptop I almost bought when I got this one - the Presario 1700. More speed, better graphics (especially for BeOS, since there's a real driver for it! No more VESA!), much better disply, yadda yadda. Hopefully the audio will work too, I'm pretty sure it has an audio chip that has an available driver. Overall the upgrade is going to cost me around $400, after I sell off the one I have now. Yay for eBay!

Enough babbling for now, I'm off to bed... Zzz...


2002.03.03 - (v:0.15) Well it's 3am and I have most of what I wanted for the basic effects done, just cleaning things up and hunting down a couple of bugs before I post an early version of this on BeBits. Learned all about BTabs and some other fun UI components, as well as becoming quite familiar with the font API stuffs... I love the BeOS APIs...

I had a hard time getting my double buffering scheme to allow for minimal drawing - right now I copy the entire back buffer to the front each frame, but I wanted to try and only draw the area that was updated on the screen, and save on total pixels pushed per frame... This is a screensaver after all, and it should be saving cycles where it can (so that they can be used for RC5 key cracking :) ) Probably the most annoying thing I ran into was using the BTabView setup for my configuration menu (it works very nicely :) ) Usually when you write your first screensaver, or other BView stuff, you do your creation of widgets inside of AttachedToWindow() - but this gets called for the views in a BTabView EACH TIME the tab is selected; at first I was creating tons of widgets that were being lost (memory leaks), and confused as to why my UI controls weren't keeping their state... easy to fix, but it took me a little while to realize what was going on.

Hopefully I'll get to put some more time into this today and get this finished before the work week starts up again. I'll be dreaming of UI controls and widgets tonight, I'm sure :) I also found a nifty page with Java examples of doing Bezier curves with source code, so I should have no problems getting that to work soon...


2002.03.01 - (v:0.10) Recently I realized that there isn't an equivalent of the Windows "Marquee" screensaver for BeOS - for those who haven't seen it, Marquee just scrolls a sentence that the user picks across the screen in big ugly pink letters, shearing and jittering all the way... it's a throwback from the Windows 3.1 days I believe, and can be seen on countless desktop computer screens, cash registers, etc. these days. Anyway, there isn't a screensaver like this for BeOS, and I have a couple of hours to kill this weekend...

I've already got the basics done, just need to add on a control panel that allows users to input a custom text string, and maybe add a slider to control the delay before moving the string. Right now it just draws the words in a random position on the screen and moves them every few seconds, but the scrolling part won't be difficult. The BFont class is really cool, and has some great stuff built into it for rendering fonts easily; I wish Xwindows had something this cool...

I have plans for some nifty features for this screensaver; afterall, it wouldn't do to just copy the same boring thing Windows has - BeOS is COOL! :)

We'll see which ones I actually get around to implementing :)




Back to the main projects page


Email me with comments, etc. --> fatrat@fat-rat.com