Pārlūkot izejas kodu

Adding simple web view example

Josh Engebretson 10 gadi atpakaļ
vecāks
revīzija
6ab42d11bb

+ 1 - 0
AtomicWebView/.gitignore

@@ -0,0 +1 @@
+Cache/*

+ 0 - 0
AtomicWebView/AtomicWebView.atomic


+ 5 - 0
AtomicWebView/Resources.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "251957595d8374163b5a9a5d5c07073a",
+	"FolderImporter": {}
+}

+ 5 - 0
AtomicWebView/Resources/Components.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "51a1c6288c038c41959a9775983b965c",
+	"FolderImporter": {}
+}

+ 61 - 0
AtomicWebView/Resources/Components/WebView.js

@@ -0,0 +1,61 @@
+"atomic component";
+
+var WIDTH = 900;
+var HEIGHT = 640;
+//UI component
+exports.component = function(self) {
+
+    //create a new UIView
+    var view = new Atomic.UIView();
+
+    // Create a UIWindow
+    var window = new Atomic.UIWindow();
+    // It will only have a title bar and won't be resizeable or have a close button
+    // window.settings = Atomic.UI_WINDOW_SETTINGS_TITLEBAR;
+    window.text = "UIWebView";
+    window.setSize(WIDTH, HEIGHT);
+
+    // The Web View
+    var webView = new WebView.UIWebView("https://ace.c9.io/build/kitchen-sink.html");
+    //var webView = new WebView.UIWebView("https://store.steampowered.com");
+    //var webView = new WebView.UIWebView("https://pixlcore.com/demos/webcamjs/demos/basic.html");
+    //var webView = new WebView.UIWebView("https://getmosh.io/");
+
+    //var webView = new WebView.UIWebView("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea");
+
+
+    window.addChild(webView);
+
+    // Add to main UI view and center
+    view.addChild(window);
+    window.center();
+
+}
+
+
+/*
+var webClient = new WebView.WebClient();
+var webTexture2D = new WebView.WebTexture2D(512, 512);
+
+webClient.webRenderHandler = webTexture2D;
+WebView.browserHost.createBrowser(webClient);
+
+var inspectorFields = {
+    speed: 1.0,
+    url: "https://www.youtube.com/watch?v=sGbxmsDFVnE"
+}
+
+exports.component = function(self) {
+
+    var sprite = self.node.getComponent("StaticSprite2D");
+    sprite.customMaterial = webTexture2D.material;
+
+    self.update = function(timeStep) {
+
+        //self.node.rotate2D(timeStep * 75 * self.speed);
+
+    }
+
+}
+
+*/

+ 7 - 0
AtomicWebView/Resources/Components/WebView.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "f648dad979013977adf9a23a90885388",
+	"JavascriptImporter": {
+		"IsComponentFile": true
+	}
+}

+ 5 - 0
AtomicWebView/Resources/Scenes.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "f07019273e746630babba2a883f98292",
+	"FolderImporter": {}
+}

+ 42 - 0
AtomicWebView/Resources/Scenes/Scene.scene

@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<scene id="1">
+	<attribute name="Name" value="" />
+	<attribute name="Time Scale" value="1" />
+	<attribute name="Smoothing Constant" value="50" />
+	<attribute name="Snap Threshold" value="5" />
+	<attribute name="Elapsed Time" value="0" />
+	<attribute name="Next Replicated Node ID" value="372" />
+	<attribute name="Next Replicated Component ID" value="1987" />
+	<attribute name="Next Local Node ID" value="16778496" />
+	<attribute name="Next Local Component ID" value="16777216" />
+	<attribute name="Variables" />
+	<attribute name="Variable Names" value="" />
+	<component type="PhysicsWorld" id="1" />
+	<component type="Octree" id="2" />
+	<component type="DebugRenderer" id="3" />
+	<component type="Renderer2D" id="1976" />
+	<node id="361">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Camera" />
+		<attribute name="Position" value="0 0 -5" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="Camera" id="1973">
+			<attribute name="Near Clip" value="0" />
+			<attribute name="Orthographic" value="true" />
+			<attribute name="Orthographic Size" value="8" />
+		</component>
+	</node>
+	<node id="371">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="WebView" />
+		<attribute name="Position" value="0 0 0" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="JSComponent" id="1986">
+			<attribute name="ComponentFile" value="JSComponentFile;Components/WebView.js" />
+		</component>
+	</node>
+</scene>

+ 5 - 0
AtomicWebView/Resources/Scenes/Scene.scene.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "2f22bb9d3effd3bc1032d2d88107c02c",
+	"SceneImporter": {}
+}

+ 5 - 0
AtomicWebView/Resources/Scripts.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "58896ba121e9e6652fd281604bdf4ba6",
+	"FolderImporter": {}
+}

+ 3 - 0
AtomicWebView/Resources/Scripts/main.js

@@ -0,0 +1,3 @@
+// This script is the main entry point of the game
+
+Atomic.player.loadScene("Scenes/Scene.scene");

+ 7 - 0
AtomicWebView/Resources/Scripts/main.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "18411c8ac3a23d1e0dfcc35ef4a24f59",
+	"JavascriptImporter": {
+		"IsComponentFile": false
+	}
+}

+ 5 - 0
AtomicWebView/Resources/Sprites.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "d47da89b9d1440f92408c4ffa60f9306",
+	"FolderImporter": {}
+}

BIN
AtomicWebView/Resources/Sprites/star.png


+ 5 - 0
AtomicWebView/Resources/Sprites/star.png.asset

@@ -0,0 +1,5 @@
+{
+	"version": 1,
+	"guid": "e42b5ae49799d253ff97a0df8747bced",
+	"TextureImporter": {}
+}