Skip to content

Commit

Permalink
Fixed editor copy paste inside panels and added examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tentone committed Dec 29, 2016
1 parent abe2f0a commit cb07307
Show file tree
Hide file tree
Showing 21 changed files with 424 additions and 79 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ nunuStudio is a JS based framework for 3D and VR applications that run direcly o
- Program stores pointer to nunu app (program.app)
- Added program.sendDataApp and app.setOnDataReceived for app/page communication
- Renamed NunuRuntime to NunuApp (Makes more sense)
- Fixed copy/paste inside object panels

### Runtime
- nunuStudio apps are meant to be used inside web pages
Expand Down
4 changes: 2 additions & 2 deletions build/nunu.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Nunu() {
}
Nunu.NAME = "nunuStudio";
Nunu.VERSION = "V0.8.9.16 Alpha";
Nunu.TIMESTAMP = "201612280338";
Nunu.TIMESTAMP = "201612290236";
Nunu.webvrAvailable = function() {
return void 0 !== navigator.getVRDisplays;
};
Expand Down Expand Up @@ -33122,7 +33122,7 @@ Program.prototype.sendDataApp = function(a) {
console.warn("nunuStudio: App data communication", a);
}
} else {
"object" === typeof obj ? alert(JSON.stringify(a)) : alert(a);
"object" === typeof a ? alert(JSON.stringify(a)) : alert(a);
}
};
Program.prototype.getMaterialByName = function(a) {
Expand Down
4 changes: 2 additions & 2 deletions build/nunu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions docs/examples/fps.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>

<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
</head>

<body onload="initialize();" onresize="resize();" oncontextmenu="return false;">
<script type="text/javascript" src="../../build/nunu.min.js"></script>
<script type="text/javascript">
var app;

function initialize()
{
app = new NunuApp();
app.loadProgram("fps.isp");
app.run();

if(!app.program.vr || !Nunu.webvrAvailable())
{
var button = document.getElementById("vr_button");
button.style.visibility = "hidden";
}
}

function resize()
{
app.resize();
}

function toggleFullscreen()
{
if(Nunu.fullscreen === true)
{
Nunu.setFullscreen(false);
app.resize();
}
else
{
Nunu.setFullscreen(true);
app.resize();
}
}

var vr = true;
function toggleVR()
{
if(app.vr_effect !== null)
{
app.vr_effect.setFullScreen(vr);
vr = !vr;
}
}
</script>
<div id="fullscreen_button" onclick="toggleFullscreen();" style="position:absolute; z-index: 10000; right:30px; bottom:30px">
<img style="position:absolute; cursor:pointer; opacity:0.4" width=25 height=25 src="fullscreen.png" onmouseenter="this.style.opacity = 1.0;" onmouseleave="this.style.opacity=0.4;"></img>
</div>
<div id = "vr_button" onclick="toggleVR();" style="position:absolute; z-index: 10000; right:70px; bottom:30px">
<img style="position:absolute; cursor:pointer; opacity:0.4" width=25 height=25 src="vr.png" onmouseenter="this.style.opacity = 1.0;" onmouseleave="this.style.opacity=0.4;"></img>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions docs/examples/fps.isp

Large diffs are not rendered by default.

Binary file added docs/examples/fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions docs/examples/pong.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>

<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
</head>

<body onload="initialize();" onresize="resize();" oncontextmenu="return false;">
<script type="text/javascript" src="../../build/nunu.min.js"></script>
<script type="text/javascript">
var app;

function initialize()
{
app = new NunuApp();
app.loadProgram("pong.isp");
app.run();

if(!app.program.vr || !Nunu.webvrAvailable())
{
var button = document.getElementById("vr_button");
button.style.visibility = "hidden";
}
}

function resize()
{
app.resize();
}

function toggleFullscreen()
{
if(Nunu.fullscreen === true)
{
Nunu.setFullscreen(false);
app.resize();
}
else
{
Nunu.setFullscreen(true);
app.resize();
}
}

var vr = true;
function toggleVR()
{
if(app.vr_effect !== null)
{
app.vr_effect.setFullScreen(vr);
vr = !vr;
}
}
</script>
<div id="fullscreen_button" onclick="toggleFullscreen();" style="position:absolute; z-index: 10000; right:30px; bottom:30px">
<img style="position:absolute; cursor:pointer; opacity:0.4" width=25 height=25 src="fullscreen.png" onmouseenter="this.style.opacity = 1.0;" onmouseleave="this.style.opacity=0.4;"></img>
</div>
<div id = "vr_button" onclick="toggleVR();" style="position:absolute; z-index: 10000; right:70px; bottom:30px">
<img style="position:absolute; cursor:pointer; opacity:0.4" width=25 height=25 src="vr.png" onmouseenter="this.style.opacity = 1.0;" onmouseleave="this.style.opacity=0.4;"></img>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions docs/examples/pong.isp

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions docs/examples/spine.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>

<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
</head>

<body onload="initialize();" onresize="resize();" oncontextmenu="return false;">
<script type="text/javascript" src="../../build/nunu.min.js"></script>
<script type="text/javascript">
var app;

function initialize()
{
app = new NunuApp();
app.loadProgram("spine.isp");
app.run();

if(!app.program.vr || !Nunu.webvrAvailable())
{
var button = document.getElementById("vr_button");
button.style.visibility = "hidden";
}
}

function resize()
{
app.resize();
}

function toggleFullscreen()
{
if(Nunu.fullscreen === true)
{
Nunu.setFullscreen(false);
app.resize();
}
else
{
Nunu.setFullscreen(true);
app.resize();
}
}

var vr = true;
function toggleVR()
{
if(app.vr_effect !== null)
{
app.vr_effect.setFullScreen(vr);
vr = !vr;
}
}
</script>
<div id="fullscreen_button" onclick="toggleFullscreen();" style="position:absolute; z-index: 10000; right:30px; bottom:30px">
<img style="position:absolute; cursor:pointer; opacity:0.4" width=25 height=25 src="fullscreen.png" onmouseenter="this.style.opacity = 1.0;" onmouseleave="this.style.opacity=0.4;"></img>
</div>
<div id = "vr_button" onclick="toggleVR();" style="position:absolute; z-index: 10000; right:70px; bottom:30px">
<img style="position:absolute; cursor:pointer; opacity:0.4" width=25 height=25 src="vr.png" onmouseenter="this.style.opacity = 1.0;" onmouseleave="this.style.opacity=0.4;"></img>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions docs/examples/spine.isp

Large diffs are not rendered by default.

Binary file added docs/examples/vr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 13 additions & 10 deletions source/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,20 @@ Editor.update = function()
}
else if(Keyboard.keyPressed(Keyboard.CTRL))
{
if(Keyboard.keyJustPressed(Keyboard.C))
if(Editor.panel !== null && !Editor.panel.focused)
{
Editor.copyObject();
}
else if(Keyboard.keyJustPressed(Keyboard.V))
{
Editor.pasteObject();
}
else if(Keyboard.keyJustPressed(Keyboard.X))
{
Editor.cutObject();
if(Keyboard.keyJustPressed(Keyboard.C))
{
Editor.copyObject();
}
else if(Keyboard.keyJustPressed(Keyboard.V))
{
Editor.pasteObject();
}
else if(Keyboard.keyJustPressed(Keyboard.X))
{
Editor.cutObject();
}
}
else if(Keyboard.keyJustPressed(Keyboard.Y))
{
Expand Down
2 changes: 1 addition & 1 deletion source/Nunu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Nunu(){}

Nunu.NAME = "nunuStudio";
Nunu.VERSION = "V0.8.9.16 Alpha";
Nunu.TIMESTAMP = "201612280338";
Nunu.TIMESTAMP = "201612290236";

//Check if webvr is available
Nunu.webvrAvailable = function()
Expand Down
2 changes: 1 addition & 1 deletion source/core/objects/Program.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ Program.prototype.sendDataApp = function(data)
}
else
{
if(typeof obj === "object")
if(typeof data === "object")
{
alert(JSON.stringify(data));
}
Expand Down
Loading

0 comments on commit cb07307

Please sign in to comment.