changeset 229:cc8dd16d8b6a

Modify dynamic to support the dynamic loading
author wycc
date Wed, 17 Dec 2008 21:18:44 +0800
parents 25bc0e753b88
children 3e6da6f6a226
files examples/dynamic/Makefile.am examples/dynamic/main.c
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/examples/dynamic/Makefile.am	Wed Dec 17 21:18:07 2008 +0800
+++ b/examples/dynamic/Makefile.am	Wed Dec 17 21:18:44 2008 +0800
@@ -10,6 +10,7 @@
 dynamic_LDADD = $(top_builddir)/src/libmbfly.la
 BUILT_SOURCES = menu.c menu.h menu.mb button.c button.h button.mb
 CLEANFILES = menu.c menu.h menu.mb button.c button.h button.mb
+INCLUDES= @cairo_CFLAGS@ -I$(top_srcdir)
 
 menu.mb: $(srcdir)/menu.svg
 	$(top_srcdir)/tools/svg2code.py $? $@
@@ -20,6 +21,9 @@
 menu.c: menu.mb
 	m4 -I $(top_srcdir)/tools mb_c_source.m4 $< > $@
 
+button.so: button.o
+	gcc -shared -o button.so button.o
+
 button.mb: $(srcdir)/button.svg
 	$(top_srcdir)/tools/svg2code.py $? $@
 
--- a/examples/dynamic/main.c	Wed Dec 17 21:18:07 2008 +0800
+++ b/examples/dynamic/main.c	Wed Dec 17 21:18:44 2008 +0800
@@ -16,7 +16,7 @@
     X_MB_runtime_t *rt;
     redraw_man_t *rdman;
     menu_t *menu;
-    button_t *button;
+    mb_sprite_t *button;
     int state;
     co_aix orx,ory;
     int start_x,start_y;
@@ -106,7 +106,7 @@
     }
     COORD_SHOW(btn->click);
     COORD_HIDE(btn->active);
-    rdman_coord_changed(en->rdman,en->button->root_coord);
+    rdman_coord_changed(en->rdman,btn->root);
     rdman_redraw_changed(en->rdman);
 
     btn->progm = progm = mb_progm_new(1, en->rdman);
@@ -278,7 +278,7 @@
 
     en = engine_init();
     en->menu = menu_new(en->rdman, en->rdman->root_coord);
-    en->button = button_new(en->rdman, en->rdman->root_coord);
+    en->button = sprite_load("button",en->rdman, en->rdman->root_coord);
     b = mb_button_new(en, (mb_sprite_t *) en->button, "btn");
     mb_button_add_onClick(b, test,NULL);