OSDN Git Service

AssetManager timings for debug.
authornathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Tue, 27 Dec 2011 14:35:41 +0000 (14:35 +0000)
committernathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Tue, 27 Dec 2011 14:35:41 +0000 (14:35 +0000)
Javadoc.

gdx/src/com/badlogic/gdx/assets/AssetLoadingTask.java
gdx/src/com/badlogic/gdx/assets/AssetManager.java
gdx/src/com/badlogic/gdx/math/Intersector.java
gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Skin.java

index 7c72eb8..7389ed8 100644 (file)
@@ -25,6 +25,7 @@ import com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader;
 import com.badlogic.gdx.assets.loaders.SynchronousAssetLoader;\r
 import com.badlogic.gdx.utils.Array;\r
 import com.badlogic.gdx.utils.GdxRuntimeException;\r
+import com.badlogic.gdx.utils.Logger;\r
 \r
 /** Responsible for loading an asset through an {@link AssetLoader} based on an {@link AssetDescriptor}. Implements\r
  * {@link Callable} and is used with an {@link ExecutorService threadpool} to load parts of an asset asynchronously if the asset is\r
@@ -36,6 +37,7 @@ class AssetLoadingTask implements Callable<Void> {
        final AssetDescriptor assetDesc;\r
        final AssetLoader loader;\r
        final ExecutorService threadPool;\r
+       final long startTime;\r
 \r
        volatile boolean asyncDone = false;\r
        boolean dependenciesLoaded = false;\r
@@ -53,6 +55,7 @@ class AssetLoadingTask implements Callable<Void> {
                this.assetDesc = assetDesc;\r
                this.loader = loader;\r
                this.threadPool = threadPool;\r
+               startTime = manager.log.getLevel() == Logger.DEBUG ? System.nanoTime() : 0;\r
        }\r
 \r
        /** Loads parts of the asset asynchronously if the loader is an {@link AsynchronousAssetLoader}. */\r
index 4a2121d..95f5236 100644 (file)
@@ -384,6 +384,9 @@ public class AssetManager implements Disposable {
                                if (task.assetDesc.params != null && task.assetDesc.params.loadedCallback != null) {\r
                                        task.assetDesc.params.loadedCallback.finishedLoading(this, task.assetDesc.fileName, task.assetDesc.type);\r
                                }\r
+\r
+                               long endTime = System.nanoTime();\r
+                               log.debug("Loaded: " + (endTime - task.startTime) / 1000000f + "ms " + task.assetDesc);\r
                        }\r
 \r
                        return true;\r
index 65eae7c..dd365e2 100644 (file)
@@ -95,11 +95,7 @@ public final class Intersector {
 
        /** Determines on which side of the given line the point is. Returns -1 if the point is on the left side of the line, 0 if the
         * point is on the line and 1 if the point is on the right side of the line. Left and right are relative to the lines direction
-        * which is linePoint1 to linePoint2.
-        * @param linePoint1
-        * @param linePoint2
-        * @param point
-        * @return */
+        * which is linePoint1 to linePoint2. */
        public static int pointLineSide (Vector2 linePoint1, Vector2 linePoint2, Vector2 point) {
                return (int)Math.signum((linePoint2.x - linePoint1.x) * (point.y - linePoint1.y) - (linePoint2.y - linePoint1.y)
                        * (point.x - linePoint1.x));
index 025581f..60f6605 100644 (file)
@@ -316,6 +316,10 @@ public class Skin implements Disposable {
                return typeStyles.findKey(style, true);\r
        }\r
 \r
+       /** Sets the style on the actor to disabled or enabled. This is done by appending "-disabled" to the style name when enabled is\r
+        * false, and removing "-disabled" from the style name when enabled is true. A method named "getStyle" is called the actor via\r
+        * reflection and the name of that style is found in the skin. If the actor doesn't have a "getStyle" method or the style was\r
+        * not found in the skin, no exception is thrown and the actor is left unchanged. */\r
        public void setEnabled (Actor actor, boolean enabled) {\r
                actor.touchable = enabled;\r
                // Get current style.\r