aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-06-26 13:16:36 +0200
committerTectu <joel@unormal.org>2012-06-26 13:16:36 +0200
commit87888e474da82cfac4ad0ce8f03a1e9647542cd8 (patch)
tree599b22eb3812b2f38052817d88b05d161c1d8b60
parent588429506c668281354523fec3a7f9009901bf1f (diff)
downloaduGFX-87888e474da82cfac4ad0ce8f03a1e9647542cd8.tar.gz
uGFX-87888e474da82cfac4ad0ce8f03a1e9647542cd8.tar.bz2
uGFX-87888e474da82cfac4ad0ce8f03a1e9647542cd8.zip
implemented GUI button drawing
-rw-r--r--gui.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gui.c b/gui.c
index 8605dce7..c4bf6865 100644
--- a/gui.c
+++ b/gui.c
@@ -56,7 +56,7 @@ static void deleteNode(char *name) {
}
}
-void printNodes(BaseSequentialStream *chp) {
+static void printNodes(BaseSequentialStream *chp) {
struct guiNode_t *pointer = firstGUI;
chprintf(chp, "\r\n\nguiNodes:\r\n\n");
@@ -82,9 +82,20 @@ static void guiThread(const uint16_t interval) {
chRegSetThreadName("GUI");
while(TRUE) {
- x = tpReadX();
- y = tpReadY();
-
+ for(node = firstGUI; node; node = node->next) {
+ if(*(node->active) == active) {
+ x = tpReadX();
+ y = tpReadY();
+
+ if(x >= node->x0 && x <= node->x1 && y >= node->y0 && y <= node->y1)
+ *(node->state) = 1;
+ else
+ *(node->state) = 0;
+
+ chThdSleepMilliseconds(interval);
+ }
+ }
+
chThdSleepMilliseconds(interval);
}
}