I could be completely mistaken here, so please ignore if so, but …
I think you want the programmer to be able to write different screensaver codes, that will need different “state” objects, right? Why not use functors/modules, so that you get polymorphism, but for any one instance of a screensaver program, you have only a single state type ?