Polycode provides a number of basic geometry primitives that you can create as well as a simple image display class that lets you quickly add images to a scene.

Contents

Creating primitives.

To create a primitive, use the ScenePrimitive class. The first argument to the constructor of a ScenePrimitive is the type of primitive you want to create, followed by the parameters that define its size and other options.

C++
Scene *scene = new Scene(Scene::SCENE_2D);
ScenePrimitive *box = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.5, 0.5);
scene->addChild(box);
Lua
scene = Scene(Scene.SCENE_2D)
box = ScenePrimitive(ScenePrimitive.TYPE_VPLANE, 0.5, 0.5)
scene:addChild(box)

See the ScenePrimitive documentation for the different types of primitives you can create and the options that they take.

Creating images.

Polycode provides a simple wrapper around ScenePrimitive called SceneImage, which creates a VPLANE primitive and sets a texture from an image file. SceneImage is provided as a convenience class for 2d scenes and has very limited functionality. For more complex image and texture manipulation, see Textures and images.

SceneImage sets the size of the VPLANE primitive to the pixel dimentions of the image, so you have to make sure your scene ortho size is set to something large enough that you can fit the image dimensions within it (see Orthographic modes and resolutions).

C++
Scene *scene = new Scene(Scene::SCENE_2D);
scene->getDefaultCamera()->setOrthoSize(1920, 1080);
SceneImage *image = new SceneImage("dummy.png");
scene->addChild(image);
Lua
scene = Scene(Scene.SCENE_2D)
scene:getDefaultCamera():setOrthoSize(1920, 1080)
image = SceneImage("dummy.png")
scene:addChild(image)