|
Post by Bow Man on Oct 12, 2014 21:50:20 GMT -8
Hi, I trying to make a button when pressed, will display a JPEG image. However I have no clue as to how the GD.tag and the GD.get_inputs work, tried referring to the blob and selftest example scripts but don't understand...
|
|
bubu
Junior Member
Posts: 17
|
Post by bubu on Oct 22, 2014 23:44:41 GMT -8
Here is how I do this: Before you draw the button, you set the TAG which should be related to your button.
//My next button being drawn should become TAG 1 GD.TagMask(1); //Now draw a simple button with a star on it: GD.cmd_button(0,0,50,50,18,0,"*"); //Do not forget to switch TagMask to avoid further drawing commands also being tagged "1" GD.TagMask(0); //Can be omitted if there are no further drawing command befor GD.swap();
At some Point in your code you now request the inputs, I do that normaly directly after GD.swap(); GD.get_inputs();
Now, GD.inputs.tag has the value of any tag being touched - if there was any touch.
if (GD.inputs.tag==1) { //My button with tag 1 was pressed ... }
See page 22ff in the manuel from 2.6 "Touch tags" to 2.7 "Game: Simon" That also explains what you need.
|
|