미디어위키:Gadget-xash3d.js: 두 판 사이의 차이
둘러보기로 이동
검색으로 이동
imported>Senouis 편집 요약 없음 |
imported>Senouis 잔글 (엘레먼트 임시 완성) |
||
1번째 줄: | 1번째 줄: | ||
// Game canvas | try { | ||
var canvas = document.createElement("canvas"); | // Game canvas | ||
canvas.style = "display:none;"; | var canvas = document.createElement("canvas"); | ||
canvas.class = "emscripten"; | canvas.style = "display:none;"; | ||
canvas.id = "canvas"; | canvas.class = "emscripten"; | ||
canvas.oncontextmenu = "event.preventDefault()"; | canvas.id = "canvas"; | ||
var canvasparent = document.getElementsByClassName("emscripten_border")[0]; // first element of emscripten-border | canvas.oncontextmenu = "event.preventDefault()"; | ||
canvasparent.appendChild(canvas); | var canvasparent = document.getElementsByClassName("emscripten_border")[0]; // first element of emscripten-border | ||
// screen option | canvasparent.appendChild(canvas); | ||
var gamecontrol = document.getElementById('xash-controls'); | // screen option | ||
var a1 = document.createElement("a"); | var gamecontrol = document.getElementById('xash-controls'); | ||
a1.class = "xash-glow"; | var a1 = document.createElement("a"); | ||
a1.innerHTML = "<span><input type=\"checkbox\" id=\"resize\">Resize canvas</span>"; | a1.class = "xash-glow"; | ||
gamecontrol.appendChild(a1); | a1.innerHTML = "<span><input type=\"checkbox\" id=\"resize\">Resize canvas</span>"; | ||
var a2 = document.createElement("a"); | gamecontrol.appendChild(a1); | ||
a2.class = "xash-glow"; | var a2 = document.createElement("a"); | ||
a2.innerHTML = "<span><input type=\"checkbox\" id=\"pointerLock\" checked>Lock/hide mouse pointer </span>"; | a2.class = "xash-glow"; | ||
gamecontrol.appendChild(a2); | a2.innerHTML = "<span><input type=\"checkbox\" id=\"pointerLock\" checked>Lock/hide mouse pointer </span>"; | ||
var controlinputspan = document.createElement("span"); | gamecontrol.appendChild(a2); | ||
controlinputspan.innerHTML = "<input type=\"button\" value=\"Fullscreen\" onclick=\"Module.requestFullscreen(document.getElementById('pointerLock').checked, document.getElementById('resize').checked)\">"; | var controlinputspan = document.createElement("span"); | ||
gamecontrol.appendChild(controlinputspan); | controlinputspan.innerHTML = "<input type=\"button\" value=\"Fullscreen\" onclick=\"Module.requestFullscreen(document.getElementById('pointerLock').checked, document.getElementById('resize').checked)\">"; | ||
var outputcontainer = document.getElementById("xash-output-container"); | gamecontrol.appendChild(controlinputspan); | ||
outputcontainer.innerHTML = "<textarea id=\"xash-output\" rows=\"8\"></textarea>"; | var outputcontainer = document.getElementById("xash-output-container"); | ||
// game option | outputcontainer.innerHTML = "<textarea id=\"xash-output\" rows=\"8\"></textarea>"; | ||
var gameoptionsTitle = document.getElementById("optionsTitle"); | // game option | ||
gameoptionsTitle.innerHTML = "<a class=\"glow\"><u><h1>Game Options</h1></u></a>"; | var gameoptionsTitle = document.getElementById("optionsTitle"); | ||
gameoptionsTitle.innerHTML = "<a class=\"glow\"><u><h1>Game Options</h1></u></a>"; | |||
var pkgHider = document.getElementById("pkgHider"); | |||
pkgHider.innerHTML = "<input name=\"b\" type=\"radio\" id=\"rPackage\" checked=true />Emscripten package from server (cached in IndexedDB if availiable)<select id=\"selectPkg\" style=\"display:none\"></select><br>"; | |||
var zipHider = document.getElementById("zipHider"); | |||
zipHider.innerHTML = "<input name=\"b\" type=radio id=\"rZip\" />ZIP archive from server (slower, but smaller, no IndexedDB cache)<select id=\"selectZip\" style=\"display:none\"></select><br>"; | |||
var localHider = document.getElementById("localHider"); | |||
localHider.innerHTML = "<input name=\"b\" type=radio id=\"rLocalZip\" />Local ZIP file:<input type=file name=\"c\" id=\"iZipFile\" />"; | |||
var xashlauncher = document.getElementById("xash-launch"); | |||
xashlauncher.innerHTML = "Command-line arguments: <input name=\"d\" type=text id=\"iArgs\" /><br><br><input type=button onclick=\"startXash();return false;\" value=\"Launch Xash3D!\" />"; | |||
} catch (e){ | |||
console.log("initiating xash3d for libertygame failed, stop loading elements..."); | |||
} |
2023년 3월 27일 (월) 00:04 판
try {
// Game canvas
var canvas = document.createElement("canvas");
canvas.style = "display:none;";
canvas.class = "emscripten";
canvas.id = "canvas";
canvas.oncontextmenu = "event.preventDefault()";
var canvasparent = document.getElementsByClassName("emscripten_border")[0]; // first element of emscripten-border
canvasparent.appendChild(canvas);
// screen option
var gamecontrol = document.getElementById('xash-controls');
var a1 = document.createElement("a");
a1.class = "xash-glow";
a1.innerHTML = "<span><input type=\"checkbox\" id=\"resize\">Resize canvas</span>";
gamecontrol.appendChild(a1);
var a2 = document.createElement("a");
a2.class = "xash-glow";
a2.innerHTML = "<span><input type=\"checkbox\" id=\"pointerLock\" checked>Lock/hide mouse pointer </span>";
gamecontrol.appendChild(a2);
var controlinputspan = document.createElement("span");
controlinputspan.innerHTML = "<input type=\"button\" value=\"Fullscreen\" onclick=\"Module.requestFullscreen(document.getElementById('pointerLock').checked, document.getElementById('resize').checked)\">";
gamecontrol.appendChild(controlinputspan);
var outputcontainer = document.getElementById("xash-output-container");
outputcontainer.innerHTML = "<textarea id=\"xash-output\" rows=\"8\"></textarea>";
// game option
var gameoptionsTitle = document.getElementById("optionsTitle");
gameoptionsTitle.innerHTML = "<a class=\"glow\"><u><h1>Game Options</h1></u></a>";
var pkgHider = document.getElementById("pkgHider");
pkgHider.innerHTML = "<input name=\"b\" type=\"radio\" id=\"rPackage\" checked=true />Emscripten package from server (cached in IndexedDB if availiable)<select id=\"selectPkg\" style=\"display:none\"></select><br>";
var zipHider = document.getElementById("zipHider");
zipHider.innerHTML = "<input name=\"b\" type=radio id=\"rZip\" />ZIP archive from server (slower, but smaller, no IndexedDB cache)<select id=\"selectZip\" style=\"display:none\"></select><br>";
var localHider = document.getElementById("localHider");
localHider.innerHTML = "<input name=\"b\" type=radio id=\"rLocalZip\" />Local ZIP file:<input type=file name=\"c\" id=\"iZipFile\" />";
var xashlauncher = document.getElementById("xash-launch");
xashlauncher.innerHTML = "Command-line arguments: <input name=\"d\" type=text id=\"iArgs\" /><br><br><input type=button onclick=\"startXash();return false;\" value=\"Launch Xash3D!\" />";
} catch (e){
console.log("initiating xash3d for libertygame failed, stop loading elements...");
}