Browse Source

Updated haxe libs and JSBHaxe

rsredsq 10 years ago
parent
commit
8764d56565

File diff suppressed because it is too large
+ 690 - 608
Script/Haxe/Atomic.hx


+ 12 - 10
Script/Haxe/Editor.hx

@@ -2,23 +2,25 @@ package;
 
 
    // enum EditMode
-typedef EditMode = {
-    var EDIT_SELECT:Int;
-    var EDIT_MOVE:Int;
-    var EDIT_ROTATE:Int;
-    var EDIT_SCALE:Int;
-}
+typedef EditMode = Int;
 
    // enum AxisMode
-typedef AxisMode = {
-    var AXIS_WORLD:Int;
-    var AXIS_LOCAL:Int;
-}
+typedef AxisMode = Int;
 //Atomic Haxe Definitions
 
 extern class Editor {
 
 
+   // enum EditMode
+    public static var EDIT_SELECT:EditMode;
+    public static var EDIT_MOVE:EditMode;
+    public static var EDIT_ROTATE:EditMode;
+    public static var EDIT_SCALE:EditMode;
+
+   // enum AxisMode
+    public static var AXIS_WORLD:AxisMode;
+    public static var AXIS_LOCAL:AxisMode;
+
    public static var FINDTEXT_FLAG_NONE: Int;
    public static var FINDTEXT_FLAG_CASESENSITIVE: Int;
    public static var FINDTEXT_FLAG_WHOLEWORD: Int;

+ 11 - 8
Script/Haxe/ToolCore.hx

@@ -2,19 +2,20 @@ package;
 
 
    // enum PlatformID
-typedef PlatformID = {
-    var PLATFORMID_UNDEFINED:Int;
-    var PLATFORMID_WINDOWS:Int;
-    var PLATFORMID_MAC:Int;
-    var PLATFORMID_ANDROID:Int;
-    var PLATFORMID_IOS:Int;
-    var PLATFORMID_WEB:Int;
-}
+typedef PlatformID = Int;
 //Atomic Haxe Definitions
 
 extern class ToolCore {
 
 
+   // enum PlatformID
+    public static var PLATFORMID_UNDEFINED:PlatformID;
+    public static var PLATFORMID_WINDOWS:PlatformID;
+    public static var PLATFORMID_MAC:PlatformID;
+    public static var PLATFORMID_ANDROID:PlatformID;
+    public static var PLATFORMID_IOS:PlatformID;
+    public static var PLATFORMID_WEB:PlatformID;
+
    public static var PROJECTFILE_VERSION: Int;
 
 
@@ -256,6 +257,7 @@ extern class Asset extends AObject {
     var guid: String;
     var name: String;
     var path: String;
+    var extension: String;
     var relativePath: String;
     var cachePath: String;
     var importerType: String;
@@ -275,6 +277,7 @@ extern class Asset extends AObject {
     function getGUID(): String;
     function getName(): String;
     function getPath(): String;
+    function getExtension(): String;
       // Get the path relative to project
     function getRelativePath(): String;
     function getCachePath(): String;

+ 10 - 6
Script/TypeScript/Atomic.d.ts

@@ -1800,6 +1800,7 @@ declare module Atomic {
       getChildAtIndex(index:number):Node;
       createJSComponent(name:string, args?:{});
       getJSComponent(name:string):JSComponent;
+      createChildPrefab(childName:string, prefabPath:string);
 
    }
 
@@ -4566,8 +4567,8 @@ declare module Atomic {
       onSetEnabled(): void;
       // Set speed.
       setSpeed(speed: number): void;
-      // Set animation by animation set, name and loop mode.
-      setAnimation(animationSet: AnimationSet2D, name: string, loopMode?: LoopMode2D): void;
+      // Set animation by name and loop mode.
+      setAnimation(name: string, loopMode?: LoopMode2D): void;
       // Set animation set.
       setAnimationSet(animationSet: AnimationSet2D): void;
       // Set loop mode.
@@ -5206,7 +5207,7 @@ declare module Atomic {
 
    export class Light2D extends Component {
 
-      lightGroup: Light2DGroup;
+      lightGroupID: number;
       color: Color;
       numRays: number;
       lightType: LightType2D;
@@ -5218,8 +5219,8 @@ declare module Atomic {
       // Construct.
       constructor();
 
-      setLightGroup(group: Light2DGroup): void;
-      getLightGroup(): Light2DGroup;
+      setLightGroupID(id: number): void;
+      getLightGroupID(): number;
       getColor(): Color;
       setColor(color: Color): void;
       updateVertices(): void;
@@ -5277,17 +5278,20 @@ declare module Atomic {
 
       physicsWorld: PhysicsWorld2D;
       ambientColor: Color;
+      lightGroupID: number;
       frustumBox: BoundingBox;
 
       // Construct.
       constructor();
 
-      setPhysicsWorld(physicsWorld: PhysicsWorld2D): void;
       getPhysicsWorld(): PhysicsWorld2D;
       addLight2D(light: Light2D): void;
+      removeLight2D(light: Light2D): void;
       setDirty(): void;
       setAmbientColor(color: Color): void;
       getAmbientColor(): Color;
+      setLightGroupID(id: number): void;
+      getLightGroupID(): number;
       getFrustumBox(): BoundingBox;
 
    }

+ 2 - 2
Source/AtomicJS/Javascript/JSVM.cpp

@@ -362,12 +362,12 @@ void JSVM::GC()
 
 bool JSVM::ExecuteMain()
 {
-    if (!GetSubsystem<ResourceCache>()->Exists("out/main.js"))
+    if (!GetSubsystem<ResourceCache>()->Exists("Scripts/main.js"))
         return true;
 
 
     duk_get_global_string(ctx_, "require");
-    duk_push_string(ctx_, "out/main");
+    duk_push_string(ctx_, "Scripts/main");
 
     if (duk_pcall(ctx_, 1) != 0)
     {

+ 19 - 19
Source/ToolCore/JSBind/JSBHaxe.cpp

@@ -375,18 +375,18 @@ namespace ToolCore
         for (unsigned i = 0; i <enums.Size(); i++)
         {
             JSBEnum* _enum = enums[i];
-
+            //TODO: support for enums(for the first need to make support for enums in haxe2js compiler)
             source_ += "\n   // enum " + _enum->GetName() + "\n";
-            source_ += "typedef " + _enum->GetName() + " = {\n";
+            source_ += "typedef " + _enum->GetName() + " = Int;\n";
 
-            Vector<String>& values = _enum->GetValues();
+            //Vector<String>& values = _enum->GetValues();
 
-            for (unsigned j = 0; j < values.Size(); j++)
-            {
-                source_ += "    var " + values[j] + ":Int;\n";
-            }
+            //for (unsigned j = 0; j < values.Size(); j++)
+            //{
+            //    source_ += "var " + values[j] + ":" + _enum->GetName() +";\n";
+            //}
 
-            source_ += "}\n";
+            //source_ += "}\n";
 
         }
 
@@ -402,14 +402,14 @@ namespace ToolCore
             JSBEnum* _enum = enums[i];
 
             source_ += "\n   // enum " + _enum->GetName() + "\n";
-            source_ += "    public static var " + _enum->GetName() + ":" + _enum->GetName() + ";\n";
+            //source_ += "    public static var " + _enum->GetName() + ":" + _enum->GetName() + ";\n";
 
-            //Vector<String>& values = _enum->GetValues();
+            Vector<String>& values = _enum->GetValues();
 
-            //for (unsigned j = 0; j < values.Size(); j++)
-            //{
-            //    source_ += "    var " + values[j] + ":Int;\n";
-            //}
+            for (unsigned j = 0; j < values.Size(); j++)
+            {
+                source_ += "    public static var " + values[j] + ":" + _enum->GetName() + ";\n";
+            }
             //source_ += "}\n";
 
         }
@@ -433,7 +433,7 @@ namespace ToolCore
 
         Vector<SharedPtr<JSBModule>>& modules = package->GetModules();
 
-        source_ += "package;\n\n";
+        source_ += "package atomic;\n\n";
 
         for (unsigned i = 0; i < modules.Size(); i++)
         {
@@ -442,10 +442,10 @@ namespace ToolCore
 
         Begin();
 
-        //for (unsigned i = 0; i < modules.Size(); i++)
-        //{
-        //    RegisterEnums(modules[i]);
-        //}
+        for (unsigned i = 0; i < modules.Size(); i++)
+        {
+            RegisterEnums(modules[i]);
+        }
 
         for (unsigned i = 0; i < modules.Size(); i++)
         {

Some files were not shown because too many files changed in this diff