> For the complete documentation index, see [llms.txt](https://kap35.gitbook.io/kap-engine-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kap35.gitbook.io/kap-engine-wiki/user-manual/ui/canvas.md).

# Canvas

{% hint style="info" %}
Canvas is mandatory in a parent of GameObject which contains Image or Text
{% endhint %}

## 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 :&#x20;

* 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

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

{% content-ref url="/pages/TUZOStePMGYCkPtmxbGd" %}
[UiFactory](/kap-engine-wiki/user-manual/ui/uifactory.md)
{% endcontent-ref %}
