Skip to content

Commit 1f8934b

Browse files
authored
soft fullscreen for iOS and option to resize via checkbox in html template. closes #7423 (#7424)
#changelog #emscripten
1 parent a6906ae commit 1f8934b

File tree

2 files changed

+58
-30
lines changed

2 files changed

+58
-30
lines changed

libs/openFrameworksCompiled/project/emscripten/template.html

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -96,38 +96,66 @@
9696
outline: none;
9797
}
9898
</style>
99+
<script>
100+
function goEmscriptenFullscreen(resize){
101+
Module.requestFullscreen(0, resize);
102+
}
103+
function tryFullScreen(aspect, resize){
104+
var canvas = document.getElementById("canvas");
105+
if( resize ){
106+
canvas.width=screen.width;
107+
canvas.height=screen.height;
108+
}
109+
if(canvas.requestFullScreen){
110+
if( aspect )goEmscriptenFullscreen(resize);
111+
else canvas.requestFullScreen();
112+
}
113+
else if(canvas.webkitRequestFullScreen){
114+
if( aspect )goEmscriptenFullscreen(resize);
115+
else canvas.webkitRequestFullScreen();
116+
}
117+
else if(canvas.mozRequestFullScreen){
118+
if( aspect )goEmscriptenFullscreen(resize);
119+
else canvas.mozRequestFullScreen();
120+
}
121+
else{
122+
canvas.width=window.innerWidth;
123+
canvas.height=window.innerHeight;
124+
document.getElementById('header').style.display = 'none';
125+
document.getElementById('output').style.display = 'none';
126+
}
127+
}
128+
</script>
99129
</head>
100130
<body>
101-
<a id="logo" href="http://emscripten.org">
102-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
103-
<svg width="110px" height="58px" viewBox="0 0 110 58" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
104-
<title>openFrameworks Logo</title>
105-
<defs></defs>
106-
<g id="Page-1" stroke="none" stroke-width="1" fill="#000000" fill-rule="evenodd">
107-
<path id="Oval-1" d="M58,29 C58,13 45,0 29,0 C13,0 0,13 0,29 C0,45 13,58 29,58 C45,58 58,45 58,29 Z"></path>
108-
<rect id="Rectangle-1" x="59" y="0" width="25" height="58"></rect>
109-
<rect id="Rectangle-2" x="85" y="26" width="15" height="15"></rect>
110-
<path id="Path-2" d="M85,0 L110,0 L85,25 L85,0 Z"></path>
111-
</g>
112-
</svg>
113-
</a>
114-
115-
<div class="spinner" id='spinner'></div>
116-
<div class="emscripten" id="status">Downloading...</div>
117-
118-
<span id='controls'>
119-
<span><input type="checkbox" id="resize">Resize canvas</span>
120-
<span><input type="checkbox" id="pointerLock">Lock/hide mouse pointer &nbsp;&nbsp;&nbsp;</span>
121-
<span><input type="button" value="Fullscreen" onclick="Module.requestFullscreen(document.getElementById('pointerLock').checked,
122-
document.getElementById('resize').checked)">
123-
</span>
124-
</span>
125-
126-
<div class="emscripten">
127-
<progress value="0" max="100" id="progress" hidden=1></progress>
131+
<div id="header">
132+
<a id="logo" href="http://emscripten.org">
133+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
134+
<svg width="110px" height="58px" viewBox="0 0 110 58" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
135+
<title>openFrameworks Logo</title>
136+
<defs></defs>
137+
<g id="Page-1" stroke="none" stroke-width="1" fill="#000000" fill-rule="evenodd">
138+
<path id="Oval-1" d="M58,29 C58,13 45,0 29,0 C13,0 0,13 0,29 C0,45 13,58 29,58 C45,58 58,45 58,29 Z"></path>
139+
<rect id="Rectangle-1" x="59" y="0" width="25" height="58"></rect>
140+
<rect id="Rectangle-2" x="85" y="26" width="15" height="15"></rect>
141+
<path id="Path-2" d="M85,0 L110,0 L85,25 L85,0 Z"></path>
142+
</g>
143+
</svg>
144+
</a>
145+
146+
<div class="spinner" id='spinner'></div>
147+
<div class="emscripten" id="status">Downloading...</div>
148+
149+
<span id='controls'>
150+
Fullscreen options:
151+
<span><input type=checkbox id=resize>resize</span>
152+
<span><input type=checkbox id=keepAspect>keep aspect</span>
153+
<span><input type=button onclick="tryFullScreen(document.getElementById('keepAspect').checked, document.getElementById('resize').checked)" value=Fullscreen></span>
154+
</span>
155+
<div class="emscripten">
156+
<progress value="0" max="100" id="progress" hidden=1></progress>
157+
</div>
128158
</div>
129-
130-
131159
<div class="emscripten_border">
132160
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
133161
</div>

0 commit comments

Comments
 (0)