MCPcopy Create free account
hub / github.com/android/ndk-samples / _apply_transition

Function _apply_transition

endless-tunnel/app/src/main/cpp/ui_scene.cpp:289–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289static void _apply_transition(int trans, float f, float* x, float* y, float* w,
290 float* h, float* fontScale) {
291 float maxX = SceneManager::GetInstance()->GetScreenAspect();
292 switch (trans) {
293 case UiWidget::TRANS_SCALE:
294 *w = *w * f;
295 *h = *h * f;
296 *fontScale = *fontScale * f;
297 break;
298 case UiWidget::TRANS_FROM_LEFT:
299 *x = Interpolate(0.0f, *x - *w * 0.5f, 1.0f, *x, f);
300 break;
301 case UiWidget::TRANS_FROM_RIGHT:
302 *x = Interpolate(0.0f, maxX + *w * 0.5f, 1.0f, *x, f);
303 break;
304 case UiWidget::TRANS_FROM_TOP:
305 *y = Interpolate(0.0f, 1.0f + *h * 0.5f, 1.0f, *y, f);
306 break;
307 case UiWidget::TRANS_FROM_BOTTOM:
308 *y = Interpolate(0.0f, *y - *h * 0.5f, 1.0f, *y, f);
309 break;
310 }
311}
312
313void UiWidget::Render(TrivialShader*, TextRenderer* textRenderer,
314 ShapeRenderer* shapeRenderer, int focus,

Callers 1

RenderMethod · 0.85

Calls 2

InterpolateFunction · 0.85
GetScreenAspectMethod · 0.80

Tested by

no test coverage detected