Hey, guys.
I'm working on a 2D space-sim game. There are a bunch of background elements: stars made of vertices and allocated in a VertexArray, large images for nebulas, and so on.
I'm looking for a way to get the background to loop around on itself -- in other words, once you hit the edge of the game world, instead of flying off into uncharted territory, you continue along the other side none the wiser.
I thought of a few ways of implementing this, the seeming simplest of which incorporated sf::Views and viewports. Each parallax layer would have its own view so objects could be moved at varying speeds, and when the player approached an edge, the active view's viewport would shrink and a new view's viewport from the opposite side of the map would grow to fill in the blanks.
I had more or less finished this sort of implementation before I realized that I would have to draw all of my background elements multiple times (once for each view). I can't think of any way to limit the background objects to those within a given view, since there are just so many vertices in my VertexArrays: the game slowed to a crawl when I last tried.
I can post what I've got, but first I figured I would ask about my methodology before cluttering this post with code. Is what I'm trying to do feasible (and then not entirely illogical), or is there some better way that I haven't come up with yet?
Thanks for reading through my post. Let me know what you think!