Camera in 0.6.0

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Camera in 0.6.0

Post by bartbes »

I thought I saw a lib to do that a while ago, but I couldn't find it anymore..
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Camera in 0.6.0

Post by osuf oboys »

konsumer wrote:Igor: it still doesn't do anything. that is for a mouse-based camera, right? I'm not using that.
For future support, I think lateInit() should be there anyhow but you're right, it does nothing for your project.

I've attached an updated version for Camera. It is not complete; there is a misplacement of images when rotating the screen and there are some optimizations to be made. It also needs compatability code for 0.5.0 (the old versions will however always be in wiki history). I will probably replace most of the transformation with what rude suggested but for your needs, the functionality should hopefully be the same anyhow.

Using a tilemap that only draws the visible tiles, instead of everything and then applying a camera, seems highly useful, even necessary. There are still common features that are being used and perhaps these could be added to camera. I would recommend that you use getCamera():isShapeVisible(shape) or getCamera():isRectangleVisible(x1, y1, x2, y2) before drawing sprites. For tilemaps, I plan to add a function for getting the range of tiles that are visible.
Attachments
main.lua
Test program for Camera 4a.
(11.25 KiB) Downloaded 109 times
camera.lua
Camera 4a. Beta for LÖVE 0.6.0.
(20.66 KiB) Downloaded 109 times
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.
User avatar
Star Crunch
Prole
Posts: 33
Joined: Sun Feb 15, 2009 12:13 am
Location: Monterrey, MX
Contact:

Re: Camera in 0.6.0

Post by Star Crunch »

bartbes wrote:I thought I saw a lib to do that a while ago, but I couldn't find it anymore..
Maybe one of these?

http://cairographics.org
http://www.antigrain.com

Cairo has a few bindings:

http://luaforge.net/projects/luacairo
http://luaforge.net/projects/oocairo
http://www.dynaset.org/dogusanh/luacairo.html

I thought Rude or Mike said something elsewhere about rejecting it because it was too heavy, though...

Not sure about Anti-Grain bindings, or its license for that matter.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Camera in 0.6.0

Post by bartbes »

No, I meant a lua implementation that someone from our community coded and had integrated with LÖVE.
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Camera in 0.6.0

Post by osuf oboys »

Someone did code an interpreter for basic SVG and talked about it on IRC, but I do not remember who it was. I definitely think we should have one.
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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Camera in 0.6.0

Post by Robin »

osuf oboys wrote:Someone did code an interpreter for basic SVG and talked about it on IRC, but I do not remember who it was. I definitely think we should have one.
That would be insanely cool. Anyone who knows who this individual was?
Help us help you: attach a .love.
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Camera in 0.6.0

Post by osuf oboys »

Robin wrote:
osuf oboys wrote:Someone did code an interpreter for basic SVG and talked about it on IRC, but I do not remember who it was. I definitely think we should have one.
That would be insanely cool. Anyone who knows who this individual was?
SVG is built on XML though so it should be easy for anyone skilled and motivated to take up this project. Preferably though, I would like to see it in the LÖVE engine. If not, it might be better to have more of a community project with iterative improvements than for someone to make the basics and haphazard imporvements for extensions.

For instance, drawing a rectangle is just

Code: Select all

<rect x="50" y="50" width="460" height="230" fill="#3377aa" />
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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Camera in 0.6.0

Post by Robin »

osuf oboys wrote:SVG is built on XML though so it should be easy for anyone skilled and motivated to take up this project. Preferably though, I would like to see it in the LÖVE engine. If not, it might be better to have more of a community project with iterative improvements than for someone to make the basics and haphazard imporvements for extensions.

For instance, drawing a rectangle is just

Code: Select all

<rect x="50" y="50" width="460" height="230" fill="#3377aa" />
True, but Lua is not really that great with string handling -- Lua can handle SVG, i'm sure, but it's going to be awkward. I think we need a small and sleek C++ lib, preferably an existing one.
Help us help you: attach a .love.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Camera in 0.6.0

Post by bmelts »

The most viable option would seem to be Antigrain, though I don't know how large it is or what problems it might cause. Also, the current version is available under the GPL only; the previous version is usable under a very liberal public license, though (do whatever you like as long as this notice is included).

There's also ShivaVG (C, not C++), which purports to implement the OpenVG standard, but I haven't tested it and the latest version available for download (on its Sourceforge page) is 0.2.1, and that came out nearly a year ago. It seems like the project might be abandoned, and I don't know how complete it currently is, or of what quality.

It might still be worth checking out, though!

(There's also KompazzVG, which looks quite nice, but the author hasn't actually released any source yet, so that's not really an option.)
Post Reply

Who is online

Users browsing this forum: No registered users and 137 guests