예제 #1
0
파일: Sprite.cpp 프로젝트: dujodujo/ape
void Sprite::set_current_animation(const std::string& animation_name) {
	if(this->current_animation_name != animation_name) {
		SpriteAnimation* animation = current_animation_set.get_current_animation(animation_name);
		this->current_animation = animation;
		this->current_animation_name = animation_name;
		set_frame_delay(current_animation->get_frame_delay());
		set_current_frame(0);
	}
}
예제 #2
0
파일: Sprite.cpp 프로젝트: Arvek/SOLARME
/**
 * \brief Sets the current animation of the sprite.
 *
 * If the sprite is already playing another animation, this animation is interrupted.
 * If the sprite is already playing the same animation, nothing is done.
 *
 * \param animation_name name of the new animation of the sprite
 */
void Sprite::set_current_animation(const std::string& animation_name) {

  if (animation_name != this->current_animation_name || !is_animation_started()) {

    this->current_animation_name = animation_name;
    this->current_animation = animation_set.get_animation(animation_name);
    set_frame_delay(current_animation->get_frame_delay());

    set_current_frame(0, false);

    if (lua_context != NULL) {
      lua_context->sprite_on_animation_changed(*this, current_animation_name);
      lua_context->sprite_on_frame_changed(*this, current_animation_name, 0);
    }
  }
}
예제 #3
0
파일: Sprite.cpp 프로젝트: Arvek/SOLARME
/**
 * \brief Sets the current direction of the sprite's animation and restarts the animation.
 *
 * If the specified direction is the current direction, nothing is done.
 *
 * \param current_direction the current direction
 */
void Sprite::set_current_direction(int current_direction) {

  if (current_direction != this->current_direction) {

    Debug::check_assertion(current_direction >= 0
        && current_direction < get_nb_directions(),
        StringConcat() << "Invalid direction " << current_direction
        << " for sprite '" << get_animation_set_id()
        << "' in animation '" << current_animation_name << "'");

    this->current_direction = current_direction;

    set_current_frame(0, false);

    if (lua_context != NULL) {
      lua_context->sprite_on_direction_changed(*this, current_animation_name, current_direction);
      lua_context->sprite_on_frame_changed(*this, current_animation_name, 0);
    }
  }
}
예제 #4
0
파일: m68k-tdep.c 프로젝트: npe9/sprite
void
m68k_pop_frame ()
{
  register FRAME frame = get_current_frame ();
  register CORE_ADDR fp;
  register int regnum;
  struct frame_saved_regs fsr;
  struct frame_info *fi;
  char raw_buffer[12];

  fi = get_frame_info (frame);
  fp = fi -> frame;
  get_frame_saved_regs (fi, &fsr);
#if defined (HAVE_68881)
  for (regnum = FP0_REGNUM + 7 ; regnum >= FP0_REGNUM ; regnum--)
    {
      if (fsr.regs[regnum])
	{
	  read_memory (fsr.regs[regnum], raw_buffer, 12);
	  write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12);
	}
    }
#endif
  for (regnum = FP_REGNUM - 1 ; regnum >= 0 ; regnum--)
    {
      if (fsr.regs[regnum])
	{
	  write_register (regnum, read_memory_integer (fsr.regs[regnum], 4));
	}
    }
  if (fsr.regs[PS_REGNUM])
    {
      write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4));
    }
  write_register (FP_REGNUM, read_memory_integer (fp, 4));
  write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
  write_register (SP_REGNUM, fp + 8);
  flush_cached_frames ();
  set_current_frame (create_new_frame (read_register (FP_REGNUM),
				       read_pc ()));
}
예제 #5
0
파일: Sprite.cpp 프로젝트: dujodujo/ape
void Sprite::set_current_direction(int direction) {
	if(this->current_animation_direction != direction) {
		this->current_animation_direction = direction;
		set_current_frame(0);
	}
}
예제 #6
0
파일: Sprite.cpp 프로젝트: dujodujo/ape
void Sprite::restart_animation() {
	set_current_frame(0);
}
예제 #7
0
파일: Sprite.cpp 프로젝트: Arvek/SOLARME
/**
 * \brief Restarts the animation.
 */
void Sprite::restart_animation() {
  set_current_frame(0);
  set_paused(false);
}