FT800Keypad
A simple keypad with numbers 0/9 which has as its purpose the use of the tag so that they are well recognized to the pressure of the buttons.
The example is taken from the datasheet of Gameduino but I had to make some changes to the original listing.
In Firewing, with the module FT800, every time you assign a tag to an object you must then prevent this assignment persevere within the screen you are viewing.
My advice is to disable the tags for any new command with FT.TagMask(0) and then enable it before granting the new tag with the command FT.TagMask(1).
This prevents objects in the background, such as bitmap loaded previously, can give unexpected results which tags with undefined values type 255.
Keypad.bas
#option _gccOptimise = Os #option FT_MODEL = GAMEDUINO ' enable for Gameduino 2 imports Ft800 Private Sub Paint_Alpha() FT.BlendFunc(ONE, ONE_MINUS_SRC_ALPHA) End Sub Private Sub Clear_Alpha() FT.BlendFunc(ZERO, ONE_MINUS_SRC_ALPHA) End Sub Private Sub button(x As Integer, y As Integer, label As Byte) Dim sz As Byte = 14 // button size in pixels FT.TagMask(1) FT.Tag(label) Paint_Alpha() FT.Begin(RECTS) FT.LineWidth(16 * 20) FT.VERTEX2II(x - sz, y - sz) FT.VERTEX2II(x + sz, y + sz) Clear_Alpha() FT.ColorA(200) FT.ColorA(200) FT.LineWidth(16 * 15) FT.VERTEX2II(x - sz, y - sz) FT.VERTEX2II(x + sz, y + sz) FT.ColorA($ff) Paint_Alpha() FT.cmd_number(x, y, 31, OPT_CENTER, label) FT.TagMask(0) End Sub Dim x0, x1, x2, y0, y1, y2, selectedTag As Integer Sub Main() x0 = 40 ' 160 x1 = 110 ' 240 x2 = 180 ' 320 y0 = 50 ' 56 y1 = 120 ' 136 y2 = 190 ' 216 ft.selfcalibrate FT.cmd_loadimage(0,0) If Not FT.Load("chipmunk.jpg") Then FT.clear() FT.cmd_text(240, 136, 29, OPT_CENTER, "Unable to load file") FT.Swap() Else While true FT.clear() FT.TagMask(0) FT.ColorMask(1, 1, 1, 0) FT.Begin(BITMAPS) FT.VERTEX2II(0, 0) FT.ColorMask(0, 0, 0, 1) button(x0, y0, 1) button(x1, y0, 2) button(x2, y0, 3) button(x0, y1, 4) button(x1, y1, 5) button(x2, y1, 6) button(x0, y2, 7) button(x1, y2, 8) button(x2, y2, 9) FT.TagMask(0) FT.ColorMask(1, 1, 1, 1) FT.ColorRGB($ffffff) FT.BlendFunc(DST_ALPHA, ONE_MINUS_DST_ALPHA) FT.Begin(RECTS) FT.VERTEX2II(0, 0) FT.VERTEX2II(480, 272) FT.RestoreContext() selectedTag = FT.GetTag() FT.cmd_text(15, 240, 27, 0, "Now is Pressed : " + cStr(selectedTag)) FT.Swap() End While End If End Sub


