CAMERA: scrolling and scaling
Posted: Sat Jan 31, 2009 11:15 am
Data
module name: CAMERA
version: 3e
last updated: April 24, 2009
Introduction
CAMERA is a softlöve module that basically keeps track of what in the world the screen is currently centered on, how large everything should be drawn, and where on the screen the center is. The objects that keep track of this information are called cameras (although transformations would be more accurate) and are set in the same way as colors: call setCamera(cam) for an appropriate cam object before you draw. The default camera leaves the world just as it is and hence you may include this module without any visual change.
You can use cameras to achieve effects such as: sidescrollers and RTS's, zooming, seamlessly making your game work for any resolution (that has a fairly normal width-to-height w.r.t. how your game was designed), changing the drawing origin, minimaps, splitscreen, and the uncoupling of pixels from box2d engine. Some of these features can be applied to an already completed game merely by changing a few lines, other features go deeper and can take a few days to fully integrate. For newer projects, integrating the system should bring a number of benefits not covered above, such as the separation of different drawing layers.
Wiki
For more information, see the CAMERA wiki: http://love2d.org/wiki/index.php?title=CAMERA . You are encouraged to be bold and update the wiki and the module as you believe would benefit the community. If you find a better way to do something or find awesome missing features, then by all means implement
the changes and write a post about it. I would much rather see that someone takes this project, updates it, and calls it their own, than to do make a new project from scratch. This is a middle-way solution: we craft a scene-altering library for the needs of the community.
License
LPCL 1.0 - the LÖVE Community.
See http://love2d.org/wiki/index.php?title= ... ERA_Source for a discussion about things to be implemented.
module name: CAMERA
version: 3e
last updated: April 24, 2009
Introduction
CAMERA is a softlöve module that basically keeps track of what in the world the screen is currently centered on, how large everything should be drawn, and where on the screen the center is. The objects that keep track of this information are called cameras (although transformations would be more accurate) and are set in the same way as colors: call setCamera(cam) for an appropriate cam object before you draw. The default camera leaves the world just as it is and hence you may include this module without any visual change.
You can use cameras to achieve effects such as: sidescrollers and RTS's, zooming, seamlessly making your game work for any resolution (that has a fairly normal width-to-height w.r.t. how your game was designed), changing the drawing origin, minimaps, splitscreen, and the uncoupling of pixels from box2d engine. Some of these features can be applied to an already completed game merely by changing a few lines, other features go deeper and can take a few days to fully integrate. For newer projects, integrating the system should bring a number of benefits not covered above, such as the separation of different drawing layers.
Wiki
For more information, see the CAMERA wiki: http://love2d.org/wiki/index.php?title=CAMERA . You are encouraged to be bold and update the wiki and the module as you believe would benefit the community. If you find a better way to do something or find awesome missing features, then by all means implement
the changes and write a post about it. I would much rather see that someone takes this project, updates it, and calls it their own, than to do make a new project from scratch. This is a middle-way solution: we craft a scene-altering library for the needs of the community.
License
LPCL 1.0 - the LÖVE Community.
See http://love2d.org/wiki/index.php?title= ... ERA_Source for a discussion about things to be implemented.