Mali GPU User Interface Engine Application Development Guide
Mali GPU User Interface Engine Application Development Guide
Mali GPU User Interface Engine Application Development Guide
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Tutorial on the Lotion <strong>User</strong> <strong>Interface</strong> Classes5.4.5 Widget initialization and event handlingNew methods are added to respond to widget creation or change. See Example 5-24:Example 5-24 Widget initialization and event handlingvoid LightShow::onCreate(Widget* w) {static const int NORMAL_FONT_SIZE=21;if (w != this)return;styggShader = false;useWireframe = false;Context* context = get<strong>Application</strong>()->getContext();Proxy* proxy = get<strong>Application</strong>()->getProxy();scene = proxy->getSceneAsset("applets/lightshow/lightshow_remake.MBA{applets/lightshow/}");flarePrg = proxy->getProgram("applets/lightshow/flare.vert;applets/lightshow/flare.frag");prg_gl2 = proxy->getProgram("applets/lightshow/lightshow.vert;applets/lightshow/lightshow.frag");prg_gl1 = proxy->getProgram("applets/lightshow/lightshow_gl1.vert;applets/lightshow/lightshow_gl1.frag");prepareFlares(context, flarePrg);camNode = (NodeAsset*) scene->getAsset(Asset::TYPE_NODE, "Camera01-node");targetNode = (NodeAsset*) scene->getAsset(Asset::TYPE_NODE,"Camera01.Target-node");light0Node = (NodeAsset*) scene->getAsset(Asset::TYPE_NODE, "Omni01-node");light1Node = (NodeAsset*) scene->getAsset(Asset::TYPE_NODE, "Omni02-node");flareTex = proxy->getTexture2D("applets/lightshow/flare.png");time = 0;wg = createWidgetGroup("lightshow_wg");// add the user controls to switch between shading effectspanel = wg->createPanel(this);panel->setSize(MDE::vec2i(180, 200));panel->setPosition(MDE::vec2i(0, 0));settingsGlLbl = wg->createCustomLabel(this);settingsGlLbl->build(NORMAL_FONT_SIZE, 16);settingsGlLbl->setPosition(vec2i(10, 0));settingsGlLbl->setColor(vec4(1.f, 1.f, 1.f, 1.f));settingsGlLbl->setTextAlign(TEXT_ALIGN_LEFT | TEXT_ALIGN_TOP);settingsGlLbl->setText("GL Version");gl11Chk = wg->createRadioButton(this);gl11Chk->setText("GLES 1.1");gl11Chk->setPosition(vec2i(10, 25));gl20Chk = wg->createRadioButton(this);gl20Chk->setText("GLES 2.0");gl20Chk->setPosition(vec2i(10, 50));glVersion = new RadioButtonGroup();glVersion->add(gl11Chk);glVersion->add(gl20Chk);ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 5-29ID070710Non-Confidential - Draft - Beta