Пример #1
0
// Constructor
CardGui::CardGui() {

    // Create pixbufs for all image files and store them in a 2D array
    for (int i = 0; i < SUIT_COUNT; i++) {
        for (int j = 0; j < RANK_COUNT; j++) {
            std::string filename = convertToFilename(i, j);
            imgArray_[i][j] = createPixbuf(filename);
        }
    }

    // Separate pixbuf for an empty card
    std::string emptyCardName = IMG_FOLDER + EMPTY_CARD_IMG + EXTENSION;
    emptyCardImg_ = createPixbuf(emptyCardName);
}
Пример #2
0
// initiate player's window
int initializeWindow(GtkWidget **window, int player) {
    // if not valid player, raise error
    if (player != 1 && player != 2) {
        printf("Error, invalid player number window opened\n");
        return 0;
    }

    // initialize window
    *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    // set title
    char buf[50];
    sprintf(buf, "megasenha - player %d", player);
    gtk_window_set_title(GTK_WINDOW(*window), buf);

    // set size and position and connects close window with destroy function
    gtk_window_set_default_size(GTK_WINDOW(*window), 597, 177);
    gtk_container_set_border_width (GTK_CONTAINER (*window), 10);
    if(player == 1) {
        gtk_window_move(GTK_WINDOW(*window), gdk_screen_width()*1/10, gdk_screen_height()/2 - 150);
        gtk_signal_connect (GTK_OBJECT(*window), "destroy", GTK_SIGNAL_FUNC (destroy), (gpointer) "1");
    } else {
        gtk_window_move(GTK_WINDOW(*window), gdk_screen_width()*9/10 - 500, gdk_screen_height()/2 - 150);
        gtk_signal_connect (GTK_OBJECT(*window), "destroy", GTK_SIGNAL_FUNC (destroy), (gpointer) "2");
    }

    // sets and creates icons for windows and tell windows manager not to put them together
    sprintf(buf, "p%d.png", player);
    gtk_window_set_icon(GTK_WINDOW(*window), createPixbuf(buf));
    sprintf(buf, "player %d", player);
    gtk_window_set_wmclass(GTK_WINDOW (*window), buf, "megasenha"); 

    return 1;
}
Пример #3
0
// initiate get name window
int initializeGetNameWindow(GtkWidget **window) {
    // initialize window
    *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    // set title
    char buf[50];
    sprintf(buf, "megasenha - type your name");
    gtk_window_set_title(GTK_WINDOW(*window), buf);

    // set size and position and connects close window with destroy function
    gtk_window_set_default_size(GTK_WINDOW(*window), 397, 107);
    gtk_container_set_border_width (GTK_CONTAINER (*window), 10);
    gtk_window_move(GTK_WINDOW(*window), gdk_screen_width()/2 - 397/2, gdk_screen_height()*9/20);
//    gtk_signal_connect (GTK_OBJECT(*window), "destroy", GTK_SIGNAL_FUNC (destroy), (gpointer) "1");

    // sets and creates icons for windows and tell windows manager not to put them together
    gtk_window_set_icon(GTK_WINDOW(*window), createPixbuf("info.jpg"));
    gtk_window_set_wmclass(GTK_WINDOW (*window), "infoWindow", "megasenha"); 

    gtk_widget_show_all(*window);

    return 1;
}
Пример #4
0
AlbumBank::AlbumBank() {
	for (int i = 0; i < image_filenames.size(); i++) {
		album_images.push_back(createPixbuf(image_filenames[i]));
	}
}