gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] gnash/server sprite_instance.cpp


From: strk
Subject: Re: [Gnash-commit] gnash/server sprite_instance.cpp
Date: Fri, 22 Sep 2006 18:55:13 +0200

Vitaly, wouldn't an *empty* MovieClip just be a sprite 
rather then a full movie ?
So far I've understood that we're using movie_def_impl for
*full* movies, and not for sprite. What about moving the
*empty* movieclip thing into sprite_definition instead ?
a sprite_definition still inherits from movie_definition
if that is the problem.

--strk;

On Thu, Sep 21, 2006 at 04:03:30PM +0000, Vitaly Alexeev wrote:
> CVSROOT:      /sources/gnash
> Module name:  gnash
> Changes by:   Vitaly Alexeev <alexeev>        06/09/21 16:03:30
> 
> Modified files:
>       server         : sprite_instance.cpp 
> 
> Log message:
>       added remove_movieclip() & create_empty_movieclip()
> 
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.56&r2=1.57
> 
> Patches:
> Index: sprite_instance.cpp
> ===================================================================
> RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
> retrieving revision 1.56
> retrieving revision 1.57
> diff -u -b -r1.56 -r1.57
> --- sprite_instance.cpp       21 Sep 2006 13:54:45 -0000      1.56
> +++ sprite_instance.cpp       21 Sep 2006 16:03:30 -0000      1.57
> @@ -115,6 +115,25 @@
>       sprite->set_play_state(movie_interface::STOP);
>  }
>  
> +//removeMovieClip() : Void
> +static void sprite_remove_movieclip(const fn_call& fn)
> +{
> +     assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
> +     sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
> +     if (sprite == NULL)
> +     {
> +         sprite = dynamic_cast<sprite_instance*>(fn.env->get_target());
> +     }
> +
> +     assert(sprite);
> +
> +     sprite_instance* parent = (sprite_instance*) sprite->get_parent();
> +     if (parent)
> +     {
> +             parent->remove_display_object(sprite->get_depth(), 0);
> +     }
> +}
> +
>  //createEmptyMovieClip(name:String, depth:Number) : MovieClip
>  static void sprite_create_empty_movieclip(const fn_call& fn)
>  {
> @@ -665,6 +684,7 @@
>       as_builtins.set_member("swapDepths", &sprite_swap_depths);
>       as_builtins.set_member("getDepth", &sprite_get_depth);
>       as_builtins.set_member("createEmptyMovieClip", 
> &sprite_create_empty_movieclip);
> +     as_builtins.set_member("removeMovieClip", &sprite_remove_movieclip);
>  
>       // @TODO
>       //as_builtins.set_member("startDrag", &sprite_start_drag);
> @@ -1033,27 +1053,26 @@
>       assert(m_action_list.size() == top_action);
>  }
>  
> -// TODO
> -character* sprite_instance::add_empty_movieclip(const char* /*name*/, int 
> /*depth*/)
> +character* sprite_instance::add_empty_movieclip(const char* name, int depth)
>  {
> -//   cxform color_transform;
> -//   matrix matrix;
> +     cxform color_transform;
> +     matrix matrix;
>  
> -//   movie_definition* mdef =        new movie_def_impl(DO_LOAD_BITMAPS, 
> DO_LOAD_FONT_SHAPES);
> -//   sprite_instance* sprite =       new sprite_instance(m_def.get_ptr(), 
> m_root, this, 0);
> -//   m_display_list.remove_display_object(depth);
> -//   m_display_list.place_character(
> -//           sprite,
> -//           depth,
> -//           color_transform,
> -//           matrix,
> -//           0.0f,
> -//           0);
> +     // empty_mdef will be deleted during deliting sprite
> +     movie_def_impl* empty_mdef = new movie_def_impl(DO_EMPTY_MOVIECLIP, 
> DO_LOAD_FONT_SHAPES);
>  
> -//   return sprite;
> -     log_warning("add_empty_movieclip unimplemented");
> +     sprite_instance* sprite =       new sprite_instance(empty_mdef, m_root, 
> this, 0);
> +     sprite->set_name(name);
>  
> -     return NULL;
> +     m_display_list.place_character(
> +             sprite,
> +             depth,
> +             color_transform,
> +             matrix,
> +             0.0f,
> +             0);
> +
> +     return sprite;
>  }
>  
>  void sprite_instance::clone_display_object(const tu_string& name,
> 
> 
> _______________________________________________
> Gnash-commit mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnash-commit

-- 

 /"\    ASCII Ribbon Campaign
 \ /    Respect for low technology.
  X     Keep e-mail messages readable by any computer system.
 / \    Keep it ASCII. 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]