|
Post by fortytwo on Apr 23, 2014 9:09:32 GMT -8
Hi All,
Newbie here, so please don't bite my head off for asking a silly question.
I am very new to GD2, which I intend to use with Mega 2560.
The very first screen I would like to create is a numeric keypad, much like that found on a telephone, with "CLR" and "ENT" buttons in place of * and #.
Is this something which is relatively easy to do from scratch, or is there a function which I could use to draw the buttons (ideally, rectangles with rounded corners), then place the numerals (and CLR and ENT) text onto the buttons, detect presses of the buttons, hopefully "animate" the buttons when they're pressed, and issue a click/beep sound each time a press happens?
Any ideas or advice gratefully received. Thanks very much in advance!
42
|
|
diesel
Junior Member
Posts: 22
|
Post by diesel on Apr 24, 2014 4:26:54 GMT -8
GD.get_inputs(); x1 = GD.inputs.x; y1 = GD.inputs.y; GD.ColorRGB(0xFFFFFF);//Font Color GD.cmd_fgcolor(0xE00000);//Button Color GD.cmd_button(65, 55, 30, 30, 18, 0, "put your clr or ent here"); if ((x1>=65)&&(x1<=95)&&(y1>=55)&&(y1<=85)){//Map of button location instead of touch tags x, y, l, h, menu =false; sound =true; }
This is the way I make buttons using an if statement for the presses.
I assign x1 and y1 as a global int in setup.
All you have to do is define the action which you want to occur in the if statement.
Page 68 in the Gameduino 2 book outlines sounds.
|
|
|
Post by jamesbowman on Apr 24, 2014 7:45:15 GMT -8
There is a keypad example on p.168 of the GD2 book.
|
|
|
Post by fortytwo on Apr 25, 2014 5:23:54 GMT -8
Thanks - both of you. Very helpful indeed.
|
|