Scope
Assuming that you have read the article W4 Physics for Dummies.
This page describes how to use the W4 [GUI] subsystem.
This subsystem is based on widgets. A widget is a user interface element that you can specify the appearance and user input processing. For example, "w4 :: gui :: Label" allows you to show some text, and with "w4 :: gui :: Image" you can show a picture from a file. You can also assign a click handler.
Basic Information
Take the following code as the basis:
#include "W4Framework.h"
W4_USE_UNSTRICT_INTERFACE
struct W4_GUI_Demo : public IGame
{
public:
void onStart() override
{
auto cam = Render::getScreenCamera();
cam->setWorldTranslation({0.f, 0, -25.f});
cam->setFov(45.f);
m_shape = Mesh::create::cube({5,5,5});
m_shape->setMaterialInst(Material::getDefault()->createInstance());
Render::getRoot()->addChild(m_shape);
}
void onUpdate(float dt) override
{
m_shape->rotateLocal({dt,dt,dt});
}
private:
sptr<Mesh> m_shape;
};
W4_RUN(W4_GUI_Demo)