Neo  0.5.0
Developer Documentation
Neo2D::SpriteBatch Class Reference

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>

Public Member Functions

 DISOWN (Widget *s) void addSprite(Widget *s)
 
void draw ()
 

Detailed Description

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++
Neo2DEngine* engine = Neo2DEngine::getInstance();
// Fetch main canvas
Canvas* mainCanvas = engine->getCanvas(0);
// Calling Sprite(x, y, w, h, file, label) with w = 0 and h = 0
// so the resolution of the texture is used
Sprite* sprite = new Sprite(100, 100, 0, 0, "assets/tex.png", "label");
SpriteBatch* batch = new SpriteBatch();
// Add sprite do render pipeline
batch->addSprite(sprite);
// Add to canvas
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

Member Function Documentation

Neo2D::SpriteBatch::DISOWN ( Widget s)
inline
void Neo2D::SpriteBatch::draw ( )

The documentation for this class was generated from the following file: