SFML community forums
Help => Graphics => Topic started by: Haikarainen on May 04, 2011, 09:57:50 pm
-
Hey, im working on an application, that will practice ppl's FPS-Aiming skills.
I need a fixedsize "surface", that will seamlessly loop/scroll. the centerposition of everything will be the mouseposition.
Basically i want to simulate a firstperson-shooter view in 2d, on a flat surface. I hope you get my point here.
My question is; Does anyone have a clue or hint how this could be done? im not asking you to write it for me, just asking for tips because i really dont know where to start on the whole seamless loop/scroll thing.
-
You should attempt to master views and the solution will hopefully become apparent.
SFML 1.6 "Using Views" tutorial (http://www.sfml-dev.org/tutorials/1.6/graphics-views.php)
Getting real-time mouse input will be necessary to set the center position of the view
SFML 1.6 "Handling Events" tutorial (http://www.sfml-dev.org/tutorials/1.6/window-events.php) (scroll down to the "Getting real-time inputs" section)
-
You should attempt to master views and the solution will hopefully become apparent.
SFML 1.6 "Using Views" tutorial (http://www.sfml-dev.org/tutorials/1.6/graphics-views.php)
Getting real-time mouse input will be necessary to set the center position of the view
SFML 1.6 "Handling Events" tutorial (http://www.sfml-dev.org/tutorials/1.6/window-events.php) (scroll down to the "Getting real-time inputs" section)
I've been using views alot before, also realtime input. The problem im having is to have a SEAMLESS looped view.. so if(mousex > rightedge){mousex = leftedge} wont work,
-
I'm not generous enough to write a tutorial, but I'll give you a few hints on one way to implement infinitely looping views:
* The background image will have to contain redundant pixel data on it's right and bottom sides that replicates the left and top sides of the background image respectively.
* The amount of redundant pixel data on the background image's right and bottom sides pertains to how many pixels can be seen in the application at one time minus one.
* The redundant pixels can be added to the image file or dynamically added to the image at runtime.
* The view will reset to the opposite side every time it is about to exceed the image pixels on the X or Y axis.