Quellcode durchsuchen

Update Rakefile, expose IntVector2

Josh Engebretson vor 11 Jahren
Ursprung
Commit
774366dcec

+ 1 - 1
Bin/CoreData/AtomicModules/AtomicGame.js

@@ -115,7 +115,7 @@ Game.prototype.createScene3D = function() {
         var width = (_viewport.right - 8) - _viewport.left;
         var height = _viewport.bottom - _viewport.top;
 
-        this.ui.getRoot().setPosition(_viewport.left + width/2, _viewport.top + height/2);
+        this.ui.getRoot().position = [_viewport.left, _viewport.top];
         this.ui.getRoot().setSize(width, height);        
 
     }

+ 38 - 40
Rakefile

@@ -1,26 +1,28 @@
 
-require 'rbconfig'
-
-def get_os
-@os ||= (
-  host_os = RbConfig::CONFIG['host_os']
-  case host_os
-  when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
-    :windows
-  when /darwin|mac os/
-    :macosx
-  when /linux/
-    :linux
-  when /solaris|bsd/
-    :unix
-  else
-    raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
-  end
-)
+include RbConfig
+
+case CONFIG['host_os']
+when /mswin|windows|mingw32/i
+    $HOST_OS = "windows"
+when /darwin/i
+    $HOST_OS = "darwin"
+else
+    abort("Unknown host config: Config::CONFIG['host_os']: #{Config::CONFIG['host_os']}")
 end
 
 $RAKE_ROOT = File.dirname(__FILE__)
 
+$ATOMICTILED_BUILD_DIR = "#{$RAKE_ROOT}/Artifacts/AtomicTiled_Build"
+$ATOMICTILED_SOURCE_DIR =  "#{$RAKE_ROOT}/../AtomicTiled"
+
+
+if $HOST_OS == "darwin"
+  $QT_BIN_DIR = "/Users/josh/Qt/5.4/clang_64/bin"
+else
+  $QT_BIN_DIR = "C:\\Qt\\5.4\\msvc2013_64\\bin"
+end
+
+
 namespace :android do
 
   CMAKE_ANDROID_BUILD_FOLDER = "#{$RAKE_ROOT}/Artifacts/Android_Build"
@@ -119,7 +121,7 @@ namespace :build_macosx do
 
 	end
 
-  task :editor => "build_macosx:player" do
+  task :editor => ["build_macosx:player", "atomictiled:build_osx"] do
 
     Dir.chdir(CMAKE_MACOSX_BUILD_FOLDER) do
       # add the generated JS bindings
@@ -144,6 +146,17 @@ namespace :build_macosx do
       sh "cp -r #{EDITORRESOURCES_FOLDER} #{EDITOR_APP_FOLDER}/Contents/Resources/EditorResources"
       sh "cp -r #{PLAYER_APP_FOLDER} #{DEPLOYMENT_FOLDER}/AtomicPlayer.app"
 
+    ATOMICTILED_DEPLOYED_DIR = "#{EDITOR_APP_FOLDER}/Contents/Applications"
+
+    FileUtils.mkdir_p(ATOMICTILED_DEPLOYED_DIR)
+
+    FileUtils.cp_r("#{$ATOMICTILED_BUILD_DIR}/bin/Tiled.app", "#{ATOMICTILED_DEPLOYED_DIR}/Tiled.app")
+
+    Dir.chdir(ATOMICTILED_DEPLOYED_DIR) do
+      sh "#{$QT_BIN_DIR}/macdeployqt #{ATOMICTILED_DEPLOYED_DIR}/Tiled.app"
+    end
+
+
     end
 
   end
@@ -250,9 +263,8 @@ namespace :atomictiled do
 
   task :build_windows do
 
-    QT_BIN_DIR = "C:\\Qt\\5.4\\msvc2013_64\\bin"
     QT_CREATOR_BIN_DIR = "C:\\Qt\\Tools\\QtCreator\\bin"  
-    ENV['PATH'] = "#{QT_BIN_DIR};" + ENV['PATH']    
+    ENV['PATH'] = "#{$QT_BIN_DIR};" + ENV['PATH']    
 
     ATOMICTILED_BUILD_DIR = "#{$RAKE_ROOT}/Artifacts/AtomicTiled_Build"
     ATOMICTILED_SOURCE_DIR =  "#{$RAKE_ROOT}\\..\\AtomicTiled"
@@ -278,26 +290,12 @@ namespace :atomictiled do
 
     task :build_osx do
 
-    QT_BIN_DIR = "/Users/josh/Qt/5.4/clang_64/bin"
+      FileUtils.mkdir_p($ATOMICTILED_BUILD_DIR)
 
-    ATOMICTILED_BUILD_DIR = "#{$RAKE_ROOT}/Artifacts/AtomicTiled_Build"
-    ATOMICTILED_SOURCE_DIR =  "#{$RAKE_ROOT}/../AtomicTiled"
-    ATOMICTILED_DEPLOYED_DIR = "#{$RAKE_ROOT}/Artifacts/AtomicTiled_Deployed"
-
-    FileUtils.mkdir_p(ATOMICTILED_BUILD_DIR)
-
-    Dir.chdir(ATOMICTILED_BUILD_DIR) do
-      sh "#{QT_BIN_DIR}/qmake -r \"#{ATOMICTILED_SOURCE_DIR}/tiled.pro\" \"CONFIG+=release\" \"QMAKE_CXXFLAGS+=-DBUILD_INFO_VERSION=ATOMIC_BUILD\""
-      sh "make -j8"
-    end
-
-    FileUtils.mkdir_p(ATOMICTILED_DEPLOYED_DIR)
-
-    FileUtils.cp_r("#{ATOMICTILED_BUILD_DIR}/bin/Tiled.app", "#{ATOMICTILED_DEPLOYED_DIR}/Tiled.app")
-
-    Dir.chdir(ATOMICTILED_DEPLOYED_DIR) do
-      sh "#{QT_BIN_DIR}/macdeployqt #{ATOMICTILED_DEPLOYED_DIR}/Tiled.app"
-    end
+      Dir.chdir($ATOMICTILED_BUILD_DIR) do
+        sh "#{$QT_BIN_DIR}/qmake -r \"#{$ATOMICTILED_SOURCE_DIR}/tiled.pro\" \"CONFIG+=release\" \"QMAKE_CXXFLAGS+=-DBUILD_INFO_VERSION=ATOMIC_BUILD\""
+        sh "make -j8"
+      end
 
   end
 

+ 11 - 2
Source/Atomic/Javascript/JSComponent.cpp

@@ -427,9 +427,7 @@ void JSComponent::HandleScriptEvent(StringHash eventType, VariantMap& eventData)
 
             }
 
-
         }
-
         else if (eventType == E_PHYSICSBEGINCONTACT2D || E_PHYSICSENDCONTACT2D)
         {
             using namespace PhysicsBeginContact2D;
@@ -491,6 +489,17 @@ void JSComponent::HandleScriptEvent(StringHash eventType, VariantMap& eventData)
             }
 
         }
+        else
+        {
+            duk_push_heapptr(ctx, function);
+            if (duk_pcall(ctx, 0) != 0)
+            {
+                vm_->SendJSErrorEvent();
+            }
+
+            duk_pop(ctx);
+
+        }
     }
 
 }

+ 5 - 0
Source/Tools/JSBind/JSBClass.h

@@ -129,6 +129,11 @@ public:
             numberArrayElements_ = 4;
             arrayElementType_ = "int";
         }
+        else if (name_ == "IntVector2")
+        {
+            numberArrayElements_ = 2;
+            arrayElementType_ = "int";
+        }
 
         allClasses_.Push(this);
     }

+ 1 - 1
Source/Tools/JSBind/modules/Math.json

@@ -1,5 +1,5 @@
 {
 	"name" : "Math",
 	"sources" : ["Math"],
-	"classes" : ["Color", "Vector2", "Vector3", "Vector4", "Quaternion", "BoundingBox", "Rect", "IntRect"]
+	"classes" : ["Color", "Vector2", "Vector3", "Vector4", "Quaternion", "BoundingBox", "Rect", "IntRect", "IntVector2"]
 }

+ 3 - 1
Source/Tools/JSBind/modules/UI.json

@@ -11,7 +11,9 @@
 			"SetFont" : ["Font", "int"]
 		},
 		"UIElement" : {
-			"SetColor" : ["Color"]
+			"SetColor" : ["Color"],
+			"SetPosition" : ["IntVector2"],
+			"SetSize" : ["int", "int"]
 		}
 
 	}