AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
LuxPadGlyphs.h
Go to the documentation of this file.
1/*
2 * AMFP-2026: a gamepad glyph shown on a button only while the pad is in use (last input,
3 * cLuxInputHandler::IsGamepadMode). The texture is created once and toggled, never leaked.
4 */
5#ifndef LUX_PAD_GLYPHS_H
6#define LUX_PAD_GLYPHS_H
7
8#include "LuxBase.h"
9
11{
12public:
13 cLuxPadGlyph() : mpButton(NULL), mpGfx(NULL) {}
14
15 void Init(cGuiSet* apSet, cWidgetButton* apButton, const tString& asIcon)
16 {
17 mpButton = apButton;
18 mpGfx = apSet->GetGui()->CreateGfxTexture(asIcon, eGuiMaterial_Alpha, eTextureType_2D, cColor(1,1), false);
19 }
20
21 void Update(bool abGamepad)
22 {
23 if(mpButton == NULL || mpGfx == NULL) return;
24 if(abGamepad)
25 {
26 if(mpButton->GetImage() != mpGfx) { mpButton->SetImage(mpGfx, false); mpButton->SetImageAtLeft(true); }
27 }
28 else if(mpButton->GetImage() == mpGfx) mpButton->SetImage(NULL, false);
29 }
30
31private:
32 cWidgetButton* mpButton;
33 cGuiGfxElement* mpGfx;
34};
35
36#endif
void Init(cGuiSet *apSet, cWidgetButton *apButton, const tString &asIcon)
void Update(bool abGamepad)