Implements a batch of sprites that can be used to circumvent the GUI system when rendering 2D objects for better performance.
More...
#include <Canvas.h>
Implements a batch of sprites that can be used to circumvent the GUI system when rendering 2D objects for better performance.
- Creating a new SpriteBatch in C++
Canvas* mainCanvas = engine->getCanvas(0);
Sprite* sprite = new Sprite(100, 100, 0, 0, "assets/tex.png", "label");
SpriteBatch* batch = new SpriteBatch();
batch->addSprite(sprite);
mainCanvas->addSpriteBatch(batch);
- Creating a new SpriteBatch in Lua
require("NeoLua")
local engine = NeoLua.Neo2DEngine.getInstance()
-- Fetch main canvas
local mainCanvas = gui:getCanvas(0);
-- Calling Sprite(x, y, w, h, file, label) with w = 0 and h = 0
-- so the resolution of the texture is used
local sprite = NeoLua.Sprite(100, 100, 0, 0, "assets/tex.png", "label");
local batch = NeoLua.SpriteBatch()
-- Add sprite do render pipeline
batch:addSprite(sprite);
-- Add to canvas
mainCanvas:addSpriteBatch(batch);
- Author
- Yannick Pflanzer
Neo2D::SpriteBatch::DISOWN |
( |
Widget * |
s | ) |
|
|
inline |
void Neo2D::SpriteBatch::draw |
( |
| ) |
|
The documentation for this class was generated from the following file: