Page 4 of 6

Re: CAMERA: scrolling and scaling

Posted: Tue Mar 17, 2009 6:10 am
by whitebear
Bug: Added the camera script to Ninja Ball but the image in the render looks like someone had ran over it with a truck.

Re: CAMERA: scrolling and scaling

Posted: Tue Mar 17, 2009 10:12 pm
by osuf oboys
whitebear wrote:Bug: Added the camera script to Ninja Ball but the image in the render looks like someone had ran over it with a truck.
Provide more information if you want to report anything. What is wrong? I included camera.lua and everything looks like ordinary. I added a stretched resolution and it looks like it usually does (e.g. somewhat pixely if zoomed in a lot, some extra pixels if zoomed out a lot). Were you using a resolution with a different aspect ratio than the game window?

Re: CAMERA: scrolling and scaling

Posted: Sat Mar 21, 2009 2:39 am
by TheMyst
Now what I want to know is why has this not been part of Love already? This kind of thing is almost TOO useful to not include.

Re: CAMERA: scrolling and scaling

Posted: Sat Mar 21, 2009 10:04 pm
by Robin
TheMyst wrote:Now what I want to know is why has this not been part of Love already? This kind of thing is almost TOO useful to not include.
I think this quote might answer your questions:
mike wrote:In the original idea we were going to be making an all-encompassing system with it's own GUI for browsing games, GUI system, A* navigation algorithm, map creation kit, kittens and giggles, etc, but that soon became unfeasable because the backbones of the system weren't implemented yet (image handling, sound, text, etc). As we worked on it the focus shifted from providing everything but the kitchen sink to more of making a good system for letting people provide their own features. We were going to have a built-in GUI system (see another thread somewhere on this forum), but people started making their own libraries so it quickly became apparent that building a good TOOL for people to base their work around was better than making it all ourselves (takes less time too).

Re: CAMERA: scrolling and scaling

Posted: Sun Mar 29, 2009 10:53 pm
by Zetty
Hi all,

I am trying out CAMERA, and I was wondering if someone could provide an/another example of redrawing a GUI in the same place while the rest of the screen moves? If I'm not mistaken, it needs two cameras?

Right now I'm using the "Screen following a body" but I believe I need another camera so it can redraw the GUI correctly? I'm having some trouble wrapping my head around the whole camera thing as it is. :|

Re: CAMERA: scrolling and scaling

Posted: Thu Apr 09, 2009 2:11 pm
by Matkins
I need to create a psuedo 3D effect where basically a background layer moves slower than the foreground layer. Can i do this with CAMERA? Thanks.

Re: CAMERA: scrolling and scaling

Posted: Fri Apr 10, 2009 3:34 pm
by osuf oboys
Zetty wrote:Hi all,

I am trying out CAMERA, and I was wondering if someone could provide an/another example of redrawing a GUI in the same place while the rest of the screen moves? If I'm not mistaken, it needs two cameras?

Right now I'm using the "Screen following a body" but I believe I need another camera so it can redraw the GUI correctly? I'm having some trouble wrapping my head around the whole camera thing as it is. :|
See them as cameras you place in the world. They all look at different things but everything is drawn (in order) to the same screen. You can have one camera over there where the bad guys are fighting and one camera over there at the plaster scoreboard. When you draw something, it is only captured by the camera you are currently looking at. So you first want to look through the bad guy camera, draw the bad guys, switch and look through the scoreboard camera, and draw the scoreboard. As such, it won't be a problem if the two camera are even next to each other, the bad guys only exist while they're being drawn. So: create two cameras that look at a large enough scene each (e.g. small guys, large scoreboard - make the first camera look at something small and the second something large), set the bad guy camera as active, draw bad guys, set the scoreboard camera to active, draw the scoreboard.

See the example at http://love2d.org/wiki/index.php?title=CAMERA:Examples.

Re: CAMERA: scrolling and scaling

Posted: Fri Apr 10, 2009 3:36 pm
by osuf oboys
Matkins wrote:I need to create a psuedo 3D effect where basically a background layer moves slower than the foreground layer. Can i do this with CAMERA? Thanks.
Certainly, take a look at the "ball for a stroll" demo at the start of this thread, the clouds are moving when you move but slower than the foreground.

Re: CAMERA: scrolling and scaling

Posted: Mon Apr 13, 2009 3:48 pm
by Tabasco
I kept meaning to check this out but I haven't had a lot of time. I just hooked it into MD in about five minutes with a few minor adjustments.
This has great utility, thanks for providing it.

Right now I'm performing the nasty love.system.restart() when resolution changes because just resetting the camera after calling love.graphics.setMode() doesn't seem to work. If there's a workaround that I'm missing, please let me know.

Again, thanks for this library, it's extremely useful.

Re: CAMERA: scrolling and scaling

Posted: Tue Apr 14, 2009 2:54 am
by osuf oboys
Tabasco wrote:I kept meaning to check this out but I haven't had a lot of time. I just hooked it into MD in about five minutes with a few minor adjustments.
This has great utility, thanks for providing it.

Right now I'm performing the nasty love.system.restart() when resolution changes because just resetting the camera after calling love.graphics.setMode() doesn't seem to work. If there's a workaround that I'm missing, please let me know.

Again, thanks for this library, it's extremely useful.
Ah, I'm sorry, I see why you had difficulties getting it to work as you wanted it to. For mouse callbacks, I change the camera to the "mouse camera" and back again after the callback. The camera you were changing to in the callback was therefore discarded and the game used the old resolution to draw. I'll upload a new version when I get back tomorrow. Do note that you do not need to reinitialize the GUI when changing cameras and that maincam is not needed.