MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setBitmap

Method setBitmap

Engine/source/afx/ui/afxSpellButton.cpp:162–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void afxSpellButton::setBitmap(const char *name, bool placeholder)
163{
164 mBitmapName = (name) ? StringTable->insert(name) : ST_NULLSTRING;
165 if (!isAwake())
166 return;
167
168 if (mBitmapName != ST_NULLSTRING)
169 {
170 char buffer[1024];
171 char *p;
172
173 if (placeholder)
174 {
175 dStrcpy(buffer, name, 1024);
176 S32 pLen = 1024 - dStrlen(buffer);
177 p = buffer + dStrlen(buffer);
178
179 dStrcpy(p, "_i", pLen);
180 mTextureInactive.set(buffer, COOLDOWN_PROFILE);
181 mTextureNormal = mTextureInactive;
182 mTextureHilight = mTextureInactive;
183 mTextureDepressed = mTextureInactive;
184 setActive(false);
185 }
186 else
187 {
188 dStrcpy(buffer, name, 1024);
189 S32 pLen = 1024 - dStrlen(buffer);
190 p = buffer + dStrlen(buffer);
191 dStrcpy(p, "_n", pLen);
192 mTextureNormal.set(buffer, COOLDOWN_PROFILE);
193 dStrcpy(p, "_h", pLen);
194 mTextureHilight.set(buffer, COOLDOWN_PROFILE);
195 if (!mTextureHilight)
196 mTextureHilight = mTextureNormal;
197 dStrcpy(p, "_d", pLen);
198 mTextureDepressed.set(buffer, COOLDOWN_PROFILE);
199 if (!mTextureDepressed)
200 mTextureDepressed = mTextureHilight;
201 dStrcpy(p, "_i", pLen);
202 mTextureInactive.set(buffer, COOLDOWN_PROFILE);
203 if (!mTextureInactive)
204 mTextureInactive = mTextureNormal;
205 setActive(true);
206 }
207 }
208 else
209 {
210 mTextureNormal = NULL;
211 mTextureHilight = NULL;
212 mTextureDepressed = NULL;
213 mTextureInactive = NULL;
214 }
215
216 setUpdate();
217}
218
219void afxSpellButton::onRender(Point2I offset, const RectI& updateRect)

Callers 15

openMethod · 0.45
onStartOfFrameMethod · 0.45
updatePreviewImageMethod · 0.45
setPreviewImageMethod · 0.45
constructEditControlMethod · 0.45
updatePreviewImageMethod · 0.45
setPreviewImageMethod · 0.45
constructEditControlMethod · 0.45
updatePreviewImageMethod · 0.45
setPreviewImageMethod · 0.45
constructEditControlMethod · 0.45
constructEditControlMethod · 0.45

Calls 5

dStrcpyFunction · 0.85
isAwakeFunction · 0.50
dStrlenFunction · 0.50
insertMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected