1. Reid van Melle
  2. clutter-ocaml

Commits

Reid van Melle  committed 9211b42

Got rid of the stupid from_pixbuf specialized routine

  • Participants
  • Parent commits fcd0461
  • Branches default

Comments (0)

Files changed (6)

File clutter/clutter.ml

View file
  • Ignore whitespace
       
 end;;
 
-module Group = struct
+(*module Group = struct
   external create : unit -> group obj = "ml_clutter_group_new"
-end;;
+end;;*)
 
 module Alpha = struct
   let max_alpha = 0xffff
   let create_full a (b:effect) = _create_full a (Hashtbl.hash b)
 end;;
 
-module Texture = struct
+(*module Texture = struct
   external from_pixbuf : pixbuf -> [> `actor] obj
     = "ml_clutter_texture_new_from_pixbuf"    
-end;;
+end;;*)
 
 module Behaviour = struct
   module E = ClutterEnums
   end
 end;;
 
-module Container = struct
+(*module Container = struct
   external add_actor : [> `container] obj -> [> `actor] obj -> unit
     = "ml_clutter_container_add_actor"
   (*let add_actor = ClutterProps.Container.add_actor*)
        (*marshaller=fun f -> marshal0_ret ~ret:Gobject.Data.boolean f}*)
   end
 
-end;;
+end;;*)
 
 
 

File clutter/clutterTexture.ml

View file
  • Ignore whitespace
        let t = ClutterProps.Texture.create pl in
        new texture t)
 
-let from_pixbuf pixbuf =
-  let obj = Clutter.Texture.from_pixbuf pixbuf in
-  new texture obj

File clutter/ml_clutter.c

View file
  • Ignore whitespace
   for (i = 0; i < argc; i++) argv[i] = String_val(Field(arguments, i));
   argv[i] = NULL;
   clutter_init(&argc, &argv);
-  volatile GType clutter_type_ellipse = CLUTTER_TYPE_BEHAVIOUR_ELLIPSE;  
-  volatile GType clutter_type_rectangle = CLUTTER_TYPE_RECTANGLE;
-  volatile GType clutter_type_timeline = CLUTTER_TYPE_TIMELINE;
-  int dummy = clutter_type_ellipse + clutter_type_rectangle +
-    clutter_type_timeline;
+  int dummy = 0
+    + CLUTTER_TYPE_BEHAVIOUR_ELLIPSE
+    + CLUTTER_TYPE_RECTANGLE
+    + CLUTTER_TYPE_TIMELINE
+    + CLUTTER_TYPE_TEXTURE;
   return Val_int(dummy);
 }
 

File examples/actor1.ml

View file
  • Ignore whitespace
 let _ =
   let stage = ClutterStage.get_default () in
   let pixbuf = GdkPixbuf.from_file "./examples/ohpowers.png" in
-  let actor = ClutterTexture.from_pixbuf pixbuf in
+  let actor = ClutterTexture.texture ~pixbuf () in
   stage#add_actor actor#as_actor;
   actor#set_position ~x:100 ~y:100;
   actor#set_rotation `Z_AXIS ~angle:180. ~x:(actor#width / 2)

File examples/actor2.ml

View file
  • Ignore whitespace
 
   let group = ClutterGroup.group () in
   let _ = group#connect#add (fun _ _ -> Printf.printf "added\n%!") in
-  let actor1 = ClutterTexture.from_pixbuf pixbuf
-  and actor2 = ClutterTexture.from_pixbuf pixbuf in
+  let actor1 = ClutterTexture.texture ~pixbuf ~x:0 ~y:0 ()
+  and actor2 = ClutterTexture.texture ~pixbuf ~x:200 ~y:0 () in
   group#add_many [|actor1#as_actor; actor2#as_actor|];
-  actor1#set_position ~x:0 ~y:0;
-  actor2#set_position ~x:200 ~y:0;
   
   display_actor_props actor1#as_actor;
   display_actor_props actor2#as_actor;

File examples/behave.ml

View file
  • Ignore whitespace
 let _ =
   let stage = ClutterStage.get_default () in
   let pixbuf = GdkPixbuf.from_file "./examples/ohpowers.png" in
-  let actor = ClutterTexture.from_pixbuf pixbuf in
+  let actor = ClutterTexture.texture ~pixbuf () in
   stage#add_actor actor#as_actor;
   let timeline = ClutterTimeline.timeline ~num_frames:100 ~fps:5 () in
   let _ =