Commits

Reid van Melle committed b9a1dce

Wrapped up a few of the remaining behavior objects

Comments (0)

Files changed (6)

--ml pack clutter
+- ml pack clutter ?
 - ClutterCloneTexture
-- ClutterLable
+- ClutterLabel
 - ClutterEntry
 - ClutterScore
+- wrap up CairoBox and coglBox properly
+- debug/get working opengl wrapper
 - get some kind of automatic event conversion working and get types straight
 - ? copy_int32 ? used in clutter_event_get_time
 - update make_val_final for clutter/cogl i.e. remove /2.0/

clutter/clutter.props

 open Data
 open ClutterData
 module Object = struct
-  let cast w : [`gtk] obj = try_cast w "GObject"
+  let cast w : [`gobject] obj = try_cast w "GObject"
   external _ref : 'a obj -> unit = "ml_g_object_ref"
   let make ~classe params =
     let obj = unsafe_create ~classe params in _ref obj;
 
 oheader{
 open GtkSignal
-open Gobject
-open Data
 open ClutterProps
 
 (* Redefining saves space in bytecode! *)

clutter/clutterBehaviour.ml

   external bspline_new : alpha:alpha obj -> knots:knot array ->
     behaviour_bspline obj = "ml_clutter_behaviour_bspline_new"
 end
-  
-(*module Beh = struct
-  module E = ClutterEnums
-  (* ellipse operations *)
-  external ellipse : alpha obj -> cx:int -> cy:int -> width:int -> height:int -> dir:E.rotate_direction_type -> start:float -> finish:float -> ellipse obj = "ml_clutter_behaviour_ellipse_new_bc"
-    "ml_clutter_behaviour_ellipse_new"
-
-  (* opacity operations *)
-  external opacity : alpha obj -> start:int -> finish:int -> opacity obj = "ml_clutter_behaviour_opacity_new"
-
-  (* general behaviour operations *)
-  external apply : [> `behaviour] obj -> [> `actor] obj -> unit = "ml_clutter_behaviour_apply"
-
-  module P = struct
-    let opacity_end : ([>`opacity],_) Gobject.property =
-      {Gobject.name="opacity-end"; conv=Gobject.Data.int}
-    let opacity_start : ([>`opacity],_) Gobject.property =
-      {Gobject.name="opacity-start"; conv=Gobject.Data.int}
-  end
-end;;*)
 
 class behaviour_signals_impl obj = object
   inherit ['a] gobject_signals obj
   method apply = Behaviour.apply obj
 end
 
+(** Behaviour controlling the opacity *)
 module Opacity = struct
   class opacity_skel obj = object(self)
     inherit behaviour_opacity_props
     method obj : behaviour_opacity obj = obj
   end
 
-  class opacity_signals_impl obj = object
-    inherit ['a] gobject_signals obj
-    inherit behaviour_sigs
-  end
-
   class opacity obj = object
     inherit opacity_skel (obj : behaviour_opacity obj)
-    method connect = new opacity_signals_impl obj
+    method connect = new behaviour_signals_impl obj
   end
 
   let make_opacity ~create =
     make_opacity [] ~create:(fun pl -> new opacity (BehaviourOpacity.create pl))
 end
 
+(** A behaviour interpolating position along an ellipse *)
 module Ellipse = struct
   class ellipse_skel obj = object(self)
     inherit behaviour_ellipse_props
       | `Y_AXIS -> self#set_angle_tilt_y v*)
   end
 
-  class ellipse_signals_impl obj = object
-    inherit ['a] gobject_signals obj
-    inherit behaviour_sigs
-  end
-
   class ellipse obj = object
     inherit ellipse_skel (obj : [> `behaviourellipse] obj)
-    method connect = new ellipse_signals_impl obj
+    method connect = new behaviour_signals_impl obj
   end
 
   let make_ellipse ~create =
     make_ellipse [] ~create:(fun pl -> new ellipse (BehaviourEllipse.create pl))
 end
 
+(** A behaviour interpolating position along a B-Spline *)
 module Bspline = struct
   class bspline_skel obj = object(self)
     inherit behaviour_skel (as_behaviour obj)
 
 end
 
+(** A behaviour interpolating position along a path *)
 module Path = struct
   class path_skel obj = object(self)
     inherit behaviour_path_props
 
 end
 
+(** A behaviour controlling the Z position *)
+module Depth = struct
+  class depth_skel obj = object(self)
+    inherit behaviour_depth_props
+    inherit behaviour_skel (as_behaviour obj)
+    method obj : behaviour_depth obj = obj
+  end
 
-  
+  class depth obj = object
+    inherit depth_skel (obj : [> `behaviourdepth] obj)
+    method connect = new behaviour_signals_impl obj
+  end
+
+  let make_depth ~create =
+    BehaviourDepth.make_params ~cont:
+      (fun pl ->
+	 Behaviour.make_params pl ~cont:
+	   (fun pl () ->
+	      let (e : #depth_skel) = create pl in e))
+
+  let create =
+    make_depth [] ~create:(fun pl -> new depth (BehaviourDepth.create pl))
+
+end
+
+(** A behaviour controlling rotation *)
+module Rotate = struct
+  class rotate_skel obj = object(self)
+    inherit behaviour_rotate_props
+    inherit behaviour_skel (as_behaviour obj)
+    method obj : behaviour_rotate obj = obj
+  end
+
+  class rotate obj = object
+    inherit rotate_skel (obj : [> `behaviourrotate] obj)
+    method connect = new behaviour_signals_impl obj
+  end
+
+  let make_rotate ~create =
+    BehaviourRotate.make_params ~cont:
+      (fun pl ->
+	 Behaviour.make_params pl ~cont:
+	   (fun pl () ->
+	      let (e : #rotate_skel) = create pl in e))
+
+  let create =
+    make_rotate [] ~create:(fun pl -> new rotate (BehaviourRotate.create pl))
+
+end
+
+(** A behaviour controlling scale *)
+module Scale = struct
+  class scale_skel obj = object(self)
+    inherit behaviour_scale_props
+    inherit behaviour_skel (as_behaviour obj)
+    method obj : behaviour_scale obj = obj
+  end
+
+  class scale obj = object
+    inherit scale_skel (obj : [> `behaviourscale] obj)
+    method connect = new behaviour_signals_impl obj
+  end
+
+  let make_scale ~create =
+    BehaviourScale.make_params ~cont:
+      (fun pl ->
+	 Behaviour.make_params pl ~cont:
+	   (fun pl () ->
+	      let (e : #scale_skel) = create pl in e))
+
+  let create =
+    make_scale [] ~create:(fun pl -> new scale (BehaviourScale.create pl))
+
+end
+
+
+(* A few shortcuts to the creation routines *)
 let opacity = Opacity.create
 let ellipse = Ellipse.create
 let bspline = Bspline.create
 let path = Path.create
+let depth = Depth.create
+let rotate = Rotate.create
+let scale = Scale.create

clutter/clutterProps.ml

 open Data
 open ClutterData
 module Object = struct
-  let cast w : [`gtk] obj = try_cast w "GObject"
+  let cast w : [`gobject] obj = try_cast w "GObject"
   external _ref : 'a obj -> unit = "ml_g_object_ref"
   let make ~classe params =
     let obj = unsafe_create ~classe params in _ref obj;

clutter/ml_clutter.c

     + CLUTTER_TYPE_BEHAVIOUR_SCALE
     + CLUTTER_TYPE_BEHAVIOUR_DEPTH
     + CLUTTER_TYPE_BEHAVIOUR_BSPLINE
+    + CLUTTER_TYPE_BEHAVIOUR_ROTATE
     + CLUTTER_TYPE_TIMELINE
     + CLUTTER_TYPE_RECTANGLE
     + CLUTTER_TYPE_CAIRO
+    + CLUTTER_TYPE_SCORE
     + CLUTTER_TYPE_TEXTURE
     + CLUTTER_TYPE_CLONE_TEXTURE
     + CLUTTER_TYPE_LABEL

clutter/oclutterProps.ml

 let param = param
 
 open GtkSignal
-open Gobject
-open Data
 open ClutterProps
 
 (* Redefining saves space in bytecode! *)