Version

Plus Class

High-level wrapper around the Harfang API designed for rapid prototyping.

Components

  • Input: Provides access to input devices such as the mouse or the keyboard.
  • Audio: Quickly play sound and music with a handful of functions (see LoadPlugins for audio format support).
  • Geometry: Generate Geometry for common shape such as cube, sphere or cone.
  • Render: Plus includes a 2D and 3D primitives rendering layer based on SimpleGraphicEngine. Primitives sent to these rendering layers are drawn to screen during Flip with 3D primitives drawn before 2D ones.
  • Scene: Quickly setup a 3D scene and generate common geometry such as a cube or a sphere.

Using Plus

Retrieve the global Plus object by calling GetPlus. You can consult the Tutorials page for many examples.

Member Functions

Node
Node
Node
Node
AddCamera(Scene scene)
AddCamera(Scene scene, Matrix4 matrix)
AddCamera(Scene scene, Matrix4 matrix, bool orthographic)
AddCamera(Scene scene, Matrix4 matrix, bool orthographic, bool set_as_current)
Node
Node
Node
Node
Node
AddCube(Scene scene)
AddCube(Scene scene, Matrix4 matrix)
AddCube(Scene scene, Matrix4 matrix, float size_x, float size_y, float size_z)
AddCube(Scene scene, Matrix4 matrix, float size_x, float size_y, float size_z, string material_path)
AddCube(Scene scene, Matrix4 matrix, float size_x, float size_y, float size_z, string material_path, bool use_geometry_cache)
Node
Node
AddDummy(Scene scene)
AddDummy(Scene scene, Matrix4 world)
Environment
Environment
Environment
AddEnvironment(Scene scene)
AddEnvironment(Scene scene, Color background_color, Color ambient_color)
AddEnvironment(Scene scene, Color background_color, Color ambient_color, Color fog_color, float fog_near, float fog_far)
Node
Node
AddGeometry(Scene scene, string geometry_path)
AddGeometry(Scene scene, string geometry_path, Matrix4 matrix)
Node
Node
Node
Node
Node
Node
Node
AddLight(Scene scene)
AddLight(Scene scene, Matrix4 matrix)
AddLight(Scene scene, Matrix4 matrix, Model model)
AddLight(Scene scene, Matrix4 matrix, Model model, float range)
AddLight(Scene scene, Matrix4 matrix, Model model, float range, bool shadow)
AddLight(Scene scene, Matrix4 matrix, Model model, float range, bool shadow, Color diffuse)
AddLight(Scene scene, Matrix4 matrix, Model model, float range, bool shadow, Color diffuse, Color specular)
Node
Node
Node
AddObject(Scene scene, RenderGeometry geometry)
AddObject(Scene scene, RenderGeometry geometry, Matrix4 matrix)
AddObject(Scene scene, RenderGeometry geometry, Matrix4 matrix, bool is_static)
Node, RigidBody
Node, RigidBody
Node, RigidBody
Node, RigidBody
Node, RigidBody
AddPhysicCube(Scene scene)
AddPhysicCube(Scene scene, Matrix4 m)
AddPhysicCube(Scene scene, Matrix4 m, float width, float height, float depth)
AddPhysicCube(Scene scene, Matrix4 m, float width, float height, float depth, float mass)
AddPhysicCube(Scene scene, Matrix4 m, float width, float height, float depth, float mass, string material_path)
Node, RigidBody
Node, RigidBody
Node, RigidBody
Node, RigidBody
Node, RigidBody
AddPhysicPlane(Scene scene)
AddPhysicPlane(Scene scene, Matrix4 m)
AddPhysicPlane(Scene scene, Matrix4 m, float width, float length)
AddPhysicPlane(Scene scene, Matrix4 m, float width, float length, float mass)
AddPhysicPlane(Scene scene, Matrix4 m, float width, float length, float mass, string material_path)
Node, RigidBody
Node, RigidBody
Node, RigidBody
Node, RigidBody
Node, RigidBody
AddPhysicSphere(Scene scene)
AddPhysicSphere(Scene scene, Matrix4 m)
AddPhysicSphere(Scene scene, Matrix4 m, float radius, int subdiv_x, int subdiv_y)
AddPhysicSphere(Scene scene, Matrix4 m, float radius, int subdiv_x, int subdiv_y, float mass)
AddPhysicSphere(Scene scene, Matrix4 m, float radius, int subdiv_x, int subdiv_y, float mass, string material_path)
Node
Node
Node
Node
Node
AddPlane(Scene scene)
AddPlane(Scene scene, Matrix4 matrix)
AddPlane(Scene scene, Matrix4 matrix, float size_x, float size_z)
AddPlane(Scene scene, Matrix4 matrix, float size_x, float size_z, string material_path)
AddPlane(Scene scene, Matrix4 matrix, float size_x, float size_z, string material_path, bool use_geometry_cache)
Node
Node
Node
Node
Node
Node
AddSphere(Scene scene)
AddSphere(Scene scene, Matrix4 matrix)
AddSphere(Scene scene, Matrix4 matrix, float radius)
AddSphere(Scene scene, Matrix4 matrix, float radius, int subdiv_x, int subdiv_y)
AddSphere(Scene scene, Matrix4 matrix, float radius, int subdiv_x, int subdiv_y, string material_path)
AddSphere(Scene scene, Matrix4 matrix, float radius, int subdiv_x, int subdiv_y, string material_path, bool use_geometry_cache)
boolAudioInit()
voidAudioUninit()
void
void
Blit2D(float src_x, float src_y, float src_w, float src_h, float dst_x, float dst_y, float dst_w, float dst_h, string image_path)
Blit2D(float src_x, float src_y, float src_w, float src_h, float dst_x, float dst_y, float dst_w, float dst_h, string image_path, Color tint)
void
void
Clear()
Clear(Color color)
voidCommit2D()
voidCommit3D()
Geometry
Geometry
Geometry
Geometry
Geometry
CreateCapsule()
CreateCapsule(float radius, float height)
CreateCapsule(float radius, float height, int subdiv_x, int subdiv_y)
CreateCapsule(float radius, float height, int subdiv_x, int subdiv_y, string material_path)
CreateCapsule(float radius, float height, int subdiv_x, int subdiv_y, string material_path, string name)
Geometry
Geometry
Geometry
Geometry
Geometry
CreateCone()
CreateCone(float radius, float height)
CreateCone(float radius, float height, int subdiv_x)
CreateCone(float radius, float height, int subdiv_x, string material_path)
CreateCone(float radius, float height, int subdiv_x, string material_path, string name)
Geometry
Geometry
Geometry
Geometry
CreateCube()
CreateCube(float width, float height, float length)
CreateCube(float width, float height, float length, string material_path)
CreateCube(float width, float height, float length, string material_path, string name)
Geometry
Geometry
Geometry
Geometry
Geometry
CreateCylinder()
CreateCylinder(float radius, float height)
CreateCylinder(float radius, float height, int subdiv_x)
CreateCylinder(float radius, float height, int subdiv_x, string material_path)
CreateCylinder(float radius, float height, int subdiv_x, string material_path, string name)
RenderGeometry
RenderGeometry
CreateGeometry(Geometry geometry)
CreateGeometry(Geometry geometry, bool use_cache)
Geometry
Geometry
Geometry
Geometry
Geometry
CreatePlane()
CreatePlane(float width, float length)
CreatePlane(float width, float length, int subdiv)
CreatePlane(float width, float length, int subdiv, string material_path)
CreatePlane(float width, float length, int subdiv, string material_path, string name)
Geometry
Geometry
Geometry
Geometry
Geometry
CreateSphere()
CreateSphere(float radius)
CreateSphere(float radius, int subdiv_x, int subdiv_y)
CreateSphere(float radius, int subdiv_x, int subdiv_y, string material_path)
CreateSphere(float radius, int subdiv_x, int subdiv_y, string material_path, string name)
voidCreateWorkers()
voidDeleteWorkers()
voidEndFrame()
voidFlip()
voidFreeRenderWindow(RenderWindow window)
void
void
void
Geometry2D(float x, float y, RenderGeometry geometry)
Geometry2D(float x, float y, RenderGeometry geometry, float angle_x, float angle_y, float angle_z)
Geometry2D(float x, float y, RenderGeometry geometry, float angle_x, float angle_y, float angle_z, float scale)
void
void
void
Geometry3D(float x, float y, float z, RenderGeometry geometry)
Geometry3D(float x, float y, float z, RenderGeometry geometry, float angle_x, float angle_y, float angle_z)
Geometry3D(float x, float y, float z, RenderGeometry geometry, float angle_x, float angle_y, float angle_z, float scale)
BlendModeGetBlend2D()
BlendModeGetBlend3D()
Matrix4GetCamera3DMatrix()
Matrix44GetCamera3DProjectionMatrix()
Int64GetClock()
Int64GetClockDt()
CullModeGetCulling2D()
CullModeGetCulling3D()
boolGetDepthTest2D()
boolGetDepthTest3D()
boolGetDepthWrite2D()
boolGetDepthWrite3D()
Vector2GetFixed2DResolution()
stringGetFont()
InputDeviceGetKeyboard()
MixerGetMixer()
MixerAsyncGetMixerAsync()
InputDeviceGetMouse()
float, floatGetMouseDt()
float, floatGetMousePos()
RenderSystemGetRenderSystem()
RenderSystemAsyncGetRenderSystemAsync()
RenderWindowGetRenderWindow()
IntVector2GetRenderWindowSize(RenderWindow window)
RendererGetRenderer()
RendererAsyncGetRendererAsync()
intGetScreenHeight()
intGetScreenWidth()
Rect
Rect
Rect
GetTextRect(string text)
GetTextRect(string text, float size)
GetTextRect(string text, float size, string font_path)
void
void
Image2D(float x, float y, float scale, string image_path)
Image2D(float x, float y, float scale, string image_path, Color tint)
voidInitExtern(Renderer renderer, RendererAsync renderer_async, RenderSystem render_system, RenderSystemAsync render_system_async)
bool
bool
IsAppEnded()
IsAppEnded(AppEndCondition flags)
boolKeyDown(Key key)
boolKeyPress(Key key)
boolKeyReleased(Key key)
void
void
Line2D(float sx, float sy, float ex, float ey)
Line2D(float sx, float sy, float ex, float ey, Color start_color, Color end_color)
void
void
Line3D(float sx, float sy, float sz, float ex, float ey, float ez)
Line3D(float sx, float sy, float sz, float ex, float ey, float ez, Color start_color, Color end_color)
voidLines2D(Vector2List points, ColorList colors)
RenderGeometryLoadGeometry(string path)
RenderMaterial
RenderMaterial
LoadMaterial(string path)
LoadMaterial(string path, string source)
boolLoadScene(Scene scene, string path)
SurfaceShader
SurfaceShader
LoadSurfaceShader(string path)
LoadSurfaceShader(string path, string source)
TextureLoadTexture(string path)
void
void
Mount()
Mount(string path)
voidMountAs(string path, string prefix)
bool
bool
MouseButtonDown()
MouseButtonDown(Button button)
RenderWindow
RenderWindow
NewRenderWindow(int width, int height)
NewRenderWindow(int width, int height, Visibility visibility)
Scene
Scene
Scene
NewScene()
NewScene(bool use_physics)
NewScene(bool use_physics, bool use_lua)
void
void
Plot2D(float x, float y)
Plot2D(float x, float y, Color color)
void
void
void
void
Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy)
Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, Color a_color, Color b_color, Color c_color, Color d_color)
Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture)
Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture, float uv_sx, float uv_sy, float uv_ex, float uv_ey)
void
void
void
void
Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz)
Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz, Color a_color, Color b_color, Color c_color, Color d_color)
Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture)
Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture, float uv_sx, float uv_sy, float uv_ex, float uv_ey)
voidQuads2D(Vector2List points, float size, Color color, Texture texture)
bool
bool
bool
bool
bool
bool
bool
bool
RenderInit(int width, int height)
RenderInit(int width, int height, string core_path)
RenderInit(int width, int height, string core_path, int aa)
RenderInit(int width, int height, string core_path, int aa, Visibility visibility)
RenderInit(int width, int height, string core_path, int aa, Visibility visibility, bool debug)
RenderInit(int width, int height, int aa)
RenderInit(int width, int height, int aa, Visibility visibility)
RenderInit(int width, int height, int aa, Visibility visibility, bool debug)
voidRenderScene(Scene scene)
voidRenderUninit()
voidResetClock()
void
void
void
void
RotatedSprite2D(float x, float y, float angle, float size, string image_path)
RotatedSprite2D(float x, float y, float angle, float size, string image_path, Color tint)
RotatedSprite2D(float x, float y, float angle, float size, string image_path, Color tint, float pivot_x, float pivot_y)
RotatedSprite2D(float x, float y, float angle, float size, string image_path, Color tint, float pivot_x, float pivot_y, bool flip_h, bool flip_v)
voidSet2DOriginIsTopLeft(bool top_left)
voidSetBlend2D(BlendMode mode)
voidSetBlend3D(BlendMode mode)
void
void
void
void
void
SetCamera3D(float x, float y, float z)
SetCamera3D(float x, float y, float z, float angle_x, float angle_y, float angle_z)
SetCamera3D(float x, float y, float z, float angle_x, float angle_y, float angle_z, float fov)
SetCamera3D(float x, float y, float z, float angle_x, float angle_y, float angle_z, float fov, float z_near, float z_far)
SetCamera3D(Matrix4 view, Matrix44 projection)
voidSetCulling2D(CullMode mode)
voidSetCulling3D(CullMode mode)
voidSetDepthTest2D(bool enable)
voidSetDepthTest3D(bool enable)
voidSetDepthWrite2D(bool enable)
voidSetDepthWrite3D(bool enable)
voidSetFixed2DResolution(float w, float h)
voidSetFont(string path)
void
void
SetRenderWindow(RenderWindow window)
SetRenderWindow()
void
void
SetWindowTitle(string title)
SetWindowTitle(RenderWindow window, string title)
void
void
void
void
Sprite2D(float x, float y, float size, string image_path)
Sprite2D(float x, float y, float size, string image_path, Color tint)
Sprite2D(float x, float y, float size, string image_path, Color tint, float pivot_x, float pivot_y)
Sprite2D(float x, float y, float size, string image_path, Color tint, float pivot_x, float pivot_y, bool flip_h, bool flip_v)
void
void
void
void
Text2D(float x, float y, string text)
Text2D(float x, float y, string text, float size)
Text2D(float x, float y, string text, float size, Color color)
Text2D(float x, float y, string text, float size, Color color, string font_path)
void
void
void
void
Text3D(float x, float y, float z, string text)
Text3D(float x, float y, float z, string text, float size)
Text3D(float x, float y, float z, string text, float size, Color color)
Text3D(float x, float y, float z, string text, float size, Color color, string font_path)
void
void
void
Texture2D(float x, float y, float scale, Texture texture)
Texture2D(float x, float y, float scale, Texture texture, Color tint)
Texture2D(float x, float y, float scale, Texture texture, Color color, bool flip_h, bool flip_v)
void
void
Triangle2D(float ax, float ay, float bx, float by, float cx, float cy)
Triangle2D(float ax, float ay, float bx, float by, float cx, float cy, Color a_color, Color b_color, Color c_color)
void
void
Triangle3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz)
Triangle3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, Color a_color, Color b_color, Color c_color)
voidUninitExtern()
voidUnmount(string path)
voidUnmountAll()
Int64UpdateClock()
voidUpdateRenderWindow(RenderWindow window)
void
void
UpdateScene(Scene scene)
UpdateScene(Scene scene, Int64 dt)
voidWaitForRender()

Related Global Functions

PlusGetPlus()

Member Function Documentation

Node AddCamera(Scene scene)
Node AddCamera(Scene scene, Matrix4 matrix)
Node AddCamera(Scene scene, Matrix4 matrix, bool orthographic)
Node AddCamera(Scene scene, Matrix4 matrix, bool orthographic, bool set_as_current)
Create a new camera node and add it to a scene.

def AddCamera(scene, mat = hg.Matrix4.Identity, is_ortho = False, set_as_current = True):
    node = hg.Node("Camera")

    transform = hg.Transform()
    transform.SetWorld(mat)
    node.AddComponent(transform)

    camera = hg.Camera()
    camera.SetOrthographic(is_ortho)
    node.AddComponent(camera)

    scene.AddNode(node)

    if set_as_current:
        scene.SetCurrentCamera(node)

    return node

Node AddCube(Scene scene)
Node AddCube(Scene scene, Matrix4 matrix)
Node AddCube(Scene scene, Matrix4 matrix, float size_x, float size_y, float size_z)
Node AddCube(Scene scene, Matrix4 matrix, float size_x, float size_y, float size_z, string material_path)
Node AddCube(Scene scene, Matrix4 matrix, float size_x, float size_y, float size_z, string material_path, bool use_geometry_cache)
Create a new cube node and add it to a scene.

def AddCube(scene, mat = hg.Matrix4.Identity, width = 1, height = 1, depth = 1, material_path = None):
    node = hg.Node("Cube")

    transform = hg.Transform()
    transform.SetWorld(mat)
    node.AddComponent(transform)

    obj = hg.Object()
    obj.SetGeometry(hg.GetRenderSystem().CreateGeometry(plus.CreateCube(width, height, depth, material_path)))
    node.AddComponent(obj)

    scene.AddNode(node)
    return node

Node AddDummy(Scene scene)
Node AddDummy(Scene scene, Matrix4 world)
Create a new dummy node and add it to a scene.
Environment AddEnvironment(Scene scene)
Environment AddEnvironment(Scene scene, Color background_color, Color ambient_color)
Environment AddEnvironment(Scene scene, Color background_color, Color ambient_color, Color fog_color, float fog_near, float fog_far)
Create a new environment component and add it to a scene.
Node AddGeometry(Scene scene, string geometry_path)
Node AddGeometry(Scene scene, string geometry_path, Matrix4 matrix)
Add a new geometry node to a scene and return it.
Node AddLight(Scene scene)
Node AddLight(Scene scene, Matrix4 matrix)
Node AddLight(Scene scene, Matrix4 matrix, Model model)
Node AddLight(Scene scene, Matrix4 matrix, Model model, float range)
Node AddLight(Scene scene, Matrix4 matrix, Model model, float range, bool shadow)
Node AddLight(Scene scene, Matrix4 matrix, Model model, float range, bool shadow, Color diffuse)
Node AddLight(Scene scene, Matrix4 matrix, Model model, float range, bool shadow, Color diffuse, Color specular)
Create a new light node and add it to a scene.
Node AddObject(Scene scene, RenderGeometry geometry)
Node AddObject(Scene scene, RenderGeometry geometry, Matrix4 matrix)
Node AddObject(Scene scene, RenderGeometry geometry, Matrix4 matrix, bool is_static)
Create a new object node and add it to a scene.
Node, RigidBody AddPhysicCube(Scene scene)
Node, RigidBody AddPhysicCube(Scene scene, Matrix4 m)
Node, RigidBody AddPhysicCube(Scene scene, Matrix4 m, float width, float height, float depth)
Node, RigidBody AddPhysicCube(Scene scene, Matrix4 m, float width, float height, float depth, float mass)
Node, RigidBody AddPhysicCube(Scene scene, Matrix4 m, float width, float height, float depth, float mass, string material_path)
Create a new cube node, configure its physic attributes, and add it to a scene. Return the Node and its RigidBody component.

def AddPhysicCube(scene, mat = hg.Matrix4.Identity, width = 1, height = 1, depth = 1, mass = 1, material_path = None):
    node = plus.AddCube(scene, mat, width, height, depth, material_path)

    body = hg.RigidBody()
    node->AddComponent(body)

    box = hg.BoxCollision()
    box.SetMass(mass);
    box.SetDimensions(hg.Vector3(width, height, depth))
    node.AddComponent(box)

    return node, body

Node, RigidBody AddPhysicPlane(Scene scene)
Node, RigidBody AddPhysicPlane(Scene scene, Matrix4 m)
Node, RigidBody AddPhysicPlane(Scene scene, Matrix4 m, float width, float length)
Node, RigidBody AddPhysicPlane(Scene scene, Matrix4 m, float width, float length, float mass)
Node, RigidBody AddPhysicPlane(Scene scene, Matrix4 m, float width, float length, float mass, string material_path)
Create a new plane node, configure its physic attributes, and add it to a scene. Return the Node and its RigidBody component.
Node, RigidBody AddPhysicSphere(Scene scene)
Node, RigidBody AddPhysicSphere(Scene scene, Matrix4 m)
Node, RigidBody AddPhysicSphere(Scene scene, Matrix4 m, float radius, int subdiv_x, int subdiv_y)
Node, RigidBody AddPhysicSphere(Scene scene, Matrix4 m, float radius, int subdiv_x, int subdiv_y, float mass)
Node, RigidBody AddPhysicSphere(Scene scene, Matrix4 m, float radius, int subdiv_x, int subdiv_y, float mass, string material_path)
Create a new sphere node, configure its physic attributes, and add it to a scene. Return the Node and its RigidBody component.
Node AddPlane(Scene scene)
Node AddPlane(Scene scene, Matrix4 matrix)
Node AddPlane(Scene scene, Matrix4 matrix, float size_x, float size_z)
Node AddPlane(Scene scene, Matrix4 matrix, float size_x, float size_z, string material_path)
Node AddPlane(Scene scene, Matrix4 matrix, float size_x, float size_z, string material_path, bool use_geometry_cache)
Create a new plane node and add it to a scene.
Node AddSphere(Scene scene)
Node AddSphere(Scene scene, Matrix4 matrix)
Node AddSphere(Scene scene, Matrix4 matrix, float radius)
Node AddSphere(Scene scene, Matrix4 matrix, float radius, int subdiv_x, int subdiv_y)
Node AddSphere(Scene scene, Matrix4 matrix, float radius, int subdiv_x, int subdiv_y, string material_path)
Node AddSphere(Scene scene, Matrix4 matrix, float radius, int subdiv_x, int subdiv_y, string material_path, bool use_geometry_cache)
Create a new sphere node and add it to a scene.
bool AudioInit()
Initialize the audio engine.
void Blit2D(float src_x, float src_y, float src_w, float src_h, float dst_x, float dst_y, float dst_w, float dst_h, string image_path)
void Blit2D(float src_x, float src_y, float src_w, float src_h, float dst_x, float dst_y, float dst_w, float dst_h, string image_path, Color tint)
Draw an image rect.
void Clear()
void Clear(Color color)
Clear the framebuffer or the current render target.
void Commit2D()
Commit all 2D calls.
void Commit3D()
Commit all 3D calls.
Geometry CreateCapsule()
Geometry CreateCapsule(float radius, float height)
Geometry CreateCapsule(float radius, float height, int subdiv_x, int subdiv_y)
Geometry CreateCapsule(float radius, float height, int subdiv_x, int subdiv_y, string material_path)
Geometry CreateCapsule(float radius, float height, int subdiv_x, int subdiv_y, string material_path, string name)
Create a capsule geometry.
Geometry CreateCone()
Geometry CreateCone(float radius, float height)
Geometry CreateCone(float radius, float height, int subdiv_x)
Geometry CreateCone(float radius, float height, int subdiv_x, string material_path)
Geometry CreateCone(float radius, float height, int subdiv_x, string material_path, string name)
Create a cone geometry.
Geometry CreateCube()
Geometry CreateCube(float width, float height, float length)
Geometry CreateCube(float width, float height, float length, string material_path)
Geometry CreateCube(float width, float height, float length, string material_path, string name)
Create a cube core geometry.

def CreateCube(width = 1, height = 1, length = 1, _material_path = None, _name = None):
    geo = hg.Geometry()

    material_path = _material_path if _material_path else  "@core/materials/default.mat"
    name = _name if _name else "@gen/cube_%f_%f_%f_%s" % (width, height, length, material_path)

    geo.SetName(name)

    x, y, z = width / 2, height / 2, length / 2

    geo.AllocateMaterialTable(1)
    geo.SetMaterial(0, material_path)

    # generate vertices
    geo.AllocateVertex(8)

    geo.SetVertex(0, hg.Vector3(-x, y, z))
    geo.SetVertex(1, hg.Vector3(x, y, z))
    geo.SetVertex(2, hg.Vector3(x, y, -z))
    geo.SetVertex(3, hg.Vector3(-x, y, -z))
    geo.SetVertex(4, hg.Vector3(-x, -y, z))
    geo.SetVertex(5, hg.Vector3(x, -y, z))
    geo.SetVertex(6, hg.Vector3(x, -y, -z))
    geo.SetVertex(7, hg.Vector3(-x, -y, -z))

    # build polygons
    geo.AllocatePolygon(6)

    for n in range(6):
        geo.SetPolygon(n, 4, 0)

    if not geo.AllocateUVChannels(1, 6 * 4) or not geo.AllocatePolygonBinding():
        return None

    geo.SetPolygonBinding(0, [0, 1, 2, 3])
    geo.SetPolygonBinding(1, [3, 2, 6, 7])
    geo.SetPolygonBinding(2, [7, 6, 5, 4])
    geo.SetPolygonBinding(3, [4, 5, 1, 0])
    geo.SetPolygonBinding(4, [2, 1, 5, 6])
    geo.SetPolygonBinding(5, [0, 3, 7, 4])

    geo.SetUV(0, 0, [hg.Vector2(0.5, 0), hg.Vector2(0.5, 0.33), hg.Vector2(0.25, 0.33), hg.Vector2(0.25, 0)])
    geo.SetUV(0, 1, [hg.Vector2(0, 0.33), hg.Vector2(0.25, 0.33), hg.Vector2(0.25, 0.66), hg.Vector2(0, 0.66)])
    geo.SetUV(0, 2, [hg.Vector2(0.25, 1), hg.Vector2(0.25, 0.66), hg.Vector2(0.5, 0.66), hg.Vector2(0.5, 1)])
    geo.SetUV(0, 3, [hg.Vector2(0.75, 0.66), hg.Vector2(0.5, 0.66), hg.Vector2(0.5, 0.33), hg.Vector2(0.75, 0.33)])
    geo.SetUV(0, 4, [hg.Vector2(0.25, 0.33), hg.Vector2(0.5, 0.33), hg.Vector2(0.5, 0.66), hg.Vector2(0.25, 0.66)])
    geo.SetUV(0, 5, [hg.Vector2(0.75, 0.33), hg.Vector2(1, 0.33), hg.Vector2(1, 0.66), hg.Vector2(0.75, 0.66)])

    geo.ComputeVertexNormal()
    geo.ComputeVertexTangent()

    return geo

Geometry CreateCylinder()
Geometry CreateCylinder(float radius, float height)
Geometry CreateCylinder(float radius, float height, int subdiv_x)
Geometry CreateCylinder(float radius, float height, int subdiv_x, string material_path)
Geometry CreateCylinder(float radius, float height, int subdiv_x, string material_path, string name)
Create a cylinder geometry.
RenderGeometry CreateGeometry(Geometry geometry)
RenderGeometry CreateGeometry(Geometry geometry, bool use_cache)
Create a render geometry from a core geometry.
Geometry CreatePlane()
Geometry CreatePlane(float width, float length)
Geometry CreatePlane(float width, float length, int subdiv)
Geometry CreatePlane(float width, float length, int subdiv, string material_path)
Geometry CreatePlane(float width, float length, int subdiv, string material_path, string name)
Create a plane geometry.
Geometry CreateSphere()
Geometry CreateSphere(float radius)
Geometry CreateSphere(float radius, int subdiv_x, int subdiv_y)
Geometry CreateSphere(float radius, int subdiv_x, int subdiv_y, string material_path)
Geometry CreateSphere(float radius, int subdiv_x, int subdiv_y, string material_path, string name)
Create a sphere geometry.
void CreateWorkers()
Start the worker pool.

void DeleteWorkers()
Stop the worker pool.
void EndFrame()
Signal the end of a frame to the Plus system.

Note: Only call this function when using multiple renderer output windows (see NewRenderWindow). When using a single output window Flip will automatically call this function.

void Flip()
Finalize and transfer the graphic frame to the current output window.

void Geometry2D(float x, float y, RenderGeometry geometry)
void Geometry2D(float x, float y, RenderGeometry geometry, float angle_x, float angle_y, float angle_z)
void Geometry2D(float x, float y, RenderGeometry geometry, float angle_x, float angle_y, float angle_z, float scale)
Draw a geometry in 2D.
void Geometry3D(float x, float y, float z, RenderGeometry geometry)
void Geometry3D(float x, float y, float z, RenderGeometry geometry, float angle_x, float angle_y, float angle_z)
void Geometry3D(float x, float y, float z, RenderGeometry geometry, float angle_x, float angle_y, float angle_z, float scale)
Draw a geometry in 3D.
BlendMode GetBlend2D()
Get the current 3D blend mode.
BlendMode GetBlend3D()
Get the current 3D blend mode.
Int64 GetClock()
Return the total elapsed time since the object creation or the last call to Reset.
Int64 GetClockDt()
Return elapsed time since last update in second.
bool GetDepthTest2D()
Return the 2D depth test state.
bool GetDepthTest3D()
Return the 3D depth test state.
bool GetDepthWrite2D()
Return the 2D depth writing state.
bool GetDepthWrite3D()
Return the 3D depth writing state.
string GetFont()
Get the current font path.
InputDevice GetKeyboard()
Return the keyboard input device.
Mixer GetMixer()
Return the mixer.
MixerAsync GetMixerAsync()
Return the asynchronous mixer.
InputDevice GetMouse()
Return the mouse input device.
float, float GetMouseDt()
Return the mouse position change since last update.
float, float GetMousePos()
Return the mouse position.
RenderSystem GetRenderSystem()
Return the global RenderSystem object.
RenderSystemAsync GetRenderSystemAsync()
Return the global RenderSystemAsync object.
Renderer GetRenderer()
Return the global Renderer object.
RendererAsync GetRendererAsync()
Return the global RendererAsync object.
int GetScreenHeight()
Return the system screen height.
int GetScreenWidth()
Return the system screen width.
void Image2D(float x, float y, float scale, string image_path)
void Image2D(float x, float y, float scale, string image_path, Color tint)
Draw an image.
void InitExtern(Renderer renderer, RendererAsync renderer_async, RenderSystem render_system, RenderSystemAsync render_system_async)
Initialize the rendering engine from externally created objects.
bool KeyDown(Key key)
Return True if a key is down.
bool KeyPress(Key key)
Return True if a key was pressed.
bool KeyReleased(Key key)
Return True if a key was released.
void Line2D(float sx, float sy, float ex, float ey)
void Line2D(float sx, float sy, float ex, float ey, Color start_color, Color end_color)
Draw a 2D line.
void Line3D(float sx, float sy, float sz, float ex, float ey, float ez)
void Line3D(float sx, float sy, float sz, float ex, float ey, float ez, Color start_color, Color end_color)
Draw a 3D line.
RenderGeometry LoadGeometry(string path)
Load a render geometry from its path.
RenderMaterial LoadMaterial(string path)
RenderMaterial LoadMaterial(string path, string source)
Load a render material from its path.
bool MouseButtonDown()
bool MouseButtonDown(Button button)
Return True if the mouse button is down.
Scene NewScene()
Scene NewScene(bool use_physics)
Scene NewScene(bool use_physics, bool use_lua)
Create a new scene.
void Plot2D(float x, float y)
void Plot2D(float x, float y, Color color)
Draw a 2D point.
void Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy)
void Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, Color a_color, Color b_color, Color c_color, Color d_color)
void Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture)
void Quad2D(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture, float uv_sx, float uv_sy, float uv_ex, float uv_ey)
Draw a 2D quad.
void Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz)
void Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz, Color a_color, Color b_color, Color c_color, Color d_color)
void Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture)
void Quad3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, float dx, float dy, float dz, Color a_color, Color b_color, Color c_color, Color d_color, Texture texture, float uv_sx, float uv_sy, float uv_ex, float uv_ey)
Draw a 3D quad.
bool RenderInit(int width, int height)
bool RenderInit(int width, int height, string core_path)
bool RenderInit(int width, int height, string core_path, int aa)
bool RenderInit(int width, int height, string core_path, int aa, Visibility visibility)
bool RenderInit(int width, int height, string core_path, int aa, Visibility visibility, bool debug)
bool RenderInit(int width, int height, int aa)
bool RenderInit(int width, int height, int aa, Visibility visibility)
bool RenderInit(int width, int height, int aa, Visibility visibility, bool debug)
Initialize the rendering engine.

Note: You can specify a custom path to core resources if you have performed modifications to them.

void RenderUninit()
Shutdown the rendering engine.
void ResetClock()
Reset the elapsed time counter.
void Set2DOriginIsTopLeft(bool top_left)
Select between a top-left or bottom-left origin for 2D drawing.
void SetBlend2D(BlendMode mode)
Set the current 2D blend mode.
void SetBlend3D(BlendMode mode)
Set the current 3D blend mode.
void SetCamera3D(float x, float y, float z)
void SetCamera3D(float x, float y, float z, float angle_x, float angle_y, float angle_z)
void SetCamera3D(float x, float y, float z, float angle_x, float angle_y, float angle_z, float fov)
void SetCamera3D(float x, float y, float z, float angle_x, float angle_y, float angle_z, float fov, float z_near, float z_far)
void SetCamera3D(Matrix4 view, Matrix44 projection)
Set the render system 3D camera properties.
void SetDepthTest2D(bool enable)
Enable/disable depth testing 2D.
void SetDepthTest3D(bool enable)
Enable/disable depth testing 3D.
void SetDepthWrite2D(bool enable)
Enable/disable depth writing in 2D.
void SetDepthWrite3D(bool enable)
Enable/disable depth writing in 3D.
void SetFont(string path)
Set the current font path.
void Sprite2D(float x, float y, float size, string image_path)
void Sprite2D(float x, float y, float size, string image_path, Color tint)
void Sprite2D(float x, float y, float size, string image_path, Color tint, float pivot_x, float pivot_y)
void Sprite2D(float x, float y, float size, string image_path, Color tint, float pivot_x, float pivot_y, bool flip_h, bool flip_v)
Draw a sprite.
void Text2D(float x, float y, string text)
void Text2D(float x, float y, string text, float size)
void Text2D(float x, float y, string text, float size, Color color)
void Text2D(float x, float y, string text, float size, Color color, string font_path)
Draw 2D text.
void Text3D(float x, float y, float z, string text)
void Text3D(float x, float y, float z, string text, float size)
void Text3D(float x, float y, float z, string text, float size, Color color)
void Text3D(float x, float y, float z, string text, float size, Color color, string font_path)
Draw 3D text.
void Texture2D(float x, float y, float scale, Texture texture)
void Texture2D(float x, float y, float scale, Texture texture, Color tint)
void Texture2D(float x, float y, float scale, Texture texture, Color color, bool flip_h, bool flip_v)
Draw a texture.
void Triangle2D(float ax, float ay, float bx, float by, float cx, float cy)
void Triangle2D(float ax, float ay, float bx, float by, float cx, float cy, Color a_color, Color b_color, Color c_color)
Draw a 2D triangle.
void Triangle3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz)
void Triangle3D(float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, Color a_color, Color b_color, Color c_color)
Draw a 3D triangle.
void UninitExtern()
Shutdown the rendering engine when initialized from externally created objects.
Int64 UpdateClock()
Update clock and return the elapsed time since last update in second.
void UpdateScene(Scene scene)
void UpdateScene(Scene scene, Int64 dt)
Update scene.