Permalink
Browse files

New event system

  • Loading branch information...
1 parent da70d5d commit c0311889fcefde3a673b2615e9c23a08bb319cfb @serp256 committed Mar 15, 2012
Showing with 1,908 additions and 2,319 deletions.
  1. +1 −3 config.linux
  2. +17 −43 src/Atlas.ml
  3. +25 −26 src/Atlas.mli
  4. +16 −963 src/Clip.ml
  5. +42 −65 src/Clip.mli
  6. +0 −63 src/ClipT.mli
  7. +38 −86 src/DisplayObject.ml
  8. +142 −7 src/DisplayObject.mli
  9. +0 −147 src/DisplayObjectT.mli
  10. +24 −7 src/Ev.ml
  11. +36 −0 src/Ev.mli
  12. +9 −10 src/EventDispatcher.ml
  13. +11 −11 src/EventDispatcher.mli
  14. +16 −180 src/Image.ml
  15. +37 −36 src/Image.mli
  16. +939 −0 src/LightLib.ml
  17. +27 −0 src/LightLib.mli
  18. +1 −53 src/Lightning.ml
  19. +1 −32 src/Lightning.mli
  20. +4 −4 src/Makefile
  21. +6 −31 src/Quad.ml
  22. +13 −22 src/Quad.mli
  23. +138 −157 src/Sprite.ml
  24. +11 −16 src/Sprite.mli
  25. +204 −204 src/Stage.ml
  26. +27 −3 src/Stage.mli
  27. +0 −29 src/StageT.mli
  28. +4 −12 src/TLF.ml
  29. +67 −1 src/TLF.mli
  30. +0 −73 src/TLFT.mli
  31. +10 −7 src/Timer.ml
  32. +9 −6 src/URLLoader.ml
  33. +6 −3 src/URLLoader.mli
  34. +0 −3 test/Light.ml
  35. +2 −7 test/Makefile.in
  36. +1 −1 test/Makefile.sdl
  37. +24 −8 test/example.ml
View
@@ -1,8 +1,6 @@
export PLATFORM = SDL
export OS = linux
-OCAMLDIR = /usr/local/
-export OCAMLFIND = ocamlfind
-OCAMLBINDIR = $(OCAMLDIR)/bin/
+export OCAMLFIND = ocamlfind
export OCAMLOPT = $(OCAMLFIND) ocamlopt
export OCAMLC = $(OCAMLFIND) ocamlc
export OCAMLMKLIB = ocamlmklib
View
@@ -1,38 +1,9 @@
open LightCommon;
+
type atlas;
external atlas_init: unit -> atlas = "ml_atlas_init";
external atlas_clear_data: atlas -> unit = "ml_atlas_clear" "noalloc";
-module type S = sig
-
- module D : DisplayObjectT.S;
-
- class c: [ Texture.c ] ->
- object
- inherit D.c;
- method texture: Texture.c;
- method filters: list Filters.t;
- method setFilters: list Filters.t -> unit;
- method private render': ?alpha:float -> ~transform:bool -> option Rectangle.t -> unit;
- method boundsInSpace: !'space. option (<asDisplayObject: D.c; .. > as 'space) -> Rectangle.t;
- method addChild: ?index:int -> AtlasNode.t -> unit;
- method children: Enum.t AtlasNode.t;
- method clearChildren: unit -> unit;
- method getChildAt: int -> AtlasNode.t;
- method numChildren: int;
- method updateChild: int -> AtlasNode.t -> unit;
- method removeChild: int -> unit;
- method setChildIndex: int -> int -> unit;
- end;
-
-
- value create: Texture.c -> c;
-
-end;
-
-module Make(D:DisplayObjectT.S) = struct
- module D = D;
-
module Node = AtlasNode;
external atlas_render: atlas -> Matrix.t -> Render.prg -> textureID -> bool -> float -> option (DynArray.t Node.t) -> unit = "ml_atlas_render_byte" "ml_atlas_render" "noalloc";
@@ -46,11 +17,9 @@ module Make(D:DisplayObjectT.S) = struct
g_params: Filters.glow
};
- (* сюда припиздячить glow еще нахуй *)
- class c texture =
- (* нужно сделать фсю gl хуйню *)
+ class _c texture =
object(self)
- inherit D.c as super;
+ inherit DisplayObject.c as super;
value atlas = atlas_init ();
@@ -74,26 +43,26 @@ module Make(D:DisplayObjectT.S) = struct
| Some index ->
try
DynArray.insert children index child
- with [ DynArray.Invalid_arg _ -> raise D.Invalid_index ]
+ with [ DynArray.Invalid_arg _ -> raise DisplayObject.Invalid_index ]
];
Node.bounds child |> ignore; (* force calc bounds *)
self#boundsChanged();
);
- method getChildAt idx = try DynArray.get children idx with [ DynArray.Invalid_arg _ -> raise D.Invalid_index ];
+ method getChildAt idx = try DynArray.get children idx with [ DynArray.Invalid_arg _ -> raise DisplayObject.Invalid_index ];
method removeChild idx =
try
DynArray.delete children idx;
self#boundsChanged();
- with [ DynArray.Invalid_arg _ -> raise D.Invalid_index ];
+ with [ DynArray.Invalid_arg _ -> raise DisplayObject.Invalid_index ];
method updateChild idx child =
(
assert(child.Node.texture = texture);
try
DynArray.set children idx child;
- with [ DynArray.Invalid_arg _ -> raise D.Invalid_index ];
+ with [ DynArray.Invalid_arg _ -> raise DisplayObject.Invalid_index ];
Node.bounds child |> ignore; (* force calc bounds *)
self#boundsChanged();
);
@@ -119,10 +88,10 @@ module Make(D:DisplayObjectT.S) = struct
DynArray.delete children idx;
DynArray.insert children nidx child;
)
- with [ DynArray.Invalid_arg _ -> raise D.Invalid_index ];
+ with [ DynArray.Invalid_arg _ -> raise DisplayObject.Invalid_index ];
self#childrenDirty();
)
- else raise D.Invalid_index;
+ else raise DisplayObject.Invalid_index;
value mutable glowFilter = None;
@@ -227,7 +196,7 @@ module Make(D:DisplayObjectT.S) = struct
filters := fltrs;
);
- method boundsInSpace: !'space. (option (<asDisplayObject: D.c; .. > as 'space)) -> Rectangle.t = fun targetCoordinateSpace ->
+ method boundsInSpace: !'space. (option (<asDisplayObject: DisplayObject.c; .. > as 'space)) -> Rectangle.t = fun targetCoordinateSpace ->
match DynArray.length children with
[ 0 -> Rectangle.empty
| _ ->
@@ -306,6 +275,11 @@ module Make(D:DisplayObjectT.S) = struct
end;
- value create = new c;
+ class c texture =
+ object(self)
+ inherit _c texture;
+ method ccast: [= `Atlas of c ] = `Atlas (self :> c);
+ end;
+
+value create = new c;
-end;
View
@@ -1,30 +1,29 @@
-module type S = sig
- module D : DisplayObjectT.S;
- class c: [ Texture.c ] ->
- object
- inherit D.c;
- method texture: Texture.c;
- method filters: list Filters.t;
- method setFilters: list Filters.t -> unit;
- method private render': ?alpha:float -> ~transform:bool -> option Rectangle.t -> unit;
- method boundsInSpace: !'space. option (<asDisplayObject: D.c; .. > as 'space) -> Rectangle.t;
- method addChild: ?index:int -> AtlasNode.t -> unit;
- method children: Enum.t AtlasNode.t;
- method clearChildren: unit -> unit;
- method getChildAt: int -> AtlasNode.t;
- method numChildren: int;
- method updateChild: int -> AtlasNode.t -> unit;
- method removeChild: int -> unit;
- method setChildIndex: int -> int -> unit;
- end;
-
-
- value create: Texture.c -> c;
-
-end;
-
-module Make(D:DisplayObjectT.S) : S with module D = D;
+class _c: [ Texture.c ] ->
+ object
+ inherit DisplayObject.c;
+ method texture: Texture.c;
+ method filters: list Filters.t;
+ method setFilters: list Filters.t -> unit;
+ method private render': ?alpha:float -> ~transform:bool -> option Rectangle.t -> unit;
+ method boundsInSpace: !'space. option (<asDisplayObject: DisplayObject.c; .. > as 'space) -> Rectangle.t;
+ method addChild: ?index:int -> AtlasNode.t -> unit;
+ method children: Enum.t AtlasNode.t;
+ method clearChildren: unit -> unit;
+ method getChildAt: int -> AtlasNode.t;
+ method numChildren: int;
+ method updateChild: int -> AtlasNode.t -> unit;
+ method removeChild: int -> unit;
+ method setChildIndex: int -> int -> unit;
+ end;
+
+class c: [ Texture.c ] ->
+ object
+ inherit _c;
+ method ccast: [= `Atlas of c ];
+ end;
+
+value create: Texture.c -> c;
Oops, something went wrong.

0 comments on commit c031188

Please sign in to comment.