2024-03-19 03:23 PM
Hi!
I want to ask a question about designing a chess game such as Gomoku using TouchGFX. As far as I know, I need to put two chesses in every single spot and set them as invisible. When user clicks, then set them to visible. However, this is a very tedious implmentation when board size is really large.
I am wondering if there's another way to directly draw a new circle in the ClickHandler callback function?
Thanks so much for your support!
Solved! Go to Solution.
2024-03-21 01:36 AM
Hello @ZZY ,
This implementation with setting visible and invisibles chess pieces is the simplest one, you can use a single pawn per spot and change it to black or white :
imageName.setBitmap(Bitmap(BITMAP_MYIMAGE_ID));
If you don't want to put a pawn per position, you can use a ClickHandler, with only one widget and a snapshot widget.
The snapshot widget is use for taking a snapshot of the frame buffer, so your old pawn is not a widget anymore but a part of the background image
Here is what you can do :
I hope it helps you,
Regards
2024-03-21 01:36 AM
Hello @ZZY ,
This implementation with setting visible and invisibles chess pieces is the simplest one, you can use a single pawn per spot and change it to black or white :
imageName.setBitmap(Bitmap(BITMAP_MYIMAGE_ID));
If you don't want to put a pawn per position, you can use a ClickHandler, with only one widget and a snapshot widget.
The snapshot widget is use for taking a snapshot of the frame buffer, so your old pawn is not a widget anymore but a part of the background image
Here is what you can do :
I hope it helps you,
Regards
2024-04-26 05:22 AM
2024-04-27 04:38 PM
Yes I used that approach and solved it! Thank u
2024-04-29 02:54 AM
Awesome, great to hear!