aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/gwin/widgets
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-02-07 18:44:32 +1000
committerinmarket <andrewh@inmarket.com.au>2014-02-07 18:44:32 +1000
commit4d3a08f5cfd244f82d1283cab702450e1dad14cd (patch)
tree817f58f61455ef4d0c296a7a44f4b56d0999b29e /demos/modules/gwin/widgets
parentf7d6b9b58e4e8d979004026b41c1bfd275218fb9 (diff)
downloaduGFX-4d3a08f5cfd244f82d1283cab702450e1dad14cd.tar.gz
uGFX-4d3a08f5cfd244f82d1283cab702450e1dad14cd.tar.bz2
uGFX-4d3a08f5cfd244f82d1283cab702450e1dad14cd.zip
Update image demo's to use GFILE ROMFS.
Diffstat (limited to 'demos/modules/gwin/widgets')
-rw-r--r--demos/modules/gwin/widgets/gfxconf.h3
-rw-r--r--demos/modules/gwin/widgets/main.c15
-rw-r--r--demos/modules/gwin/widgets/romfs_files.h8
-rw-r--r--demos/modules/gwin/widgets/romfs_img_chibios.h (renamed from demos/modules/gwin/widgets/image_chibios.h)8
-rw-r--r--demos/modules/gwin/widgets/romfs_img_yesno.h (renamed from demos/modules/gwin/widgets/image_yesno.h)12
5 files changed, 35 insertions, 11 deletions
diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h
index b536de4c..60de8d8b 100644
--- a/demos/modules/gwin/widgets/gfxconf.h
+++ b/demos/modules/gwin/widgets/gfxconf.h
@@ -81,7 +81,8 @@
/* Features for the GFILE subsystem. */
#define GFX_USE_GFILE TRUE
-#define GFILE_NEED_MEMFS TRUE
+#define GFILE_NEED_ROMFS TRUE
+//#define GFILE_NEED_NATIVEFS TRUE
/* Features for the GINPUT subsystem. */
#define GINPUT_NEED_MOUSE TRUE
diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c
index 80c39dd9..7c06f3bf 100644
--- a/demos/modules/gwin/widgets/main.c
+++ b/demos/modules/gwin/widgets/main.c
@@ -28,16 +28,19 @@
#include "gfx.h"
-// include our chibios logo in a .gif format
-#include "image_chibios.h"
-#include "image_yesno.h"
-
/**
* This demo demonstrates many of the GWIN widgets.
* On the "Radio" tab try playing with the color radio buttons.
* On the "Checkbox" tab try playing with the "Disable All" checkbox.
*/
+/**
+ * The image files must be stored on a GFILE file-system.
+ * Use either GFILE_NEED_NATIVEFS or GFILE_NEED_ROMFS (or both).
+ *
+ * The ROMFS uses the file "romfs_files.h" to describe the set of files in the ROMFS.
+ */
+
/* Our custom yellow style */
static const GWidgetStyle YellowWidgetStyle = {
Yellow, // window background
@@ -184,14 +187,14 @@ static void createWidgets(void) {
wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; ghList3 = gwinListCreate(0, &wi, TRUE);
gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 1", FALSE);
gwinListAddItem(ghList3, "Item 2", FALSE); gwinListAddItem(ghList3, "Item 3", FALSE);
- gdispImageOpenMemory(&imgYesNo, image_yesno);
+ gdispImageOpenFile(&imgYesNo, "image_yesno.gif");
gwinListItemSetImage(ghList3, 1, &imgYesNo);
gwinListItemSetImage(ghList3, 3, &imgYesNo);
// Image
wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200;
ghImage1 = gwinImageCreate(0, &wi.g);
- gwinImageOpenMemory(ghImage1, image_chibios);
+ gwinImageOpenFile(ghImage1, "chibios.bmp");
gwinImageCache(ghImage1);
// Console - we apply some special colors before making it visible
diff --git a/demos/modules/gwin/widgets/romfs_files.h b/demos/modules/gwin/widgets/romfs_files.h
new file mode 100644
index 00000000..b503765d
--- /dev/null
+++ b/demos/modules/gwin/widgets/romfs_files.h
@@ -0,0 +1,8 @@
+/**
+ * This file contains the list of files for the ROMFS.
+ *
+ * The files have been converted using...
+ * file2c -dbcs infile outfile
+ */
+#include "romfs_img_chibios.h"
+#include "romfs_img_yesno.h"
diff --git a/demos/modules/gwin/widgets/image_chibios.h b/demos/modules/gwin/widgets/romfs_img_chibios.h
index a052395f..14007610 100644
--- a/demos/modules/gwin/widgets/image_chibios.h
+++ b/demos/modules/gwin/widgets/romfs_img_chibios.h
@@ -1,4 +1,4 @@
-static const unsigned char image_chibios[] = {
+static const char image_chibios[] = {
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x74, 0x00, 0x74, 0x00, 0xE7, 0xFE, 0x00, 0x08, 0x07, 0x02,
0x00, 0x0A, 0x03, 0x08, 0x07, 0x0E, 0x05, 0x0D, 0x00, 0x00, 0x11, 0x02, 0x03, 0x16, 0x01, 0x09,
0x15, 0x00, 0x00, 0x19, 0x03, 0x14, 0x16, 0x06, 0x00, 0x1D, 0x02, 0x07, 0x1C, 0x01, 0x0F, 0x1A,
@@ -635,3 +635,9 @@ static const unsigned char image_chibios[] = {
0xE0, 0x3F, 0x62, 0xE0, 0x07, 0x86, 0xE0, 0x08, 0x96, 0xE0, 0x09, 0xA6, 0xE0, 0x0A, 0xB6, 0xE0,
0x0B, 0xC6, 0x60, 0xF0, 0x08, 0x08, 0x00, 0x3B,
};
+
+#ifdef ROMFS_DIRENTRY_HEAD
+ static const ROMFS_DIRENTRY image_chibios_dir = { 0, 0, ROMFS_DIRENTRY_HEAD, "chibios.bmp", 634*16+8, image_chibios };
+ #undef ROMFS_DIRENTRY_HEAD
+ #define ROMFS_DIRENTRY_HEAD &image_chibios_dir
+#endif
diff --git a/demos/modules/gwin/widgets/image_yesno.h b/demos/modules/gwin/widgets/romfs_img_yesno.h
index c3150ea7..0559330e 100644
--- a/demos/modules/gwin/widgets/image_yesno.h
+++ b/demos/modules/gwin/widgets/romfs_img_yesno.h
@@ -1,10 +1,10 @@
/**
- * This file was generated from "yesno.gif" using...
+ * This file was generated from "image_yesno.gif" using...
*
- * file2c -bcs image_yesno.gif image_yesno.h
+ * file2c -bbcs image_yesno.gif romfs_img_yesno.h
*
*/
-static const unsigned char image_yesno[] = {
+static const char image_yesno[] = {
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x0B, 0x00, 0x2C, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC6, 0x00, 0xC6, 0xFF, 0xC6, 0xCE, 0xFF, 0xCE, 0xFF, 0x08, 0x18, 0xFF, 0xCE, 0xDE, 0xFF,
0xDE, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -19,3 +19,9 @@ static const unsigned char image_yesno[] = {
0x05, 0x35, 0x81, 0x84, 0x86, 0x83, 0x14, 0x8B, 0x07, 0x86, 0x79, 0x8F, 0x82, 0x8F, 0x8E, 0x17,
0x8E, 0x62, 0x8B, 0x8C, 0x8A, 0x87, 0x05, 0x11, 0x00, 0x3B,
};
+
+#ifdef ROMFS_DIRENTRY_HEAD
+ static const ROMFS_DIRENTRY image_yesno_dir = { 0, 0, ROMFS_DIRENTRY_HEAD, "image_yesno.gif", 202, image_yesno };
+ #undef ROMFS_DIRENTRY_HEAD
+ #define ROMFS_DIRENTRY_HEAD &image_yesno_dir
+#endif