Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CGraphics2D Class Reference

The object class supports 2D drawing on the screen. More...

#include <Graphics2D/CGraphics2D.h>

Public Member Functions

void resize ()
core::dimension2du getScreenSize ()
bool isHD ()
bool isWideScreen ()
void addCanvas (CCanvas *canvas)
void removeCanvas (CCanvas *canvas)
void render (CCamera *camera)
void beginRenderGUI (const core::matrix4 &projection, const core::matrix4 &view)
void endRenderGUI ()
void prepareBuffer ()
void nextBuffer ()
void flushBuffer (IMeshBuffer *meshBuffer, video::SMaterial &material)
void flush ()
void flushWithMaterial (CMaterial *material)
void addExternalBuffer (IMeshBuffer *meshBuffer, const core::matrix4 &absoluteMatrix, int shaderID, CMaterial *material=NULL)
void addImageBatch (ITexture *img, const SColor &color, const core::matrix4 &absoluteMatrix, int shaderID, CMaterial *material=NULL, float pivotX=0, float pivotY=0)
void addImageBatch (ITexture *img, const core::rectf &dest, const core::rectf &source, const SColor &color, const core::matrix4 &absoluteMatrix, int shaderID, CMaterial *material=NULL, float pivotX=0, float pivotY=0)
void addModuleBatch (SModuleOffset *module, const SColor &color, const core::matrix4 &absoluteMatrix, float offsetX, float offsetY, int shaderID, CMaterial *material=NULL)
void addModuleBatch (SModuleOffset *module, const SColor &color, const core::matrix4 &absoluteMatrix, const core::rectf &r, float anchorLeft, float anchorRight, float anchorTop, float anchorBottom, int shaderID, CMaterial *material=NULL)
void addModuleBatch (SModuleOffset *module, const SColor &color, const core::matrix4 &absoluteMatrix, const core::rectf &r, int shaderID, CMaterial *material=NULL)
void addModuleBatchLR (SModuleOffset *module, const SColor &color, const core::matrix4 &absoluteMatrix, const core::rectf &r, float anchorLeft, float anchorRight, int shaderID, CMaterial *material=NULL)
void addModuleBatchTB (SModuleOffset *module, const SColor &color, const core::matrix4 &absoluteMatrix, const core::rectf &r, float anchorTop, float anchorBottom, int shaderID, CMaterial *material=NULL)
void addFrameBatch (SFrame *frame, const SColor &color, const core::matrix4 &absoluteMatrix, int materialID, CMaterial *material=NULL)
void addFrameBatch (const core::rectf &pos, SFrame *frame, const SColor &color, const core::matrix4 &absoluteMatrix, int materialID, CMaterial *material=NULL)
void addRectangleBatch (const core::rectf &pos, const core::rectf &uv, const SColor &color, const core::matrix4 &absoluteTransform, int shaderID, CMaterial *material=NULL)
void addEclipseBatch (const core::rectf &pos, const core::rectf &uv, const SColor &color, const core::matrix4 &absoluteTransform, int shaderID, float a=0.0f, float b=360.0f, CMaterial *material=NULL)
void beginDrawDepth ()
void endDrawDepth ()
void beginDepthTest ()
void endDepthTest ()
void setWriteDepth (video::SMaterial &mat)
void setDepthTest (video::SMaterial &mat)
void setNoDepthTest (video::SMaterial &mat)
void draw2DTriangle (const core::position2df &a, const core::position2df &b, const core::position2df &c, const SColor &color)
void draw2DLine (const core::position2df &start, const core::position2df &end, const SColor &color)
void draw2DLines (const std::vector< core::position2df > &points, const SColor &color)
void draw2DRectangle (const core::rectf &pos, const SColor &color)
void draw2DRectangle (const core::vector3df &upleft, const core::vector3df &lowerright, const SColor &color)
void draw2DRectangleOutline (const core::rectf &pos, const SColor &color)
void draw2DRectangleOutline (const core::vector3df &upleft, const core::vector3df &lowerright, const SColor &color)
void drawText (const core::position2df &pos, IFont *font, const SColor &color, const std::wstring &string, int materialID, CMaterial *material=NULL)
float measureCharWidth (IFont *font, wchar_t c)
core::dimension2df measureText (IFont *font, const std::wstring &string)
video::SMaterialgetMaterial ()
IMeshBuffergetCurrentBuffer ()

Protected Attributes

int m_currentW
int m_currentH
IVideoDriverm_driver
std::vector< IMeshBuffer * > m_allBuffers
int m_bufferID
std::vector< CCanvas * > m_canvas
video::SMaterial m_2dMaterial
video::SMaterial m_customMaterial
int m_vertexColorShader
IMeshBufferm_buffer
scene::SVertexBuffer * m_vertices
scene::CIndexBufferm_indices

Detailed Description

The object class supports 2D drawing on the screen.

CGraphics2D *g = CGraphics2D::getInstance();
// setup 2d projection
float w = 800.0f;
float h = 600.0f;
core::matrix4 projection, view;
projection.buildProjectionMatrixOrthoLH(w, -h, -1.0f, 1.0f);
view.setTranslation(core::vector3df(-w * 0.5f, -h * 0.5f, 0.0f));
g->beginRenderGUI(projection, view);
... draw code
g->endRenderGUI();
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition vector3d.h:445
CMatrix4< f32 > matrix4
Typedef for f32 matrix.
Definition matrix4.h:2241

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