Пример #1
0
/* Handle a redraw of necessary items, for instance when a Gtk style change is 
   signaled. */
void table_redraw(void)
{
	ggz_debug(DBG_TABLE, "Redrawing table. ");
	if (table_ready) {
		int p;

		/* Complete (zip) any animation in process */
		animation_stop(TRUE);

		/* I really don't know why these are necessary... */
		gtk_widget_grab_focus(dlg_main);
		table_style = gtk_widget_get_style(table);

		/* Redraw everything to the buffer */
		table_clear_table(FALSE);
		draw_card_areas(FALSE);
		table_display_all_hands(FALSE);
		table_show_cards(FALSE);
		for (p = 0; p < ggzcards.num_players; p++)
			table_show_player_box(p, FALSE);

		/* Then draw the whole buffer to the window */
		table_show_table(0, 0, get_table_width(),
				 get_table_height());

		/* There has GOT to be a better way to force the redraw! */
		gdk_window_hide(table_drawing_area->window);
		gdk_window_show(table_drawing_area->window);
	} else {	/* not if (table_ready) */
		if (table_buf)
			draw_splash_screen();
	}
}
Пример #2
0
// Step a GRect animation
static void prv_animation_step_grect(AnimationNode *node) {
  // set from grect on first call, allowing another animation to change the target value
  // while this animation is delayed
  if (!node->from) {
    node->from = MALLOC(sizeof(GRect));
    (*(GRect*)node->from) = (*(GRect*)node->target);
  }
  // step value
  GRect from = (*(GRect*)node->from);
  GRect to = (*(GRect*)node->to);
  uint32_t percent_max = node->duration;
  uint32_t percent = epoch() - (node->start_time + node->delay);
  (*(GRect*)node->target).origin.x = interpolation_integer(from.origin.x, to.origin.x, percent,
    percent_max, node->interpolation);
  (*(GRect*)node->target).origin.y = interpolation_integer(from.origin.y, to.origin.y, percent,
    percent_max, node->interpolation);
  (*(GRect*)node->target).size.w = interpolation_integer(from.size.w, to.size.w, percent,
    percent_max, node->interpolation);
  (*(GRect*)node->target).size.h = interpolation_integer(from.size.h, to.size.h, percent,
    percent_max, node->interpolation);
  // continue animation
  if (percent >= percent_max) {
    animation_stop(node->target);
  }
}
Пример #3
0
// Step a int32 animation
static void prv_animation_step_int32(AnimationNode *node) {
  // set from value on first call, allowing another animation to change the target value
  // while this animation is delayed
  if (!node->from) {
    node->from = MALLOC(sizeof(int32_t));
    (*(int32_t*)node->from) = (*(int32_t*)node->target);
  }
  // step value
  int32_t from = (*(int32_t*)node->from);
  int32_t to = (*(int32_t*)node->to);
  uint32_t percent_max = node->duration;
  uint32_t percent = epoch() - (node->start_time + node->delay);
  (*(int32_t*)node->target) = interpolation_integer(from, to, percent, percent_max,
    node->interpolation);
  // continue animation
  if (percent >= percent_max) {
    animation_stop(node->target);
  }
}
Пример #4
0
void CNpc::setState(int state)
{
    this->m_State = state;

    switch (state){
    case STATE_LIVE:
        log("LIVE");
        animation_move();
        break;
    case STATE_DIE:
        log("DIE");          
        setPlayerSkillConfuse(SkillConfuseState::SKILLSTATE_NONE);
        animation_Die();
        
        break;
    case STATE_FREEZE:
        animation_stop();
        break;
    }
}