Difference between revisions of "W4 GUI Creation"
From Ciliz|W4
(→Scope) |
|||
Line 1: | Line 1: | ||
== Scope == | == Scope == | ||
− | Assuming that you have read the article W4 Physics for Dummies. | + | Assuming that you have read the article [[W4 Physics for Dummies]]. |
− | This page describes how to | + | This page describes how to add [[https://en.wikipedia.org/wiki/Graphical_user_interface GUI]] to the project. |
− | + | W4 GUI 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 also can assign a click handler. | |
== Basic Information == | == Basic Information == |
Revision as of 12:17, 30 June 2020
Scope
Assuming that you have read the article W4 Physics for Dummies.
This page describes how to add [GUI] to the project.
W4 GUI 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 also can 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)