From d4f12cb9b0ae94de7af1c52a54e7a41688892476 Mon Sep 17 00:00:00 2001 From: Tobi-D7 Date: Sun, 8 May 2022 05:00:11 +0200 Subject: [PATCH] Fix for Touch --- renderd7.cpp | 6 ++++++ renderd7.hpp | 1 + 2 files changed, 7 insertions(+) diff --git a/renderd7.cpp b/renderd7.cpp index f9fb552..3d10425 100644 --- a/renderd7.cpp +++ b/renderd7.cpp @@ -839,6 +839,12 @@ bool RenderD7::touchTObj(touchPosition touch, RenderD7::TObject button) else return false; } +bool RenderD7::touchTLBtn(touchPosition touch, RenderD7::TLBtn button) +{ + if (touch.px >= button.x && touch.px <= (button.x + button.w) && touch.py >= button.y && touch.py <= (button.y + button.h)) return true; + else return false; +} + int RenderD7::GetRandomInt(int b, int e) { std::default_random_engine generator; diff --git a/renderd7.hpp b/renderd7.hpp index a8649be..d92f514 100644 --- a/renderd7.hpp +++ b/renderd7.hpp @@ -348,6 +348,7 @@ namespace RenderD7 void DrawTObjects(std::vector tobjects, u32 color, u32 txtcolor, int selection = -1, u32 selbgcolor = RenderD7::Color::Hex("#2D98AF"), u32 selcolor = RenderD7::Color::Hex("#000000")); void DrawSTObject(std::vector tobject, int tobjectindex, u32 color, u32 txtcolor); bool touchTObj(touchPosition touch, RenderD7::TObject button); + bool touchTLBtn(touchPosition touch, RenderD7::TLBtn button); void DrawTLBtns(std::vector btns, u32 color, int selection = -1, u32 selbgcolor = RenderD7::Color::Hex("#2D98AF"), u32 selcolor = RenderD7::Color::Hex("#000000")); struct Checkbox