Neo  0.5.0
Developer Documentation
Neo2D::Render Class Reference

The Render class contains helper methods for rendering 2D shapes. More...

#include <Render.h>

Public Member Functions

Vector2 getResolution ()
 
void drawColoredQuad (float x, float y, float w, float h, Vector4 color, float rotation=0)
 Draws a colored quad without texture to the screen. More...
 
void drawTexturedQuad (float x, float y, float w, float h, int texture, float rotation=0)
 Draws a textured quad to the screen. More...
 
void drawTexturedQuad (float x, float y, float w, float h, int texture, float rotation, Vector2 scale)
 Draws a textured quad to the screen. More...
 
void drawTexturedQuad (float x, float y, float w, float h, int texture, float rotation, Vector2 scale, Vector2 flip)
 Draws a textured quad to the screen. More...
 
void drawTexturedQuad (float x, float y, float w, float h, int texture, float rotation, Vector2 scale, Vector2 flip, Vector4 texcoords)
 Draws a textured quad to the screen. More...
 
void drawText (OText *text, float x, float y, float rotation=0)
 Draws a text object to the screen in 2D. More...
 
void set2D (float w, float h)
 Sets a 2D viewport with the given width and height. More...
 
void loadShader (const char *vert, const char *frag, unsigned int *fx)
 Loads, compiles and links a GLSL shader. More...
 
OTextcreateText (const char *font, float size)
 Creates a new text object. More...
 
 Render ()
 

Static Public Member Functions

static RendergetInstance ()
 

Detailed Description

The Render class contains helper methods for rendering 2D shapes.

All elements can be rendered directly to the screen or to a texture.

Bug:
Should be implemented in Neo::RenderingContext!
Author
Yannick Pflanzer

Constructor & Destructor Documentation

Neo2D::Render::Render ( )

Member Function Documentation

OText* Neo2D::Render::createText ( const char *  font,
float  size 
)

Creates a new text object.

Parameters
fontThe font file to use.
sizeThe font size to use.
Returns
The new OText object.
void Neo2D::Render::drawColoredQuad ( float  x,
float  y,
float  w,
float  h,
Vector4  color,
float  rotation = 0 
)

Draws a colored quad without texture to the screen.

Parameters
xThe X-Position
yThe Y-Position
wThe width
hThe height
colorThe color of the quad in RGBA between 0.0 and 1.0
rotationThe rotation of the quad.
void Neo2D::Render::drawText ( OText text,
float  x,
float  y,
float  rotation = 0 
)

Draws a text object to the screen in 2D.

Parameters
textThe OText object to draw.
xThe X-Position
yThe Y-Position
rotationThe rotation of the text
void Neo2D::Render::drawTexturedQuad ( float  x,
float  y,
float  w,
float  h,
int  texture,
float  rotation = 0 
)

Draws a textured quad to the screen.

Parameters
xThe X-Position
yThe Y-Position
wThe width
hThe height
textureThe handle of the texture to use
rotationThe rotation of the quad.
void Neo2D::Render::drawTexturedQuad ( float  x,
float  y,
float  w,
float  h,
int  texture,
float  rotation,
Vector2  scale 
)

Draws a textured quad to the screen.

Parameters
xThe X-Position
yThe Y-Position
wThe width
hThe height
textureThe handle of the texture to use
rotationThe rotation of the quad
scaleThe scale of the quad
void Neo2D::Render::drawTexturedQuad ( float  x,
float  y,
float  w,
float  h,
int  texture,
float  rotation,
Vector2  scale,
Vector2  flip 
)

Draws a textured quad to the screen.

Parameters
xThe X-Position
yThe Y-Position
wThe width
hThe height
textureThe handle of the texture to use
rotationThe rotation of the quad
scaleThe scale of the quad
flipThe vector that specifies how to flip the quad.
void Neo2D::Render::drawTexturedQuad ( float  x,
float  y,
float  w,
float  h,
int  texture,
float  rotation,
Vector2  scale,
Vector2  flip,
Vector4  texcoords 
)

Draws a textured quad to the screen.

Parameters
xThe X-Position
yThe Y-Position
wThe width
hThe height
textureThe handle of the texture to use
rotationThe rotation of the quad
scaleThe scale of the quad
flipThe vector that specifies how to flip the quad.
texcoordsCustom texture coordinates
static Render* Neo2D::Render::getInstance ( )
inlinestatic
Vector2 Neo2D::Render::getResolution ( )
inline
void Neo2D::Render::loadShader ( const char *  vert,
const char *  frag,
unsigned int *  fx 
)

Loads, compiles and links a GLSL shader.

The shader ID will be plased inside the integer specified by the fx pointer.

Parameters
vertThe vertex shader.
fragThe fragment shader.
fxA pointer to and existing integer.
void Neo2D::Render::set2D ( float  w,
float  h 
)

Sets a 2D viewport with the given width and height.

Parameters
wThe width of the viewport.
hThe height of the viewport.

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