mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Add Geometries (replaces Quads).
A Geometry is a collection of vertices describing a non self-intersecting
(simple) polygon. In addition to screen coordinates, the vertices have
attributes for texture coordinates (s,t) and color (r,g,b,a).
It can be used as a quad, to display distorted images, or anything in between.
Added:
^^^^^^
-- geometry from table, where table has the format:
-- info = {
-- {x,y, s,t, [r = 255, g = 255, b = 255, a = 255]}
-- {x,y, s,t, [r = 255, g = 255, b = 255, a = 255]}
-- ...
-- }
geom = love.graphics.newGeometry(info)
-- convenience wrapper for quads (same as before)
geom = love.graphics.newQuad(x,y, w,h, sw,sh)
-- retrieve vertex i (1-indexed)
x,y,s,t,r,g,b,a = geom:getVertex(i)
-- set vertex i (1-indexed)
geom:setVertex(i, x,y, s,t, [r,g,b,a])
-- flip geometry
geom:flip(x, y)
Renamed:
^^^^^^^^
love.graphics.drawq() -> love.graphics.drawg()
Removed:
^^^^^^^^
quad:setViewport()
quad:getViewport()
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
#include "Font.h"
|
||||
#include "Image.h"
|
||||
#include "Quad.h"
|
||||
#include "graphics/Geometry.h"
|
||||
#include "SpriteBatch.h"
|
||||
#include "ParticleSystem.h"
|
||||
#include "Canvas.h"
|
||||
@@ -287,9 +287,14 @@ public:
|
||||
Image *newImage(love::image::CompressedData *cdata);
|
||||
|
||||
/**
|
||||
* Creates a Quad object.
|
||||
* Creates a Geometry object.
|
||||
**/
|
||||
Quad *newQuad(float x, float y, float w, float h, float sw, float sh);
|
||||
Geometry *newGeometry(const std::vector<vertex> &vertices);
|
||||
|
||||
/**
|
||||
* Creates a quadliteral Geometry object.
|
||||
**/
|
||||
Geometry *newQuad(float x, float y, float w, float h, float sw, float sh);
|
||||
|
||||
/**
|
||||
* Creates a Font object.
|
||||
|
||||
Reference in New Issue
Block a user