Beispiel #1
0
static gint
item_event(GooCanvasItem *item, GdkEvent *event,  MenuItems *menuitems)
{
    GcomprisBoard *board;

    if(board_paused)
        return FALSE;

    if(boardRootItem    == NULL)
        return FALSE;

    board = g_object_get_data (G_OBJECT (item), "board");

    if(!menu_displayed)
        return TRUE;


    if (strcmp(board->type,"menu")==0)
    {
        gchar *path = g_strdup_printf("%s/%s",board->section, board->name);

        gc_sound_play_ogg ("sounds/bleep.wav", NULL);
        display_section(path);

        if (menu_position)
            g_free(menu_position);

        menu_position = path;

    }
    else if ( ! gc_board_is_demo_only(board) )
    {
        gc_sound_play_ogg ("sounds/level.wav", NULL);
        gc_board_run_next (board);
    }

    return TRUE;
}
Beispiel #2
0
/**
 * Command entry point.
 */
int main(int argc, char **argv) {
	const char *path;
	gel_file_t *file;
	int opt, i = 0;
	const char *find = 0;
	
	/* Check arguments */
	opterr = 1;
	while((opt = getopt(argc, argv, "hf:")) != EOF)
		switch(opt) {
		case 'h':
			help();
		case 'f':
			find = optarg;
			break;
		default:
			assert(0);
		}
	if(optind >= argc) {
		fprintf(stderr, "ERROR: a binary file is required !\n");
		help();
	}
	path = argv[optind];
	
	/* open the file */
	file = gel_open(path, "", 0);
	if(file == NULL) {
    	printf("ERROR: %s\n", gel_strerror());
    	return 2;
  	}

	/* find the section if required */
	if(find) {

		/* convert address */
		uint32_t addr;
		addr = strtoul(find, 0, 16);

		/* perform the search */
		for(i = 0; i < file->sectnum; i++) {

			/* get the section information */
			gel_sect_info_t info;
			gel_sect_t *sect = gel_getsectbyidx(file, i);
			assert(sect);
			if(gel_sect_infos(sect, &info) < 0) {
				fprintf(stderr, "ERROR: %s\n", gel_strerror());
				return 3;
			}

			/* found ? */
			if(addr >= info.vaddr && addr < info.vaddr + info.size) {
				printf("address %08x found in section \"%s\"\n", addr, info.name);
				display_section(i, &info);
				return 0;
			}

		}
		fprintf(stderr, "ERROR: no section containing address %08x\n", addr);
		return 1;
	}

	/* list sections */
	printf("INDEX TYPE         FLAGS VADDR    SIZE     OFFSET   NAME\n");
	for(i = 0; i < file->sectnum; i++) {
		
		/* get information */
		gel_sect_info_t info;
		gel_sect_t *sect = gel_getsectbyidx(file, i);
		assert(sect);
		if(gel_sect_infos(sect, &info) < 0) {
			fprintf(stderr, "ERROR: %s\n", gel_strerror());
			return 3;
		}
		
		/* display information */
		display_section(i, &info);
	}

	/* cleanup */ 
	gel_close(file);
	return 0;
}
Beispiel #3
0
static void menu_start (GcomprisBoard *agcomprisBoard)
{

    current_x = 0.0;
    current_y = 0.0;

    /* initialisations */
    /* in case we will make this parametrable */

    panel_x = P_X;
    panel_y = P_Y;
    panel_w = P_W;
    panel_h = P_H;

    top_x = T_X;
    top_y = T_Y;
    top_w = T_W;
    top_h = T_H;
    top_int_x = T_INT_X;
    top_arrow_size = T_ARROW_SIZE;

    display_x = D_X;
    display_y = D_Y;
    display_w = D_W;
    display_h = D_H;
    display_int_x = D_INT_X;
    display_int_y = D_INT_Y;

    info_x = I_X;
    info_y = I_Y;
    info_w = I_W;
    info_h = I_H;

    icon_size = ICON_SIZE;
    icon_size_panel = ICON_SIZE_PANEL;
    icon_size_top = ICON_SIZE_TOP;

    if(agcomprisBoard != NULL)
    {
        RsvgHandle *svg_handle;

        gcomprisBoard=agcomprisBoard;

        /* set initial values for this level */
        gcomprisBoard->level = 1;
        gcomprisBoard->maxlevel=1;

        /* Set back the bar to it's original location */
        gc_bar_set(GC_BAR_CONFIG|GC_BAR_ABOUT|GC_BAR_JOURNAL|GC_BAR_SHARE);

        menuitems = g_new(MenuItems, 1);

        svg_handle = gc_skin_rsvg_get();

        gc_set_background_by_id (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                 svg_handle,
                                 "#BACKGROUND");

        boardRootItem = \
                        goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                              NULL);

        g_object_set_data_full(G_OBJECT (boardRootItem),
                               "menuitems", menuitems, g_free);

        goo_canvas_svg_new (boardRootItem,
                            svg_handle,
                            "svg-id", "#SELECTOR",
                            "pointer-events", GOO_CANVAS_EVENTS_NONE,
                            NULL);

        goo_canvas_svg_new (boardRootItem,
                            svg_handle,
                            "svg-id", "#BUTTON_HORIZONTAL",
                            "pointer-events", GOO_CANVAS_EVENTS_NONE,
                            NULL);

        create_info_area(boardRootItem, menuitems);

        create_panel(boardRootItem);

        if (menu_position)
            display_section(menu_position);
        else
            display_welcome(menuitems);

        {
            if ( strcmp(gc_prop_get()->profile->name, GC_PROFILE_DEFAULT) != 0 )
            {
                gchar *text = g_strdup_printf(_("Profile: %s"),
                                              gc_prop_get()->profile->name);
                goo_canvas_text_new (boardRootItem,
                                     text,
                                     BOARDWIDTH - 10,
                                     BOARDHEIGHT - 30,
                                     -1,
                                     GTK_ANCHOR_EAST,
                                     "font", gc_skin_font_board_tiny,
                                     "fill-color-rgba", gc_skin_get_color("menu/text"),
                                     "alignment", PANGO_ALIGN_RIGHT,
                                     NULL);
                g_free(text);
            }
        }

        {
            gchar *text = g_strdup_printf(_("Number of activities: %d"),
                                          gc_board_get_number_of_activity());
            goo_canvas_text_new (boardRootItem,
                                 text,
                                 BOARDWIDTH - 10,
                                 BOARDHEIGHT - 10,
                                 -1,
                                 GTK_ANCHOR_EAST,
                                 "font", gc_skin_font_board_tiny,
                                 "fill-color-rgba", gc_skin_get_color("menu/text"),
                                 "alignment", PANGO_ALIGN_RIGHT,
                                 NULL);
            g_free(text);
        }

        menu_pause(FALSE);

    }

}