void Tournament::add_pick_object(GPickObject *po) { for (GameObjects::iterator it = game_objects.begin(); it != game_objects.end(); it++) { GameObject *obj = *it; if (obj->state.id == po->id) { obj->picked = true; obj->delete_me = obj->object->is_spawnable(); const std::string& pickup_animation = obj->object->get_value("pickup_animation"); if (pickup_animation.length()) { TileGraphic *tg = obj->object->get_tile()->get_tilegraphic(); add_animation(pickup_animation, 0, 0, 0, static_cast<int>(obj->state.x), static_cast<int>(obj->state.y), 0.0f, 0.0f, tg->get_width(), tg->get_height()); } if (!server) { const std::string& pickup_sound = obj->object->get_value("pickup_sound"); if (pickup_sound.length()) { Sound *sound = resources.get_sound(pickup_sound); subsystem.play_sound(sound, 0); } } break; } } /* delete marked objects */ game_objects.erase(std::remove_if(game_objects.begin(), game_objects.end(), erase_element<GameObject>), game_objects.end()); }
void Tournament::spawn_object(Object *obj, identifier_t id, int x, int y, flags_t flags) { GameObject *nobj = new GameObject; nobj->object = obj; nobj->origin_x = x; nobj->origin_y = y; nobj->state.id = id; nobj->state.accel_x = 0.0f; nobj->state.accel_y = 0.0f; nobj->state.x = static_cast<double>(x); nobj->state.y = static_cast<double>(y); nobj->spawned_object = true; game_objects.push_back(nobj); if (!server) { if (flags & PlaceObjectWithAnimation) { const std::string& spawn_animation = obj->get_value("spawn_animation"); if (spawn_animation.length()) { TileGraphic *tg = obj->get_tile()->get_tilegraphic(); add_animation(spawn_animation, 0, 0, 0, x, y, 0.0f, 0.0f, tg->get_width(), tg->get_height()); } } if (flags & PlaceObjectWithSpawnSound) { const std::string& sound_name = obj->get_value("spawn_sound"); if (sound_name.length()) { Sound *sound = resources.get_sound(sound_name); subsystem.play_sound(sound, 0); } } } }
/* adds a progress bar */ void clearlooks_animation_progressbar_add (GtkWidget *progressbar) { gdouble fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progressbar)); if (fraction < 1.0 && fraction > 0.0) add_animation ((GtkWidget*) progressbar, 0.0); }
XFormNode::XFormNode(const std::string &name) { curr_anim = 0; this->name = name; parent = NULL; anim_start_time = 0; add_animation(new Animation); node_type = NODE_NULL; }
/* adds a progress bar */ void aurora_animation_progressbar_add (GtkWidget *progressbar) { gdouble fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progressbar)); if (fraction < 1.0 && fraction > 0.0) { add_animation ((GtkWidget*) progressbar, 0.0, GTK_STATE_NORMAL, PROGRESSBAR_DELAY); } }
void kill_window(Window* window) { printk("kill_window called on %x\n", window); //fade out window float to = 0.0; ca_animation* fade_out = create_animation(ALPHA_ANIM, &to, 0.25); printk("fade out animation: %x\n", fade_out); //when animation finishes, perform real teardown fade_out->finished_handler = (event_handler)kill_window_real; add_animation(window, fade_out); }
void role::initial_ui(){ Animation* _animation = new Animation(); //the first _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_UP_1)); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_UP_2)); _animation->set_fps(5); add_animation(ROLE_ANIMATION_UP , _animation); _animation = NULL; _animation = new Animation(); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_DOWN_1)); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_DOWN_2)); _animation->set_fps(5); add_animation(ROLE_ANIMATION_DOWN , _animation); _animation = NULL; _animation = new Animation(); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_LEFT_1)); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_LEFT_2)); _animation->set_fps(5); add_animation(ROLE_ANIMATION_LEFT , _animation); _animation = NULL; _animation = new Animation(); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_RIGHT_1)); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_MOVE_RIGHT_2)); _animation->set_fps(5); add_animation(ROLE_ANIMATION_RIGHT , _animation); _animation = NULL; _animation = new Animation(); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_STATIC_UP)); add_animation(ROLE_ANIMATION_UP_STATIC , _animation); _animation = NULL; _animation = new Animation(); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_STATIC_DOWN)); add_animation(ROLE_ANIMATION_DOWN_STATIC , _animation); _animation = NULL; _animation = new Animation(); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_STATIC_LEFT)); add_animation(ROLE_ANIMATION_LEFT_STATIC , _animation); _animation = NULL; _animation = new Animation(); _animation->add_frame(Config::get_instance()->get_texture(Config::ROLE_STATIC_RIGHT)); add_animation(ROLE_ANIMATION_RIGHT_STATIC , _animation); _animation = NULL; //initial the state m_an_state = ROLE_ANIMATION_UP_STATIC; }
bool AnimationPlayer::_set(const StringName& p_name, const Variant& p_value) { String name=p_name; if (p_name==SceneStringNames::get_singleton()->playback_speed || p_name==SceneStringNames::get_singleton()->speed) { //bw compatibility set_speed(p_value); } else if (p_name==SceneStringNames::get_singleton()->playback_active) { set_active(p_value); } else if (name.begins_with("playback/play")) { String which=p_value; if (which=="[stop]") stop(); else play(which); } else if (name.begins_with("anims/")) { String which=name.get_slicec('/',1); add_animation(which,p_value); } else if (name.begins_with("next/")) { String which=name.get_slicec('/',1); animation_set_next(which,p_value); } else if (p_name==SceneStringNames::get_singleton()->blend_times) { Array array=p_value; int len = array.size(); ERR_FAIL_COND_V(len%3,false); for(int i=0;i<len/3;i++) { StringName from = array[i*3+0]; StringName to = array[i*3+1]; float time = array[i*3+2]; set_blend_time(from,to,time); } } else if (p_name==SceneStringNames::get_singleton()->autoplay) { autoplay=p_value; } else return false; return true; }
void present_window(Window* window) { float old_alpha = window->layer->alpha; window->layer->alpha = 0.0; Screen* current = gfx_screen(); add_subwindow(current->window, window); float to = old_alpha; ca_animation* fade_in = create_animation(ALPHA_ANIM, &to, 0.25); add_animation(window, fade_in); }
XFormNode::XFormNode() { curr_anim = 0; name = ""; parent = NULL; anim_start_time = 0; Animation *anim = new Animation; anim->set_name("default"); add_animation(anim); node_type = NODE_NULL; }
void Tournament::add_player_spawn_animation(Player *p) { const std::string& spawn_animation = p->get_characterset()->get_value("spawn_animation"); if (spawn_animation.length()) { Animation *ani = resources.get_animation(spawn_animation); TileGraphic *tg = ani->get_tile()->get_tilegraphic(); int x = static_cast<int>(p->state.client_server_state.x); int y = static_cast<int>(p->state.client_server_state.y) - p->get_characterset()->get_height(); add_animation(spawn_animation, 0, 0, 0, x, y, 0.0f, 0.0f, tg->get_width(), tg->get_height()); subsystem.play_sound(resources.get_sound("respawn"), 0); } }
void Tournament::add_place_object(GPlaceObject *po) { for (GameObjects::iterator it = game_objects.begin(); it != game_objects.end(); it++) { GameObject *obj = *it; if (obj->state.id == po->id) { obj->picked = false; obj->state.x = po->x; obj->state.y = po->y; if (po->flags & PlaceObjectWithAnimation) { const std::string& spawn_animation = obj->object->get_value("spawn_animation"); if (spawn_animation.length()) { TileGraphic *tg = obj->object->get_tile()->get_tilegraphic(); add_animation(spawn_animation, 0, 0, 0, static_cast<int>(obj->state.x), static_cast<int>(obj->state.y), 0.0f, 0.0f, tg->get_width(), tg->get_height()); } } if (po->flags & PlaceObjectResetVelocity) { obj->state.accel_x = 0; obj->state.accel_y = 0; } if (!server) { if (po->flags & PlaceObjectWithSpawnSound) { const std::string& sound_name = obj->object->get_value("spawn_sound"); if (sound_name.length()) { Sound *sound = resources.get_sound(sound_name); subsystem.play_sound(sound, 0); } } if (po->flags & PlaceObjectWithScoredSound) { const std::string& sound_name = obj->object->get_value("score_sound"); if (sound_name.length()) { Sound *sound = resources.get_sound(sound_name); subsystem.play_sound(sound, 0); } } if (po->flags & PlaceObjectWithDropSound) { const std::string& sound_name = obj->object->get_value("drop_sound"); if (sound_name.length()) { Sound *sound = resources.get_sound(sound_name); subsystem.play_sound(sound, 0); } } } break; } } }
static void on_checkbox_toggle (GtkWidget *widget, gpointer data) { AnimationInfo *animation_info = lookup_animation_info (widget); if (animation_info != NULL) { gfloat elapsed = g_timer_elapsed (animation_info->timer, NULL); animation_info->start_modifier = elapsed - animation_info->start_modifier; } else { add_animation (widget, CHECK_ANIMATION_TIME); } }
static void on_button_toggle (GtkWidget *widget, GtkStateType prev_state, gpointer data) { AnimationInfo *animation_info = lookup_animation_info (widget); if (animation_info != NULL) { gfloat elapsed = g_timer_elapsed (animation_info->timer, NULL); animation_info->start_modifier = elapsed - animation_info->start_modifier; animation_info->starting_state_type = prev_state; } else { add_animation (widget, ANIMATION_TRANS_TIME, prev_state, 0); } }
/** * \brief Attempts to load this animation set from its file. */ void SpriteAnimationSet::load() { Debug::check_assertion(animations.empty(), "Animation set already loaded"); // Load the sprite data file. std::string file_name = std::string("sprites/") + id + ".dat"; SpriteData data; bool success = data.import_from_quest_file(file_name); if (success) { // Get the imported data. default_animation_name = data.get_default_animation_name(); for (const auto& kvp : data.get_animations()) { add_animation(kvp.first, kvp.second); } } }
SpriteFrames::SpriteFrames() { add_animation(SceneStringNames::get_singleton()->_default); }
void SpriteFrames::clear_all() { animations.clear(); add_animation("default"); }
void add_animation_stats (const shared_str &animation_id, const shared_str &animation_set_id, const shared_str &visual_id, const std::pair<LPCSTR,LPCSTR> *blend_id, bool just_started) { add_animation (animation_id,animation_set_id,visual_id,just_started); add_blend (animation_id,animation_set_id,visual_id,blend_id); }