Skip to content

Functions

hatninja edited this page Jun 9, 2017 · 19 revisions
camera = PM.newCamera( w,h, x,y, r, zoom, fov, offset )

Returns a Camera object, which is used to store data for the library's main drawing functions.

Type Argument Description
number width The width of the view window (in pixels) that it will render at.
number height The height of the view window (in pixels) that it will render at.
number x The x position of the camera, in texture coordinates.
number y The y position of the camera, in texture coordinates.
number r The rotation of the camera (in radians)
number zoom How many world pixels wide your window will render.
number fov The camera's relative y-scale, it stretches based on the percentage. (e.g. 2.0 is twice as far, 0.5 is half.)
number offset The camera's origin offset, it changes where the center is rendered. (0.5 is the middle of the view port, 2.0 is twice below.)

camera = PM.drawPlane( camera, image, ox,oy, sx,sy, wrap)

Draws a Mode7 style plane with the camera object. Planes are very expensive, so it is recommended that you use only a couple at a time.

Type Argument Description
Camera camera The camera to use.
Drawable image The image to use.
number ox X offset of the plane (in world pixels)
number oy Y offset of the plane (in world pixels)
number sx The X-Scale that the plane will draw with. Default is 1.
number sy The Y-Scale that the plane will draw with. Default is 1.
boolean wrap If on, the plane will wrap and draw indefinitely. It is off by default.

camera = PM.placeSprite( camera, image, quad, x,y, r, sx,sy, ...)

Buffers a sprite to draw.

Type Argument Description
Camera camera The camera to buffer.
Drawable image The image to use.
Quad quad A quad to use with the image.
number x X position of the sprite in the world.
number y Y position of the sprite in the world.
number r The rotation of the sprite.
number sx The width of the sprite (In world pixels)
number sy The height of the sprite (In world pixels)
... ... The rest is the same as love.graphics.draw

camera = PM.renderSprites(camera)

Draws all the sprites in the camera's buffer in proper order. It will also clear the buffer after it is done.

Type Argument Description
Camera camera The camera's buffer to render.

PM.toScreen(cam,x,y)

Translates world coordinates to screen coordinates.

Type Argument Description
Camera camera The camera settings to use.
number x The world x coordinate.
number y The world y coordinate.

PM.toWorld(cam,x,y)

Translates screen coordinates to world coordinates. Good for mouse gameplay.

Type Argument Description
Camera camera The camera settings to use.
number x The screen x coordinate.
number y The screen y coordinate.
Clone this wiki locally