00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __mcl_gtk__
00011 #define __mcl_gtk__
00012
00013 #include <gtk/gtk.h>
00014
00015 #define SCENE_REFRESH 500
00016 #define BORDER 15
00017 #define FWIDTH 3000
00018 #define FHEIGHT 2100
00019
00020 struct prog_opt option;
00021 FILE *file_out, *file_err;
00022 int argc;
00023 char **argv;
00024
00025
00026
00027
00028 struct prog_opt {
00029 unsigned int opt_flag;
00030
00031 #define OPT_GTK_TEST 0x1000
00032 #define OPT_TEXT_MODE 0x2000
00033 };
00034
00035
00036 pthread_mutex_t mcl_mutex;
00037
00038
00039 GtkWidget *window;
00040 GtkWidget *drawing_area;
00041
00042
00043 static GdkPixmap *xpm_scene = NULL;
00044
00045
00046 struct pixmap_obj {
00047 char *xpm_filename;
00048 GdkPixmap *pixmap;
00049 GdkBitmap *mask;
00050 unsigned int seq_count;
00051 unsigned int width;
00052 unsigned int height;
00053 };
00054
00055
00056 struct moveable_obj {
00057 int type;
00058 int x;
00059 int y;
00060 unsigned int width;
00061 unsigned int height;
00062 unsigned int seq;
00063 unsigned int seq_count;
00064 };
00065
00066
00067 struct pixmap_obj xpm_background[] = {
00068 { "images/background.xpm", NULL, NULL, 0, 632, 452},
00069 { NULL, NULL, NULL, 0, 0, 0 }
00070 };
00071
00072
00073 struct pixmap_obj xpm_robot[] = {
00074 { "images/robot.xpm", NULL, NULL, 0, 19, 19 },
00075 { NULL, NULL, NULL, 0, 0, 0 }
00076 };
00077
00078
00079 struct pixmap_obj xpm_sample[] = {
00080 { "images/point3x3r.xpm", NULL, NULL, 0, 3, 3 },
00081 { "images/point3x3b.xpm", NULL, NULL, 0, 3, 3 },
00082 { "images/point3x3c.xpm", NULL, NULL, 0, 3, 3 },
00083 { "images/point3x3y.xpm", NULL, NULL, 0, 3, 3 },
00084 { "images/point3x3g.xpm", NULL, NULL, 0, 3, 3 },
00085 { NULL, NULL, NULL, 0, 0, 0 }
00086 };
00087
00088 struct moveable_obj *moveable;
00089
00093
00094 void quit ();
00095 void get_size (GdkPixmap *xpm, unsigned int *width, unsigned int *height);
00096 void load_pixmaps (GtkWidget *widget, struct moveable_obj *moveable,
00097 struct pixmap_obj *pixmaps);
00098 void load_scene_pixmap(GtkWidget *widget);
00099 static gint configure_event (GtkWidget *widget, GdkEventConfigure *event);
00100 gint expose_event (GtkWidget *widget, GdkEventExpose *event);
00101 gint repaint (gpointer data);
00102 void test_repaint();
00103 void test_animation(int argc, char *argv[]);
00104 void init_animation(int argc, char *argv[], void (*repaint_func)());
00105 void scene_repaint();
00106
00110 void print_usage();
00111
00118 int parseopt(int argc, char **argv);
00119
00123 #define DEBUG
00124 #ifdef DEBUG
00125 #define PROG_NAME "mcl_gtk"
00126 #define DBG(f, a...) printf(f, ## a)
00127 #define DBGPROG(f, a...) printf(PROG_NAME ": " f, ## a)
00128 #else
00129 #define DBG(f, a...) do { } while(0);
00130 #define DBGPROG(f, a...) do { } while(0);
00131 #endif
00132
00133 #endif