CAMERA: scrolling and scaling
Re: CAMERA: scrolling and scaling
Bug: Added the camera script to Ninja Ball but the image in the render looks like someone had ran over it with a truck.
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: CAMERA: scrolling and scaling
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?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.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
Re: CAMERA: scrolling and scaling
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.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: CAMERA: scrolling and scaling
I think this quote might answer your questions: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.
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).
Help us help you: attach a .love.
Re: CAMERA: scrolling and scaling
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.
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
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.
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: CAMERA: scrolling and scaling
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.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 the example at http://love2d.org/wiki/index.php?title=CAMERA:Examples.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: CAMERA: scrolling and scaling
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.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.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
Re: CAMERA: scrolling and scaling
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.
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.
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: CAMERA: scrolling and scaling
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.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.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
Who is online
Users browsing this forum: No registered users and 0 guests