|
Post by praks1510 on Oct 5, 2015 4:34:51 GMT -8
Hi ,
Am a beginner with Gameduino2. I have gone through all the example files.
I would like to load a .jpg image on the start-up, then I would like to have some text messages displayed with few buttons on the bottom. The buttons should navigate the user to different levels.
I am not able to load a .jpg image. The image is in SD card in .jpg format. The size of the image is 128x128 pixels.
Can someone help with the use of cmd_button() function and the touch inputs?
|
|
|
Post by jamesbowman on Oct 5, 2015 6:37:18 GMT -8
Are you able to run the sample under "1.Basics" called 'jpeg'? It loads a jpeg from SD card.
|
|
|
Post by praks1510 on Oct 5, 2015 23:36:03 GMT -8
Yes am able to do that. I have my image in the same folder in the SD card. My image does not load but the predefined images "healsky3", "selfie", "tree" and "sunrise" loads.
|
|
|
Post by jamesbowman on Oct 6, 2015 6:48:37 GMT -8
Strange that all other files work but your jpeg does not.
Filenames longer than 8 characters do not work. So
abcdefgh.jpg is good. But
abcdefghi.jpg is bad.
|
|
|
Post by praks1510 on Oct 6, 2015 20:24:09 GMT -8
Is there a way that I could attach the files here? My file names are mes.jpg mes1.png
I would like to know if am missing anything here. Should the image files come with a header file or .gd2 file? Any converter to be used?
|
|
|
Post by praks1510 on Oct 6, 2015 21:08:10 GMT -8
The images are working now. Thanks. I changed the files to .jpg and its working now. Thanks again.
Can you please clarify the following for me? 1. How to change the background color and the font color in a button? 2. Can I use an image as the background for the button? 3. Can I draw text-box?
|
|
|
Post by jamesbowman on Oct 7, 2015 16:52:52 GMT -8
1. Yes, you can set both colors like this - green text on a purple button: #include <EEPROM.h> #include <SPI.h> #include <GD2.h>
void setup() { GD.begin(); }
void loop() { const int font = 31;
GD.Clear(); GD.cmd_fgcolor(0xa00090); // Purple GD.ColorRGB(0x00ff00); // green GD.cmd_button(160, 100, 160, 70, font, 0, "Button"); GD.swap(); }
2. Backgrounds for buttons can be drawn using round-cornered rectangles, p. 167 in the Gameduino 2 book (http://excamera.com/files/gd2book_v0.pdf) 3. Text boxes can be drawn using round-cornered rectangles, see p. 168 in the book:
|
|