MCPcopy Create free account
hub / github.com/XorTroll/uLaunch / OnInput

Method OnInput

projects/uMenu/source/ul/menu/ui/ui_ClickableImage.cpp:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 }
23
24 void ClickableImage::OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const pu::ui::TouchPoint touch_pos) {
25 if(this->touched) {
26 const auto tp_now = std::chrono::steady_clock::now();
27 const u64 diff = std::chrono::duration_cast<std::chrono::milliseconds>(tp_now - this->touch_tp).count();
28 if(diff >= TouchActionTimeMs) {
29 this->touched = false;
30 if(this->cb) {
31 this->cb();
32 }
33 SDL_SetTextureColorMod(this->img_tex->Get(), 0xFF, 0xFF, 0xFF);
34 }
35 }
36 else if(touch_pos.HitsRegion(this->GetProcessedX(), this->GetProcessedY(), this->w, this->h)) {
37 this->touch_tp = std::chrono::steady_clock::now();
38 this->touched = true;
39 SDL_SetTextureColorMod(this->img_tex->Get(), RedColorMod, GreenColorMod, BlueColorMod);
40 }
41 }
42
43}

Callers

nothing calls this directly

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected