Browse Source

Merge branch 'master' into ProjectTechniquesAndShaders

JohnnyWahib 9 years ago
parent
commit
7893e3f53b

+ 5 - 6
Build/CIScripts/GenEditorData.js

@@ -47,14 +47,13 @@ namespace('build', function() {
 
     console.log("Generating Examples & JSDocs");
 
-    fs.copySync(atomicRoot + "Build/Docs/Readme.md", jsDocFolder + "/Readme.md");
-    fs.copySync(atomicRoot + "Build/Docs/jsdoc.conf", jsDocFolder + "/jsdoc.conf");
+    fs.copySync(atomicRoot + "Build/Docs/Readme.md", jsDocFolder + "Readme.md");
+    fs.copySync(atomicRoot + "Build/Docs/atomic-theme", jsDocFolder + "atomic-theme");
 
     cmds = [
       "git clone https://github.com/AtomicGameEngine/AtomicExamples " + buildDir + "AtomicExamples && rm -rf " + buildDir + "AtomicExamples/.git",
-      "cd " + jsDocFolder + " && npm install git+https://github.com/jsdoc3/jsdoc",
-      "cd " + jsDocFolder + " && git clone https://github.com/AtomicGameEngine/jaguarjs-jsdoc && cd jaguarjs-jsdoc && git checkout atomic_master",
-      "cd " + jsDocFolder + " && ./node_modules/.bin/jsdoc ./Atomic.js -t ./jaguarjs-jsdoc/ -c ./jsdoc.conf Readme.md",
+      "cd " + jsDocFolder + " && npm install typedoc",
+      "cd " + jsDocFolder + " && ./node_modules/.bin/typedoc --out out ../../../Script/TypeScript/dist/Atomic.d.ts --module commonjs --includeDeclarations --mode file --theme atomic-theme --name 'Atomic Game Engine' --readme ./Readme.md",
     ];
 
     jake.exec(cmds, function() {
@@ -142,7 +141,7 @@ namespace('build', function() {
     cmds = [
       atomicRoot + "Build/Mac/node/node " + tsc + " -p ./Script",
       atomicRoot + "Build/Mac/node/node " + tsc + " -p ./Script/AtomicWebViewEditor",
-      atomicRoot + "Build/Mac/node/node " + dtsGenerator + " --name Atomic --baseDir ./Script/TypeScript --file ./Script/TypeScript/*.d.ts --exclude ./Script/TypeScript/dist/*.d.ts --out ./Script/TypeScript/dist/Atomic.d.ts"
+      atomicRoot + "Build/Mac/node/node " + dtsGenerator + " --name Atomic --project ./Script/TypeScript --out ./Script/TypeScript/dist/Atomic.d.ts"
     ];
 
       // will be copied when editor resources are copied

+ 2 - 2
Build/Docs/Readme.md

@@ -1,5 +1,5 @@
-##Atomic Game Engine™ Javascript Reference
+## Atomic Game Engine™ Javascript Reference
 
-##EARLY ACCESS DRAFT September 8th 2015
+## EARLY ACCESS DRAFT May 2016
 
 Atomic Game Engine Core API Reference

+ 1 - 0
Build/Docs/atomic-theme/assets/css/atomic.css

@@ -0,0 +1 @@
+a.title:before { content: ''; display: inline-block; vertical-align: middle; width: 20px; height: 20px; margin: 0 3px 2px 0; background-size: 20px 20px; background-image: url(../images/atomic-icon.png); }

BIN
Build/Docs/atomic-theme/assets/images/atomic-icon.png


+ 52 - 0
Build/Docs/atomic-theme/layouts/default.hbs

@@ -0,0 +1,52 @@
+<!doctype html>
+<html class="default no-js">
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>{{#ifCond model.name '==' project.name}}{{project.name}}{{else}}{{model.name}} | {{project.name}}{{/ifCond}}</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <link rel="stylesheet" href="{{relativeURL "assets/css/main.css"}}">
+    <link rel="stylesheet" href="{{relativeURL "assets/css/atomic.css"}}">
+    <script src="{{relativeURL "assets/js/modernizr.js"}}"></script>
+</head>
+<body>
+
+{{> header}}
+
+<div class="container container-main">
+    <div class="row">
+        <div class="col-8 col-content">
+            {{{contents}}}
+        </div>
+        <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
+            <nav class="tsd-navigation primary">
+                <ul>
+                    {{#each navigation.children}}
+                        {{> navigation}}
+                    {{/each}}
+                </ul>
+            </nav>
+
+            <nav class="tsd-navigation secondary menu-sticky">
+                <ul class="before-current">
+                    {{#each toc.children}}
+                        {{> toc.root}}
+                    {{/each}}
+                </ul>
+            </nav>
+        </div>
+    </div>
+</div>
+
+{{> footer}}
+
+<div class="overlay"></div>
+<script src="{{relativeURL "assets/js/main.js"}}"></script>
+<script>if (location.protocol == 'file:') document.write('<script src="{{relativeURL "assets/js/search.js"}}"><' + '/script>');</script>
+
+{{> analytics}}
+
+</body>
+</html>

+ 73 - 0
Build/Docs/atomic-theme/partials/footer.hbs

@@ -0,0 +1,73 @@
+
+<footer{{#unless settings.hideGenerator}} class="with-border-bottom"{{/unless}}>
+    <div class="container">
+        <h2>Legend</h2>
+        <div class="tsd-legend-group">
+            <ul class="tsd-legend">
+                <li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
+                <li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
+                <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
+                <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
+                <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
+                <li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
+                <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
+            </ul>
+            <ul class="tsd-legend">
+                <li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
+                <li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
+                <li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
+                <li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
+            </ul>
+            <ul class="tsd-legend">
+                <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
+                <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
+                <li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
+                <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
+                <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
+                <li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
+            </ul>
+            <ul class="tsd-legend">
+                <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
+                <li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
+                <li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
+                <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
+                <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
+                <li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
+                <li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
+            </ul>
+            <ul class="tsd-legend">
+                <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
+                <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
+                <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
+                <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
+            </ul>
+            <ul class="tsd-legend">
+                <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
+                <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
+                <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
+            </ul>
+            <ul class="tsd-legend">
+                <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
+                <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
+                <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
+            </ul>
+            <ul class="tsd-legend">
+                <li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
+                <li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
+            </ul>
+        </div>
+    </div>
+</footer>
+
+<div class="container">
+    <center>
+        (c) 2014-2016 THUNDERBEAST GAMES LLC<br>
+        (c) 2008-2016 The  <a target="_blank" href="http://urho3d.github.io/">Urho3D</a> Project<br>
+    </center>
+</div>
+
+{{#unless settings.hideGenerator}}
+    <div class="container tsd-generator">
+        <p>Generated using <a href="http://typedoc.io" target="_blank">TypeDoc</a></p>
+    </div>
+{{/unless}}

+ 24 - 0
Build/Docs/atomic-theme/partials/member.sources.hbs

@@ -0,0 +1,24 @@
+<aside class="tsd-sources">
+    {{#if implementationOf}}
+        <p>Implementation of {{#with implementationOf}}{{> typeAndParent}}{{/with}}</p>
+    {{/if}}
+    {{#if inheritedFrom}}
+        <p>Inherited from {{#with inheritedFrom}}{{> typeAndParent}}{{/with}}</p>
+    {{/if}}
+    {{#if overwrites}}
+        <p>Overwrites {{#with overwrites}}{{> typeAndParent}}{{/with}}</p>
+    {{/if}}
+    <!--
+    {{#if sources}}
+        <ul>
+            {{#each sources}}
+                {{#if url}}
+                    <li>Defined in <a href="{{url}}">{{fileName}}:{{line}}</a></li>
+                {{else}}
+                    <li>Defined in {{fileName}}:{{line}}</li>
+                {{/if}}
+            {{/each}}
+        </ul>
+    {{/if}}
+    -->
+</aside>

+ 1 - 0
Build/Docs/atomic-theme/theme.js

@@ -0,0 +1 @@
+exports = td.output.DefaultTheme;

+ 8 - 1
Build/Docs/gendocs.sh

@@ -1 +1,8 @@
-./node_modules/.bin/jsdoc ../Artifacts/JSDoc/Atomic.js -t ./jaguarjs-jsdoc/ -c ./jsdoc.conf Readme.md
+# Shortcut script that generates docs the same way that the CI script does.  Works on OSX.
+cp Readme.md ../../Artifacts/Build/JSDoc
+cp -R atomic-theme ../../Artifacts/Build/JSDoc/
+cd ../../Artifacts/Build/JSDoc
+npm install typedoc
+./node_modules/.bin/typedoc --out out ../../../Script/TypeScript/dist/Atomic.d.ts --module commonjs --includeDeclarations --mode file --theme atomic-theme --name 'Atomic Game Engine' --readme ./Readme.md
+
+cp -R out/ ../EditorData/Docs

+ 1 - 1
Build/Scripts/BuildCommon.js

@@ -84,7 +84,7 @@ namespace('build', function() {
           cmds.push(node + " " + tsc + " -p ./Script/AtomicWebViewEditor");
 
           // generate combined atomic.d.ts
-          cmds.push(node + " " + dtsGenerator + " --name Atomic --baseDir ./Script/TypeScript --file ./Script/TypeScript/*.d.ts --exclude ./Script/TypeScript/dist/*.d.ts --out ./Script/TypeScript/dist/Atomic.d.ts");
+          cmds.push(node + " " + dtsGenerator + " --name Atomic --project ./Script/TypeScript --out ./Script/TypeScript/dist/Atomic.d.ts");
 
           var lintTask = jake.Task['build:lint_typescript'];
 

+ 1 - 1
Script/AtomicEditor/ui/frames/menus/MainFrameMenu.ts

@@ -311,7 +311,7 @@ class MainFrameMenu extends Atomic.ScriptObject {
                 Atomic.fileSystem.systemOpen("https://github.com/AtomicGameEngine/AtomicGameEngine/");
                 return true;
             } else if (refid == "help api") {
-                var url = "file://" + ToolCore.toolEnvironment.toolDataDir + "Docs/JSDocs/Atomic.html";
+                var url = "file://" + ToolCore.toolEnvironment.toolDataDir + "Docs/JSDocs/index.html";
                 Atomic.fileSystem.systemOpen(url);
                 return true;
             }

+ 2 - 1
Script/Packages/Atomic/Resource.json

@@ -4,7 +4,8 @@
 	"classes" : ["Resource", "ResourceCache", "XMLFile", "PListFile", "JSONFile", "Image"],
 	"overloads": {
 		"Image": {
-			"GetPixel": ["int", "int"]
+			"GetPixel": ["int", "int"],
+			"SetSize": ["int", "int", "int", "unsigned"]
 		}
 	}
 }

+ 4 - 0
Script/TypeScript/README.md

@@ -0,0 +1,4 @@
+## Typescript Definition Files
+* Most of These ```*.d.ts``` files are generated by the build process.  
+* The ```*Work.d.ts``` files are hand created.
+* The ```tsconfig.json``` file is used to generate the combined ```dist\Atomic.d.ts``` file.

+ 16 - 0
Script/TypeScript/tsconfig.json

@@ -0,0 +1,16 @@
+{
+    "compilerOptions": {
+        "target": "es5",
+        "module": "commonjs",
+        "declaration": false,
+        "noImplicitAny": false,
+        "removeComments": false,
+        "noLib": false,
+        "moduleResolution": "classic",
+        "sourceMap": true,
+        "experimentalDecorators": true
+    },
+    "exclude": [
+      "dist/Atomic.d.ts"
+    ]
+}

+ 58 - 0
Source/Atomic/Resource/Image.cpp

@@ -2094,6 +2094,64 @@ Image* Image::GetSubimage(const IntRect& rect) const
     }
 }
 
+bool Image::SetSubimage(const Image* image, const IntRect& rect)
+{
+    if (!data_)
+        return false;
+
+    if (depth_ > 1 || IsCompressed())
+    {
+        LOGERROR("SetSubimage not supported for Compressed or 3D images");
+        return false;
+    }
+
+    if (rect.left_ < 0 || rect.top_ < 0 || rect.right_ > width_ || rect.bottom_ > height_ || !rect.Width() || !rect.Height())
+    {
+        LOGERROR("Can not set subimage in image " + GetName() + " with invalid region");
+        return false;
+    }
+
+    int width = rect.Width();
+    int height = rect.Height();
+    if (width == image->GetWidth() && height == image->GetHeight())
+    {
+        int components = Min((int)components_, (int)image->components_);
+
+        unsigned char* src = image->GetData();
+        unsigned char* dest = data_.Get() + (rect.top_ * width_ + rect.left_) * components_;
+        for (int i = 0; i < height; ++i)
+        {
+            memcpy(dest, src, width * components);
+                
+            src += width * image->components_;
+            dest += width_ * components_;
+        }
+    }
+    else
+    {
+        unsigned uintColor;
+        unsigned char* dest = data_.Get() + (rect.top_ * width_ + rect.left_) * components_;
+        unsigned char* src = (unsigned char*)&uintColor;
+        for (int y = 0; y < height; ++y)
+        {
+            for (int x = 0; x < width; ++x)
+            {
+                // Calculate float coordinates between 0 - 1 for resampling
+                float xF = (image->width_ > 1) ? (float)x / (float)(width - 1) : 0.0f;
+                float yF = (image->height_ > 1) ? (float)y / (float)(height - 1) : 0.0f;
+                uintColor = image->GetPixelBilinear(xF, yF).ToUInt();
+
+                memcpy(dest, src, components_);
+
+                dest += components_;
+            }
+            dest += (width_ - width) * components_;
+        }
+    }
+
+    return true;
+}
+
 SDL_Surface* Image::GetSDLSurface(const IntRect& rect) const
 {
     if (!data_)

+ 2 - 0
Source/Atomic/Resource/Image.h

@@ -198,6 +198,8 @@ public:
     CompressedLevel GetCompressedLevel(unsigned index) const;
     /// Return subimage from the image by the defined rect or null if failed. 3D images are not supported. You must free the subimage yourself.
     Image* GetSubimage(const IntRect& rect) const;
+    /// Copy contents of the image into the defined rect, scaling if necessary. This image should already be large enough to include the rect. Compressed and 3D images are not supported.
+    bool SetSubimage(const Image* image, const IntRect& rect);
     /// Return an SDL surface from the image, or null if failed. Only RGB images are supported. Specify rect to only return partial image. You must free the surface yourself.
     SDL_Surface* GetSDLSurface(const IntRect& rect = IntRect::ZERO) const;
     /// Precalculate the mip levels. Used by asynchronous texture loading.

+ 29 - 1
Source/ToolCore/JSBind/JSBHeaderVisitor.h

@@ -353,7 +353,7 @@ public:
         {
             const Token &tcomment = unit_->commentAt(i);
             unsigned line;
-            unit_->getPosition(tcomment.utf16charOffset, &line);
+            unit_->getPosition(tcomment.utf16charsEnd(), &line);
 
             if (line ==  function->line() - 1)
             {
@@ -376,6 +376,34 @@ public:
 
             }
 
+            if (comment[0] == '/' && comment[1] == '*' && comment[2] == '*')
+            {
+                int index = 3;
+                bool foundStar = false;
+                String docString = jfunction->GetDocString();
+                while(comment[index])
+                {
+                    // did we find a star in the last loop?
+                    if (foundStar)
+                    {
+                        // We have a an end of block indicator, let's break
+                        if (comment[index] == '/' && foundStar)
+                            break;
+
+                        // This is just a star in the comment, not an end of comment indicator.  Let's keep it
+                        docString += '*';
+                    }
+                    
+                    foundStar = comment[index] == '*';
+
+                    if (!foundStar)
+                        docString += comment[index];
+
+                    index++;
+                }
+                jfunction->SetDocString(docString);
+            }
+
         }
 
 

+ 1 - 1
Source/ToolCore/JSBind/JSBTypeScript.cpp

@@ -125,7 +125,7 @@ void JSBTypeScript::ExportFunction(JSBFunction* function)
     }
 
     if (function->GetDocString().Length())
-        source_ += "      //" + function->GetDocString() + "\n";
+        source_ += "      /** " + function->GetDocString() + " */\n";
 
     source_ += "      ";