User:Flying Jester/SpriteBatch API
Jump to navigation
Jump to search
This page is draft of the SpriteBatch API for TurboSphere.
Variables
- POINT
- LINE
- TRIANGLE
- RECTANGLE
- POLYGON
- CIRCLE
- FILLED
- OUTLINED
- GRADIENT
- OUTLINED_GRADIENT
- BLIT
- ROTATE_BLIT
- ZOOM_BLIT
- STRETCH_BLIT
- TRANSFORM_BLIT
Objects
- SpriteBatch()
- Creates a new SpriteBatch object.
- spritebatch.addTexture(tex)
- Clones 'tex' into one of the spritebatch's buffers. 'tex' can be a Surface or Image. Any modifications to 'tex' after being cloned are not reflected by the copy in 'spritebatch'.
- spritebatch.addOperation(primitive, type, ...)
- Adds an operation to 'spritebatch'. Primitives can be
- POINT
- LINE
- TRIANGLE
- RECTANGLE
- POLYGON
- CIRCLE
- Types can be
- FILLED
- OUTLINED
- GRADIENT
- OUTLINED_GRADIENT
- Function signatures are
- spritebatch.addOperation(POINT, type, x, y, color ...)
- spritebatch.addOperation(LINE, type, x1, y1, x2, y2, color ...)
- spritebatch.addOperation(TRIANGLE, type, x1, y1, x2, y2, x3, y3, color ...)
- spritebatch.addOperation(RECTANGLE, type, x, y, w, h color ...)
- spritebatch.addOperation(POLYGON, type, xs, ys, color ...)
- spritebatch.addOperation(CIRCLE, type, x, y, r, color ...)
- 'color' is defined by 'type'.
- FILLED or OUTLINED: one color.
- GRADIENT or OUTLINED_GRADIENT: one color argument for each vertex.
- spritebatch.getImages()
- Returns an array of added images or surfaces (which are converted to images by adding them to the spritebatch) held in the buffer(s) of 'spritebatch'. These can be blit to the screen.
- spritebatch.getOperations()
- Returns an array of added drawing operations.
- spritebatch.pushTexture(tex, mode, ..., [', mask'])
- Pushes a texture drawing operation for 'spritebatch' to perform when it draws. 'tex' is the index of the texture to draw. 'mode' can be
- BLIT
- ROTATE_BLIT
- ZOOM_BLIT
- STRETCH_BLIT
- TRANSFORM_BLIT
- Function signatures are
- spritebatch.pushTexture(tex, BLIT, x, y, [', mask'])
- spritebatch.pushTexture(tex, ROTATE_BLIT, x, y, a [', mask'])
- spritebatch.pushTexture(tex, ZOOM_BLIT, x, y, f [', mask'])
- spritebatch.pushTexture(tex, STRETCH_BLIT, x, y, xf, yf [', mask'])
- spritebatch.pushTexture(tex, TRANSFORM_BLIT, x1, y1, x2, y2, x3, y3, x4, y4 [', mask'])