Canvas

Canvas is mandatory in a parent of GameObject which contains Image or Text

Why ?

Canvas is a component really useful for your UIs game. This component is made to do some calculations to render your images and texts. To make this render, it uses an enum called : ResizyngType.

ResizyngType

This enum contains 2 differents type of resizing :

  • PIXEL_CONSTANT : if your windows is resized, all things in your canvas gonna keep the same size (even they go outside the screen)

  • RESIZE_WITH_SCREEN : if your windows is resized, all things in your canvas gonna be recalculated to feat with your screen

Create a canvas

// here scene is already defined
// canvas = std::shared_ptr<GameObject>
auto canvas = KapEngine::UI::UiFactory::createCanvas(scene, "Canvas Name In Scene");
UiFactory

Last updated