static void
stop_fullscreen (RBVisualizerPage *page)
{
    if (page->fullscreen != NULL) {
        ClutterActor *stage;

        rb_debug ("stopping fullscreen display");

        g_object_ref (page->texture);
        stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (page->fullscreen_embed));
        rb_visualizer_fullscreen_stop (stage);
        clutter_container_remove_actor (CLUTTER_CONTAINER (stage), page->texture);

        stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (page->embed));
        clutter_container_add (CLUTTER_CONTAINER (stage), page->texture, NULL);

        g_object_unref (page->texture);

        gtk_widget_destroy (GTK_WIDGET (page->fullscreen));
        page->fullscreen = NULL;

        page->fullscreen_embed = NULL;
    }

    set_action_state (page, FALSE);
}
Exemplo n.º 2
0
/* Gets player bet if player still playing
 * TODO change in de2 env
 */
unsigned int get_bet_for_player(int pid) {

  unsigned int m_input;

  printf("\n\n----------------------------------------");
  printf("\nYour total money %d and bet money %d", dealer->players[pid].total_money, dealer->players[pid].money);
  printf("\nPlayer %d\n Enter your action (0 - Fold, 1 - Call, 2 - Raise): ", pid);

  set_action_state(pid);
  send_message();

  receive_message();
  m_input = read_player_action_and_value(pid);

  if (dealer->players[pid].action == CALL) {
	  if ((dealer->players[pid].total_money - (dealer->current_bet - dealer->players[pid].money)) > 0) {
		dealer->players[pid].total_money -= (dealer->current_bet - dealer->players[pid].money);
		dealer->players[pid].money += (dealer->current_bet - dealer->players[pid].money);
		sprintf(dealer->players[pid].message, "CALL %d", dealer->players[pid].money);
	  } else {
		dealer->players[pid].money += dealer->players[pid].total_money;
		sprintf(dealer->players[pid].message, "ALL IN", dealer->players[pid].total_money);
		dealer->players[pid].total_money = 0;
	  }
  }

  if (dealer->players[pid].action == RAISE) {
    dealer->current_bet += m_input;
    dealer->players[pid].total_money -= (dealer->current_bet - dealer->players[pid].money);
    dealer->players[pid].money += (dealer->current_bet - dealer->players[pid].money);


    if (dealer->players[pid].total_money == 0)
		sprintf(dealer->players[pid].message, "ALL IN", m_input, dealer->players[pid].money);
    else
    	sprintf(dealer->players[pid].message, "RAISE %d (BET %d)", m_input, dealer->players[pid].money);
  }

  if (dealer->players[pid].action == FOLD && dealer->current_bet > 0) {
	dealer->players[pid].active = false;
	dealer->number_active_players--;
  }
  printf("\nYour total money %d and bet money %d", dealer->players[pid].total_money, dealer->players[pid].money);

  return 0;
}
static void
start_fullscreen (RBVisualizerPage *page)
{
    if (page->fullscreen == NULL) {
        ClutterActor *stage;
        GtkWindow *main_window;
        RBShell *shell;
        int x, y;

        rb_debug ("starting fullscreen display");
        g_object_get (page, "shell", &shell, NULL);
        g_object_get (shell, "window", &main_window, NULL);

        page->fullscreen = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_window_set_skip_taskbar_hint (GTK_WINDOW (page->fullscreen), TRUE);

        /* move the texture from the page embed to the new fullscreen embed */

        g_object_ref (page->texture);

        stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (page->embed));
        clutter_container_remove_actor (CLUTTER_CONTAINER (stage), page->texture);

        page->fullscreen_embed = create_embed (page);
        stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (page->fullscreen_embed));
        clutter_container_add (CLUTTER_CONTAINER (stage), page->texture, NULL);
        g_object_unref (page->texture);

        gtk_container_add (GTK_CONTAINER (page->fullscreen), page->fullscreen_embed);
        gtk_widget_show_all (GTK_WIDGET (page->fullscreen));

        gtk_window_get_position (main_window, &x, &y);
        gtk_window_move (GTK_WINDOW (page->fullscreen), x, y);

        gtk_window_fullscreen (GTK_WINDOW (page->fullscreen));
        gtk_window_set_transient_for (GTK_WINDOW (page->fullscreen), main_window);
        g_object_unref (main_window);

        rb_visualizer_fullscreen_add_widgets (page->fullscreen, stage, shell);
        g_object_unref (shell);
    }

    set_action_state (page, TRUE);
}
Exemplo n.º 4
0
gboolean initialize_gui_2(void)
{
        gtk_window_set_default_icon_name("xchat-gnome");

        gui.current_session = NULL;
        gui.tree_model = navigation_model_new();
        gui.server_tree = navigation_tree_new(gui.tree_model);
        pixmaps_init();
        initialize_userlist();
        initialize_main_window();

        gtk_container_add(GTK_CONTAINER(
                              GTK_WIDGET(gtk_builder_get_object(gui.xml, "server channel list"))),
                          GTK_WIDGET(gui.server_tree));

        gui.dcc = dcc_window_new();

        gui.initialized = TRUE;

        set_action_state(gui.server_tree);

        return TRUE;
}