diff --git a/Block.cpp b/Block.cpp deleted file mode 100644 index 5f224f0..0000000 --- a/Block.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "Block.h" - -Block::Block(int x, int y, int R, int B, int G) -{ - X = x; - Y = y; - color = std::make_tuple(R, G, B); -} \ No newline at end of file diff --git a/Block.h b/Block.h deleted file mode 100644 index 2f4a7fd..0000000 --- a/Block.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once -#include - -class Block -{ -public: - Block(){}; - Block(int x, int y, int R, int B, int G); - void display(float CameraX, float CameraY, float Zoom); -private: - int X; - int Y; - std::tuple color; -}; \ No newline at end of file diff --git a/C++ProjectTemplate b/C++ProjectTemplate index c1aa29d..42ca36a 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/C++ProjectTemplate.html b/C++ProjectTemplate.html deleted file mode 100644 index de51b65..0000000 --- a/C++ProjectTemplate.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - Emscripten-Generated Code - - - - - - - - - - diff --git a/C++ProjectTemplate.js b/C++ProjectTemplate.js deleted file mode 100644 index 5a678da..0000000 --- a/C++ProjectTemplate.js +++ /dev/null @@ -1 +0,0 @@ -var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}requireNodeFS=()=>{if(!nodePath){fs=require("fs");nodePath=require("path")}};read_=function shell_read(filename,binary){requireNodeFS();filename=nodePath["normalize"](filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{requireNodeFS();filename=nodePath["normalize"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module["onAbort"]){Module["onAbort"](what)}}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="C++ProjectTemplate.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["memory"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={42608:()=>{window.onunload=Module._olc_OnPageUnload},42652:($0,$1)=>{Module._olc_EmscriptenShellCss="width: 100%; height: 70vh; margin-left: auto; margin-right: auto;";Module._olc_WindowAspectRatio=$0/$1;Module.canvas.parentNode.addEventListener("resize",function(e){if(e.defaultPrevented){e.stopPropagation();return}var viewWidth=e.detail.width;var viewHeight=e.detail.width/Module._olc_WindowAspectRatio;if(viewHeight>e.detail.height){viewHeight=e.detail.height;viewWidth=e.detail.height*Module._olc_WindowAspectRatio}if(Module.canvas.parentNode.className=="emscripten_border")Module.canvas.parentNode.style.cssText=Module._olc_EmscriptenShellCss+" width: "+viewWidth.toString()+"px; height: "+viewHeight.toString()+"px;";Module.canvas.setAttribute("width",viewWidth);Module.canvas.setAttribute("height",viewHeight);if(document.fullscreenElement!=null){var top=(e.detail.height-viewHeight)/2;var left=(e.detail.width-viewWidth)/2;Module.canvas.style.position="fixed";Module.canvas.style.top=top.toString()+"px";Module.canvas.style.left=left.toString()+"px";Module.canvas.style.width="";Module.canvas.style.height=""}Module._olc_PGE_UpdateWindowSize(viewWidth,viewHeight);Module.canvas.focus();e.stopPropagation()});Module._olc_ResizeCanvas=function(){setTimeout(function(){if(Module.canvas.parentNode.className=="emscripten_border")Module.canvas.parentNode.style.cssText=Module._olc_EmscriptenShellCss;Module.canvas.style.cssText="width: 100%; height: 100%; outline: none;";var resizeEvent=new CustomEvent("resize",{detail:{width:Module.canvas.clientWidth,height:Module.canvas.clientHeight},bubbles:true,cancelable:true});Module.canvas.dispatchEvent(resizeEvent)},50)};document.body.style.cssText+=" overscroll-behavior-y: contain;";if(Module.canvas.parentNode.className=="emscripten_border"){document.body.style.margin="0";Module.canvas.parentNode.style.cssText=Module._olc_EmscriptenShellCss}Module._olc_ResizeCanvas();var resizeObserver=new ResizeObserver(function(entries){Module._olc_ResizeCanvas()}).observe(Module.canvas.parentNode);var mutationObserver=new MutationObserver(function(mutationsList,observer){for(var i=0;i0){callbacks.shift()(Module)}}function demangle(func){return func}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function dynCallLegacy(sig,ptr,args){var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return()=>crypto_module["randomBytes"](1)[0]}catch(e){}}return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(FS.cwd(),path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=PATH.normalizeArray(path.split("/").filter(p=>!!p),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream||!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},createPreloadedFile:(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=FS.getStream(dirfd);if(!dirstream)throw new FS.ErrnoError(8);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAP32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAP32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAP32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function __emscripten_date_now(){return Date.now()}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function __emscripten_throw_longjmp(){throw Infinity}function _abort(){abort("")}function _emscripten_set_main_loop_timing(mode,value){Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(!Browser.mainLoop.running){Browser.mainLoop.running=true}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,Browser.mainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,timeUntilNextTick)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(typeof setImmediate=="undefined"){var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var Browser_setImmediate_messageHandler=event=>{if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",Browser_setImmediate_messageHandler,true);setImmediate=function Browser_emulated_setImmediate(func){setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){if(Module["setImmediates"]===undefined)Module["setImmediates"]=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){setImmediate(Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process["hrtime"]();return t[0]*1e3+t[1]/1e6}}else _emscripten_get_now=()=>performance.now();function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;_proc_exit(status)}function maybeExit(){}function setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop,arg,noSetTiming){assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=browserIterationFunc;Browser.mainLoop.arg=arg;var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;function checkIsRunning(){if(thisMainLoopId0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}out('main loop blocker "'+blocker.name+'" took '+(Date.now()-start)+" ms");Browser.mainLoop.updateStatus();if(!checkIsRunning())return;setTimeout(Browser.mainLoop.runner,0);return}if(!checkIsRunning())return;Browser.mainLoop.currentFrameNumber=Browser.mainLoop.currentFrameNumber+1|0;if(Browser.mainLoop.timingMode==1&&Browser.mainLoop.timingValue>1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else if(Browser.mainLoop.timingMode==0){Browser.mainLoop.tickStartTime=_emscripten_get_now()}Browser.mainLoop.runIter(browserIterationFunc);if(!checkIsRunning())return;if(typeof SDL=="object"&&SDL.audio&&SDL.audio.queueNewAudioData)SDL.audio.queueNewAudioData();Browser.mainLoop.scheduler()};if(!noSetTiming){if(fps&&fps>0)_emscripten_set_main_loop_timing(0,1e3/fps);else _emscripten_set_main_loop_timing(1,1);Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}}function callUserCallback(func){if(ABORT){return}try{func()}catch(e){handleException(e)}}function safeSetTimeout(func,timeout){return setTimeout(function(){callUserCallback(func)},timeout)}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}}var Browser={mainLoop:{running:false,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;setMainLoop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus:function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining{assert(img.complete,"Image "+name+" could not be decoded");var canvas=document.createElement("canvas");canvas.width=img.width;canvas.height=img.height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);preloadedImages[name]=canvas;Browser.URLObject.revokeObjectURL(url);if(onload)onload(byteArray)};img.onerror=event=>{out("Image "+url+" could not be decoded");if(onerror)onerror()};img.src=url};Module["preloadPlugins"].push(imagePlugin);var audioPlugin={};audioPlugin["canHandle"]=function audioPlugin_canHandle(name){return!Module.noAudioDecoding&&name.substr(-4)in{".ogg":1,".wav":1,".mp3":1}};audioPlugin["handle"]=function audioPlugin_handle(byteArray,name,onload,onerror){var done=false;function finish(audio){if(done)return;done=true;preloadedAudios[name]=audio;if(onload)onload(byteArray)}function fail(){if(done)return;done=true;preloadedAudios[name]=new Audio;if(onerror)onerror()}if(Browser.hasBlobConstructor){try{var b=new Blob([byteArray],{type:Browser.getMimetype(name)})}catch(e){return fail()}var url=Browser.URLObject.createObjectURL(b);var audio=new Audio;audio.addEventListener("canplaythrough",()=>finish(audio),false);audio.onerror=function audio_onerror(event){if(done)return;err("warning: browser could not fully decode audio "+name+", trying slower base64 approach");function encode64(data){var BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var PAD="=";var ret="";var leftchar=0;var leftbits=0;for(var i=0;i=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;safeSetTimeout(function(){finish(audio)},1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===Module["canvas"]||document["mozPointerLockElement"]===Module["canvas"]||document["webkitPointerLockElement"]===Module["canvas"]||document["msPointerLockElement"]===Module["canvas"]}var canvas=Module["canvas"];if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||(()=>{});canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||(()=>{});canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",ev=>{if(!Browser.pointerLock&&Module["canvas"].requestPointerLock){Module["canvas"].requestPointerLock();ev.preventDefault()}},false)}}},handledByPreloadPlugin:function(byteArray,fullname,finish,onerror){Browser.init();var handled=false;Module["preloadPlugins"].forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled},createContext:function(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false,majorVersion:2};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}if(typeof GL!="undefined"){contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}}}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx=="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});Browser.init()}return ctx},destroyContext:function(canvas,useWebGL,setInModule){},fullscreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullscreen:function(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer=="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas=="undefined")Browser.resizeCanvas=false;var canvas=Module["canvas"];function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if((document["fullscreenElement"]||document["mozFullScreenElement"]||document["msFullscreenElement"]||document["webkitFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullscreen);if(Module["onFullscreen"])Module["onFullscreen"](Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?()=>canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]):null)||(canvasContainer["webkitRequestFullScreen"]?()=>canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]):null);canvasContainer.requestFullscreen()},exitFullscreen:function(){if(!Browser.isFullscreen){return false}var CFS=document["exitFullscreen"]||document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["msExitFullscreen"]||document["webkitCancelFullScreen"]||function(){};CFS.apply(document,[]);return true},nextRAF:0,fakeRequestAnimationFrame:function(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame:function(func){if(typeof requestAnimationFrame=="function"){requestAnimationFrame(func);return}var RAF=Browser.fakeRequestAnimationFrame;RAF(func)},safeSetTimeout:function(func){return safeSetTimeout(func)},safeRequestAnimationFrame:function(func){return Browser.requestAnimationFrame(function(){callUserCallback(func)})},getMimetype:function(name){return{"jpg":"image/jpeg","jpeg":"image/jpeg","png":"image/png","bmp":"image/bmp","ogg":"audio/ogg","wav":"audio/wav","mp3":"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia:function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)},getMovementX:function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY:function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta:function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail/3;break;case"mousewheel":delta=event.wheelDelta/120;break;case"wheel":delta=event.deltaY;switch(event.deltaMode){case 0:delta/=100;break;case 1:delta/=3;break;case 2:delta*=80;break;default:throw"unrecognized mouse wheel delta mode: "+event.deltaMode}break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];if(!last)last=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}},resizeListeners:[],updateResizeListeners:function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(function(listener){listener(canvas.width,canvas.height)})},setCanvasSize:function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags|8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags&~8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},updateCanvasDimensions:function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h>2];if(param==12321){var alphaSize=HEAP32[attribList+4>>2];EGL.contextAttributes.alpha=alphaSize>0}else if(param==12325){var depthSize=HEAP32[attribList+4>>2];EGL.contextAttributes.depth=depthSize>0}else if(param==12326){var stencilSize=HEAP32[attribList+4>>2];EGL.contextAttributes.stencil=stencilSize>0}else if(param==12337){var samples=HEAP32[attribList+4>>2];EGL.contextAttributes.antialias=samples>0}else if(param==12338){var samples=HEAP32[attribList+4>>2];EGL.contextAttributes.antialias=samples==1}else if(param==12544){var requestedPriority=HEAP32[attribList+4>>2];EGL.contextAttributes.lowLatency=requestedPriority!=12547}else if(param==12344){break}attribList+=8}}if((!config||!config_size)&&!numConfigs){EGL.setErrorCode(12300);return 0}if(numConfigs){HEAP32[numConfigs>>2]=1}if(config&&config_size>0){HEAP32[config>>2]=62002}EGL.setErrorCode(12288);return 1}};function _eglChooseConfig(display,attrib_list,configs,config_size,numConfigs){return EGL.chooseConfig(display,attrib_list,configs,config_size,numConfigs)}function __webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance(ctx){return!!(ctx.dibvbi=ctx.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"))}function __webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance(ctx){return!!(ctx.mdibvbi=ctx.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance"))}function __webgl_enable_WEBGL_multi_draw(ctx){return!!(ctx.multiDrawWebgl=ctx.getExtension("WEBGL_multi_draw"))}var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function recordError(errorCode){if(!GL.lastError){GL.lastError=errorCode}},getNewId:function(table){var ret=GL.counter++;for(var i=table.length;i>2]:-1;source+=UTF8ToString(HEAP32[string+i*4>>2],len<0?undefined:len)}return source},createContext:function(canvas,webGLContextAttributes){if(!canvas.getContextSafariWebGL2Fixed){canvas.getContextSafariWebGL2Fixed=canvas.getContext;function fixedGetContext(ver,attrs){var gl=canvas.getContextSafariWebGL2Fixed(ver,attrs);return ver=="webgl"==gl instanceof WebGLRenderingContext?gl:null}canvas.getContext=fixedGetContext}var ctx=canvas.getContext("webgl2",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:function(ctx,webGLContextAttributes){var handle=GL.getNewId(GL.contexts);var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault=="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:function(contextHandle){GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext&&GL.currentContext.GLctx;return!(contextHandle&&!GLctx)},getContext:function(contextHandle){return GL.contexts[contextHandle]},deleteContext:function(contextHandle){if(GL.currentContext===GL.contexts[contextHandle])GL.currentContext=null;if(typeof JSEvents=="object")JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas)GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined;GL.contexts[contextHandle]=null},initExtensions:function(context){if(!context)context=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;__webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance(GLctx);__webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance(GLctx);if(context.version>=2){GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query_webgl2")}if(context.version<2||!GLctx.disjointTimerQueryExt){GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query")}__webgl_enable_WEBGL_multi_draw(GLctx);var exts=GLctx.getSupportedExtensions()||[];exts.forEach(function(ext){if(!ext.includes("lose_context")&&!ext.includes("debug")){GLctx.getExtension(ext)}})}};function _eglCreateContext(display,config,hmm,contextAttribs){if(display!=62e3){EGL.setErrorCode(12296);return 0}var glesContextVersion=1;for(;;){var param=HEAP32[contextAttribs>>2];if(param==12440){glesContextVersion=HEAP32[contextAttribs+4>>2]}else if(param==12344){break}else{EGL.setErrorCode(12292);return 0}contextAttribs+=8}if(glesContextVersion<2||glesContextVersion>3){EGL.setErrorCode(12293);return 0}EGL.contextAttributes.majorVersion=glesContextVersion-1;EGL.contextAttributes.minorVersion=0;EGL.context=GL.createContext(Module["canvas"],EGL.contextAttributes);if(EGL.context!=0){EGL.setErrorCode(12288);GL.makeContextCurrent(EGL.context);Module.useWebGL=true;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});GL.makeContextCurrent(null);return 62004}else{EGL.setErrorCode(12297);return 0}}function _eglCreateWindowSurface(display,config,win,attrib_list){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(config!=62002){EGL.setErrorCode(12293);return 0}EGL.setErrorCode(12288);return 62006}function _eglDestroyContext(display,context){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(context!=62004){EGL.setErrorCode(12294);return 0}GL.deleteContext(EGL.context);EGL.setErrorCode(12288);if(EGL.currentContext==context){EGL.currentContext=0}return 1}function _eglDestroySurface(display,surface){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(surface!=62006){EGL.setErrorCode(12301);return 1}if(EGL.currentReadSurface==surface){EGL.currentReadSurface=0}if(EGL.currentDrawSurface==surface){EGL.currentDrawSurface=0}EGL.setErrorCode(12288);return 1}function _eglGetDisplay(nativeDisplayType){EGL.setErrorCode(12288);return 62e3}function _eglInitialize(display,majorVersion,minorVersion){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(majorVersion){HEAP32[majorVersion>>2]=1}if(minorVersion){HEAP32[minorVersion>>2]=4}EGL.defaultDisplayInitialized=true;EGL.setErrorCode(12288);return 1}function _eglMakeCurrent(display,draw,read,context){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(context!=0&&context!=62004){EGL.setErrorCode(12294);return 0}if(read!=0&&read!=62006||draw!=0&&draw!=62006){EGL.setErrorCode(12301);return 0}GL.makeContextCurrent(context?EGL.context:null);EGL.currentContext=context;EGL.currentDrawSurface=draw;EGL.currentReadSurface=read;EGL.setErrorCode(12288);return 1}function _eglSwapBuffers(){if(!EGL.defaultDisplayInitialized){EGL.setErrorCode(12289)}else if(!Module.ctx){EGL.setErrorCode(12290)}else if(Module.ctx.isContextLost()){EGL.setErrorCode(12302)}else{EGL.setErrorCode(12288);return 1}return 0}function _eglSwapInterval(display,interval){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(interval==0)_emscripten_set_main_loop_timing(0,0);else _emscripten_set_main_loop_timing(1,interval);EGL.setErrorCode(12288);return 1}function _eglTerminate(display){if(display!=62e3){EGL.setErrorCode(12296);return 0}EGL.currentContext=0;EGL.currentReadSurface=0;EGL.currentDrawSurface=0;EGL.defaultDisplayInitialized=false;EGL.setErrorCode(12288);return 1}var readAsmConstArgsArray=[];function readAsmConstArgs(sigPtr,buf){readAsmConstArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readAsmConstArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readAsmConstArgsArray}function _emscripten_asm_const_int(code,sigPtr,argbuf){var args=readAsmConstArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_cancel_main_loop(){Browser.mainLoop.pause();Browser.mainLoop.func=null}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var JSEvents={inEventHandler:0,removeAllEventListeners:function(){for(var i=JSEvents.eventHandlers.length-1;i>=0;--i){JSEvents._removeHandler(i)}JSEvents.eventHandlers=[];JSEvents.deferredCalls=[]},registerRemoveEventListeners:function(){if(!JSEvents.removeEventListenersRegistered){__ATEXIT__.push(JSEvents.removeAllEventListeners);JSEvents.removeEventListenersRegistered=true}},deferredCalls:[],deferCall:function(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var i in JSEvents.deferredCalls){var call=JSEvents.deferredCalls[i];if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction:targetFunction,precedence:precedence,argsList:argsList});JSEvents.deferredCalls.sort(function(x,y){return x.precedence2?UTF8ToString(cString):cString}var specialHTMLTargets=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function findEventTarget(target){target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!="undefined"?document.querySelector(target):undefined);return domElement}function registerFocusEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.focusEvent)JSEvents.focusEvent=_malloc(256);var focusEventHandlerFunc=function(ev){var e=ev||event;var nodeName=JSEvents.getNodeNameForTarget(e.target);var id=e.target.id?e.target.id:"";var focusEvent=JSEvents.focusEvent;stringToUTF8(nodeName,focusEvent+0,128);stringToUTF8(id,focusEvent+128,128);if(getWasmTableEntry(callbackfunc)(eventTypeId,focusEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:focusEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_blur_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerFocusEventCallback(target,userData,useCapture,callbackfunc,12,"blur",targetThread);return 0}function findCanvasEventTarget(target){return findEventTarget(target)}function _emscripten_set_canvas_element_size(target,width,height){var canvas=findCanvasEventTarget(target);if(!canvas)return-4;canvas.width=width;canvas.height=height;return 0}function _emscripten_set_focus_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerFocusEventCallback(target,userData,useCapture,callbackfunc,13,"focus",targetThread);return 0}function registerKeyEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.keyEvent)JSEvents.keyEvent=_malloc(176);var keyEventHandlerFunc=function(e){var keyEventData=JSEvents.keyEvent;HEAPF64[keyEventData>>3]=e.timeStamp;var idx=keyEventData>>2;HEAP32[idx+2]=e.location;HEAP32[idx+3]=e.ctrlKey;HEAP32[idx+4]=e.shiftKey;HEAP32[idx+5]=e.altKey;HEAP32[idx+6]=e.metaKey;HEAP32[idx+7]=e.repeat;HEAP32[idx+8]=e.charCode;HEAP32[idx+9]=e.keyCode;HEAP32[idx+10]=e.which;stringToUTF8(e.key||"",keyEventData+44,32);stringToUTF8(e.code||"",keyEventData+76,32);stringToUTF8(e.char||"",keyEventData+108,32);stringToUTF8(e.locale||"",keyEventData+140,32);if(getWasmTableEntry(callbackfunc)(eventTypeId,keyEventData,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:keyEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_keydown_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerKeyEventCallback(target,userData,useCapture,callbackfunc,2,"keydown",targetThread);return 0}function _emscripten_set_keyup_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerKeyEventCallback(target,userData,useCapture,callbackfunc,3,"keyup",targetThread);return 0}function _emscripten_set_main_loop(func,fps,simulateInfiniteLoop){var browserIterationFunc=getWasmTableEntry(func);setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop)}function getBoundingClientRect(e){return specialHTMLTargets.indexOf(e)<0?e.getBoundingClientRect():{"left":0,"top":0}}function fillMouseEventData(eventStruct,e,target){HEAPF64[eventStruct>>3]=e.timeStamp;var idx=eventStruct>>2;HEAP32[idx+2]=e.screenX;HEAP32[idx+3]=e.screenY;HEAP32[idx+4]=e.clientX;HEAP32[idx+5]=e.clientY;HEAP32[idx+6]=e.ctrlKey;HEAP32[idx+7]=e.shiftKey;HEAP32[idx+8]=e.altKey;HEAP32[idx+9]=e.metaKey;HEAP16[idx*2+20]=e.button;HEAP16[idx*2+21]=e.buttons;HEAP32[idx+11]=e["movementX"];HEAP32[idx+12]=e["movementY"];var rect=getBoundingClientRect(target);HEAP32[idx+13]=e.clientX-rect.left;HEAP32[idx+14]=e.clientY-rect.top}function registerMouseEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.mouseEvent)JSEvents.mouseEvent=_malloc(72);target=findEventTarget(target);var mouseEventHandlerFunc=function(ev){var e=ev||event;fillMouseEventData(JSEvents.mouseEvent,e,target);if(getWasmTableEntry(callbackfunc)(eventTypeId,JSEvents.mouseEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString!="mousemove"&&eventTypeString!="mouseenter"&&eventTypeString!="mouseleave",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:mouseEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_mousedown_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,5,"mousedown",targetThread);return 0}function _emscripten_set_mousemove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,8,"mousemove",targetThread);return 0}function _emscripten_set_mouseup_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,6,"mouseup",targetThread);return 0}function registerTouchEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.touchEvent)JSEvents.touchEvent=_malloc(1696);target=findEventTarget(target);var touchEventHandlerFunc=function(e){var t,touches={},et=e.touches;for(var i=0;i>3]=e.timeStamp;var idx=touchEvent>>2;HEAP32[idx+3]=e.ctrlKey;HEAP32[idx+4]=e.shiftKey;HEAP32[idx+5]=e.altKey;HEAP32[idx+6]=e.metaKey;idx+=7;var targetRect=getBoundingClientRect(target);var numTouches=0;for(var i in touches){t=touches[i];HEAP32[idx+0]=t.identifier;HEAP32[idx+1]=t.screenX;HEAP32[idx+2]=t.screenY;HEAP32[idx+3]=t.clientX;HEAP32[idx+4]=t.clientY;HEAP32[idx+5]=t.pageX;HEAP32[idx+6]=t.pageY;HEAP32[idx+7]=t.isChanged;HEAP32[idx+8]=t.onTarget;HEAP32[idx+9]=t.clientX-targetRect.left;HEAP32[idx+10]=t.clientY-targetRect.top;idx+=13;if(++numTouches>31){break}}HEAP32[touchEvent+8>>2]=numTouches;if(getWasmTableEntry(callbackfunc)(eventTypeId,touchEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString=="touchstart"||eventTypeString=="touchend",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:touchEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_touchend_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,23,"touchend",targetThread);return 0}function _emscripten_set_touchmove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,24,"touchmove",targetThread);return 0}function _emscripten_set_touchstart_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,22,"touchstart",targetThread);return 0}function registerWheelEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.wheelEvent)JSEvents.wheelEvent=_malloc(104);var wheelHandlerFunc=function(ev){var e=ev||event;var wheelEvent=JSEvents.wheelEvent;fillMouseEventData(wheelEvent,e,target);HEAPF64[wheelEvent+72>>3]=e["deltaX"];HEAPF64[wheelEvent+80>>3]=e["deltaY"];HEAPF64[wheelEvent+88>>3]=e["deltaZ"];HEAP32[wheelEvent+96>>2]=e["deltaMode"];if(getWasmTableEntry(callbackfunc)(eventTypeId,wheelEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:wheelHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_wheel_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target=findEventTarget(target);if(typeof target.onwheel!="undefined"){registerWheelEventCallback(target,userData,useCapture,callbackfunc,9,"wheel",targetThread);return 0}else{return-1}}function _emscripten_set_window_title(title){setWindowTitle(UTF8ToString(title))}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}var tempRet0=0;function getTempRet0(){return tempRet0}var _getTempRet0=getTempRet0;function _glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}function _glBindBuffer(target,buffer){if(target==35051){GLctx.currentPixelPackBufferBinding=buffer}else if(target==35052){GLctx.currentPixelUnpackBufferBinding=buffer}GLctx.bindBuffer(target,GL.buffers[buffer])}function _glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}function _glBindVertexArray(vao){GLctx["bindVertexArray"](GL.vaos[vao])}function _glBlendFunc(x0,x1){GLctx["blendFunc"](x0,x1)}function _glBufferData(target,size,data,usage){if(true){if(data&&size){GLctx.bufferData(target,HEAPU8,usage,data,size)}else{GLctx.bufferData(target,size,usage)}}else{GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}}function _glClear(x0){GLctx["clear"](x0)}function _glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}function _glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}function _glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id}function _glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}function _glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null}function _glDeleteShader(id){if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null}function _glDeleteTextures(n,textures){for(var i=0;i>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}function _glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}function _glEnable(x0){GLctx["enable"](x0)}function _glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}function __glGenObject(n,buffers,createFunction,objectTable){for(var i=0;i>2]=id}}function _glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}function _glGenVertexArrays(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}function _glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _glLinkProgram(program){program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}}function computeUnpackAlignedImageSize(width,height,sizePerPixel,alignment){function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=width*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,alignment);return height*alignedRowSize}function __colorChannelsInGlTextureFormat(format){var colorChannels={5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4};return colorChannels[format-6402]||1}function heapObjectForWebGLType(type){type-=5120;if(type==0)return HEAP8;if(type==1)return HEAPU8;if(type==2)return HEAP16;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922||type==28520||type==30779||type==30782)return HEAPU32;return HEAPU16}function heapAccessShiftForWebGLHeap(heap){return 31-Math.clz32(heap.BYTES_PER_ELEMENT)}function emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat){var heap=heapObjectForWebGLType(type);var shift=heapAccessShiftForWebGLHeap(heap);var byteSize=1<>shift,pixels+bytes>>shift)}function _glReadPixels(x,y,width,height,format,type,pixels){if(true){if(GLctx.currentPixelPackBufferBinding){GLctx.readPixels(x,y,width,height,format,type,pixels)}else{var heap=heapObjectForWebGLType(type);GLctx.readPixels(x,y,width,height,format,type,heap,pixels>>heapAccessShiftForWebGLHeap(heap))}return}var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)}function _glShaderSource(shader,count,string,length){var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)}function _glTexImage2D(target,level,internalFormat,width,height,border,format,type,pixels){if(true){if(GLctx.currentPixelUnpackBufferBinding){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels)}else if(pixels){var heap=heapObjectForWebGLType(type);GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,heap,pixels>>heapAccessShiftForWebGLHeap(heap))}else{GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,null)}return}GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null)}function _glTexParameteri(x0,x1,x2){GLctx["texParameteri"](x0,x1,x2)}function _glUseProgram(program){program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program}function _glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}function setTempRet0(val){tempRet0=val}var _setTempRet0=setTempRet0;function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}function uleb128Encode(n,target){if(n<128){target.push(n)}else{target.push(n%128|128,n>>7)}}function sigToWasmTypes(sig){var typeNames={"i":"i32","j":"i64","f":"f32","d":"f64","p":"i32"};var type={parameters:[],results:sig[0]=="v"?[]:[typeNames[sig[0]]]};for(var i=1;i{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run(); diff --git a/C++ProjectTemplate.wasm b/C++ProjectTemplate.wasm deleted file mode 100755 index a059601..0000000 Binary files a/C++ProjectTemplate.wasm and /dev/null differ diff --git a/Path.cpp b/Path.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Path.h b/Path.h deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md deleted file mode 100644 index 0a3a1b9..0000000 --- a/README.md +++ /dev/null @@ -1,33 +0,0 @@ -This repository contains general build scripts and pipelines for all languages that I incorporate in my projects. The goal is to provide an easy retrieval and update system for the project. Each script will be a shell script containing the following template: -```bash - #Short description about what I do - #Language[Folder] - # #The script's code goes in here. - # rm -Rf out/* - # javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java - # printf "\n\n\nRunning Program...\n\n" - # cd $OUT_DIR - # java ${MAIN_CLASS} "$@" - # ../scripts/clean.sh - -``` -Each language will be in the following structure: -``` - - - -- - ---[script files.sh] -``` - -The `sig` script will display by default any scripts in the `scripts` folder, therefore when creating a project, copy over the scripts folder of the desired language into your project then the `sig` script handles the rest appropriately. If your project requires multiple languages and build setups, then you can use the `sig2` command, which has an additional parameter to specify the language when running it. When setting up a multi-language setup, you'll just copy the entire folder to include the programming language itself. So a multi-language project structure may look something like this: -``` - -C - --scripts - ---build.sh - ---clean.sh - ---make.sh - -Java - --scripts - ---build.sh - ---clean.sh - ---jar.sh -``` diff --git a/a.out b/a.out deleted file mode 100755 index aa52613..0000000 Binary files a/a.out and /dev/null differ diff --git a/art/black.png b/art/black.png deleted file mode 100644 index d575b65..0000000 Binary files a/art/black.png and /dev/null differ diff --git a/art/blue.png b/art/blue.png deleted file mode 100644 index b112e38..0000000 Binary files a/art/blue.png and /dev/null differ diff --git a/art/car.png b/art/car.png deleted file mode 100644 index a9b6f27..0000000 Binary files a/art/car.png and /dev/null differ diff --git a/art/cars.png b/art/cars.png deleted file mode 100644 index 9c51e3c..0000000 Binary files a/art/cars.png and /dev/null differ diff --git a/art/grass.png b/art/grass.png deleted file mode 100644 index e2f764c..0000000 Binary files a/art/grass.png and /dev/null differ diff --git a/art/green.png b/art/green.png deleted file mode 100644 index 39f76c4..0000000 Binary files a/art/green.png and /dev/null differ diff --git a/art/hills.png b/art/hills.png deleted file mode 100644 index 22199d9..0000000 Binary files a/art/hills.png and /dev/null differ diff --git a/art/old/car 2.png b/art/old/car 2.png deleted file mode 100644 index d79ba9d..0000000 Binary files a/art/old/car 2.png and /dev/null differ diff --git a/art/old/car0.png b/art/old/car0.png deleted file mode 100644 index 5d61c84..0000000 Binary files a/art/old/car0.png and /dev/null differ diff --git a/art/old/car1.png b/art/old/car1.png deleted file mode 100644 index f2eae77..0000000 Binary files a/art/old/car1.png and /dev/null differ diff --git a/art/old/car2.png b/art/old/car2.png deleted file mode 100644 index 571835f..0000000 Binary files a/art/old/car2.png and /dev/null differ diff --git a/art/old/checker0.png b/art/old/checker0.png deleted file mode 100644 index 162a76f..0000000 Binary files a/art/old/checker0.png and /dev/null differ diff --git a/art/old/curb.png b/art/old/curb.png deleted file mode 100644 index 86b949f..0000000 Binary files a/art/old/curb.png and /dev/null differ diff --git a/art/old/curb0.png b/art/old/curb0.png deleted file mode 100644 index 66ef097..0000000 Binary files a/art/old/curb0.png and /dev/null differ diff --git a/art/old/grass/grass0.png b/art/old/grass/grass0.png deleted file mode 100644 index 5213625..0000000 Binary files a/art/old/grass/grass0.png and /dev/null differ diff --git a/art/old/grass/grass1.png b/art/old/grass/grass1.png deleted file mode 100644 index aa51df4..0000000 Binary files a/art/old/grass/grass1.png and /dev/null differ diff --git a/art/old/grass/grass2.png b/art/old/grass/grass2.png deleted file mode 100644 index f2a50c0..0000000 Binary files a/art/old/grass/grass2.png and /dev/null differ diff --git a/art/old/grass/grass3.png b/art/old/grass/grass3.png deleted file mode 100644 index 5d1ddde..0000000 Binary files a/art/old/grass/grass3.png and /dev/null differ diff --git a/art/old/grass/grass4.png b/art/old/grass/grass4.png deleted file mode 100644 index 79cd8c0..0000000 Binary files a/art/old/grass/grass4.png and /dev/null differ diff --git a/art/old/grass/grass5.png b/art/old/grass/grass5.png deleted file mode 100644 index 1d28751..0000000 Binary files a/art/old/grass/grass5.png and /dev/null differ diff --git a/art/old/road0.png b/art/old/road0.png deleted file mode 100644 index dce172e..0000000 Binary files a/art/old/road0.png and /dev/null differ diff --git a/art/old/road1.png b/art/old/road1.png deleted file mode 100644 index 8069780..0000000 Binary files a/art/old/road1.png and /dev/null differ diff --git a/art/old/title/title 0.png b/art/old/title/title 0.png deleted file mode 100644 index 32f4ad9..0000000 Binary files a/art/old/title/title 0.png and /dev/null differ diff --git a/art/old/title/title 1.png b/art/old/title/title 1.png deleted file mode 100644 index be0c6b5..0000000 Binary files a/art/old/title/title 1.png and /dev/null differ diff --git a/art/old/title/title 2.png b/art/old/title/title 2.png deleted file mode 100644 index 227a866..0000000 Binary files a/art/old/title/title 2.png and /dev/null differ diff --git a/art/old/title/title 2b.png b/art/old/title/title 2b.png deleted file mode 100644 index fd05407..0000000 Binary files a/art/old/title/title 2b.png and /dev/null differ diff --git a/art/old/title/title 3.png b/art/old/title/title 3.png deleted file mode 100644 index e12f161..0000000 Binary files a/art/old/title/title 3.png and /dev/null differ diff --git a/art/old/title/title 3a.png b/art/old/title/title 3a.png deleted file mode 100644 index d58505d..0000000 Binary files a/art/old/title/title 3a.png and /dev/null differ diff --git a/art/old/title/title 3b.png b/art/old/title/title 3b.png deleted file mode 100644 index bdfb612..0000000 Binary files a/art/old/title/title 3b.png and /dev/null differ diff --git a/art/old/title/title 4.png b/art/old/title/title 4.png deleted file mode 100644 index d99ba93..0000000 Binary files a/art/old/title/title 4.png and /dev/null differ diff --git a/art/old/title/title 40%.png b/art/old/title/title 40%.png deleted file mode 100644 index ec3f0f3..0000000 Binary files a/art/old/title/title 40%.png and /dev/null differ diff --git a/art/old/title/title 4b.png b/art/old/title/title 4b.png deleted file mode 100644 index 380d3bf..0000000 Binary files a/art/old/title/title 4b.png and /dev/null differ diff --git a/art/old/title/title 5.png b/art/old/title/title 5.png deleted file mode 100644 index 6d31824..0000000 Binary files a/art/old/title/title 5.png and /dev/null differ diff --git a/art/old/title/title 50%.png b/art/old/title/title 50%.png deleted file mode 100644 index 6670f50..0000000 Binary files a/art/old/title/title 50%.png and /dev/null differ diff --git a/art/old/title/title 5b.png b/art/old/title/title 5b.png deleted file mode 100644 index e9498e7..0000000 Binary files a/art/old/title/title 5b.png and /dev/null differ diff --git a/art/old/title/title 6.png b/art/old/title/title 6.png deleted file mode 100644 index 598cbe0..0000000 Binary files a/art/old/title/title 6.png and /dev/null differ diff --git a/art/old/title/title 7.png b/art/old/title/title 7.png deleted file mode 100644 index 47cbfff..0000000 Binary files a/art/old/title/title 7.png and /dev/null differ diff --git a/art/old/title/title 7b.png b/art/old/title/title 7b.png deleted file mode 100644 index a1cb3ec..0000000 Binary files a/art/old/title/title 7b.png and /dev/null differ diff --git a/art/orange.png b/art/orange.png deleted file mode 100644 index 9c22389..0000000 Binary files a/art/orange.png and /dev/null differ diff --git a/art/purple.png b/art/purple.png deleted file mode 100644 index aa5a6bc..0000000 Binary files a/art/purple.png and /dev/null differ diff --git a/art/red.png b/art/red.png deleted file mode 100644 index a9b6f27..0000000 Binary files a/art/red.png and /dev/null differ diff --git a/art/road.png b/art/road.png deleted file mode 100644 index 92171f4..0000000 Binary files a/art/road.png and /dev/null differ diff --git a/art/start.png b/art/start.png deleted file mode 100644 index 20dccae..0000000 Binary files a/art/start.png and /dev/null differ diff --git a/art/title.png b/art/title.png deleted file mode 100644 index de40d12..0000000 Binary files a/art/title.png and /dev/null differ diff --git a/art/title.psd b/art/title.psd deleted file mode 100644 index 5510105..0000000 Binary files a/art/title.psd and /dev/null differ diff --git a/art/white.png b/art/white.png deleted file mode 100644 index 9701357..0000000 Binary files a/art/white.png and /dev/null differ diff --git a/baseboard.png b/baseboard.png deleted file mode 100644 index 484b491..0000000 Binary files a/baseboard.png and /dev/null differ diff --git a/border.png b/border.png deleted file mode 100644 index 683feb5..0000000 Binary files a/border.png and /dev/null differ diff --git a/buildtemplate.html b/buildtemplate.html deleted file mode 100644 index 7e6698d..0000000 --- a/buildtemplate.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - Emscripten-Generated Code - - - - - - - - - - diff --git a/car.png b/car.png deleted file mode 100644 index 5341b13..0000000 Binary files a/car.png and /dev/null differ diff --git a/circulardevice.png b/circulardevice.png deleted file mode 100644 index 1b0f339..0000000 Binary files a/circulardevice.png and /dev/null differ diff --git a/co2.png b/co2.png deleted file mode 100644 index a9a48aa..0000000 Binary files a/co2.png and /dev/null differ diff --git a/coloredside.png b/coloredside.png deleted file mode 100644 index 7628956..0000000 Binary files a/coloredside.png and /dev/null differ diff --git a/config.hpp b/config.hpp deleted file mode 100644 index 807bae4..0000000 --- a/config.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// The MIT License (MIT) - -// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// This file was generated with a script. -// Generated 2022-10-23 03:24:40.304940 UTC -// This header was generated with sol v3.3.0 (revision 0386513a) -// https://github.com/ThePhD/sol2 - -#ifndef SOL_SINGLE_CONFIG_HPP -#define SOL_SINGLE_CONFIG_HPP - -// beginning of sol/config.hpp - -/* Base, empty configuration file! - - To override, place a file in your include paths of the form: - -. (your include path here) -| sol (directory, or equivalent) - | config.hpp (your config.hpp file) - - So that when sol2 includes the file - -#include - - it gives you the configuration values you desire. Configuration values can be -seen in the safety.rst of the doc/src, or at -https://sol2.readthedocs.io/en/latest/safety.html ! You can also pass them through -the build system, or the command line options of your compiler. - -*/ - -// end of sol/config.hpp - -#endif // SOL_SINGLE_CONFIG_HPP diff --git a/data.lua b/data.lua deleted file mode 100644 index 0da8e6a..0000000 --- a/data.lua +++ /dev/null @@ -1,33 +0,0 @@ -return -{ - Name = "Weapon", -- used for Engine::GetResearch() - offset = {0,0}, - Icon = - { - FileName = "Assets/Research/Icons/WeaponUpgradeIcon.png",--Maybe Have multi_Icon based on lvl of upgrade? - size = {32,32}, - FileSize = {64,64} - }, - Parameters = - { - Oncer = false, --Only get one upgrade - InitialCost = 120, - CostScale = 2, --How Much more it costs per upgrade??? Use Math Equation - ResearchTime = 22 --Seconds - }, - Requirements = - { - Buildings = {"Castle","StoneTower"} - }, - Reward = - { - Stats = - { - Damage = 5, - Armor = 5, - Health = 10, - MoveSpeed= 4 - }, - Unlocks = {"Archer"} - } -} \ No newline at end of file diff --git a/dependentClasses.zip b/dependentClasses.zip deleted file mode 100644 index 207b66d..0000000 Binary files a/dependentClasses.zip and /dev/null differ diff --git a/dirtblock.png b/dirtblock.png deleted file mode 100644 index af8bd91..0000000 Binary files a/dirtblock.png and /dev/null differ diff --git a/forward.hpp b/forward.hpp deleted file mode 100644 index 14bbfc8..0000000 --- a/forward.hpp +++ /dev/null @@ -1,1321 +0,0 @@ -// The MIT License (MIT) - -// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// This file was generated with a script. -// Generated 2022-10-23 03:24:40.299252 UTC -// This header was generated with sol v3.3.0 (revision 0386513a) -// https://github.com/ThePhD/sol2 - -#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP -#define SOL_SINGLE_INCLUDE_FORWARD_HPP - -// beginning of sol/forward.hpp - -#ifndef SOL_FORWARD_HPP -#define SOL_FORWARD_HPP - -// beginning of sol/version.hpp - -#include - -#define SOL_VERSION_MAJOR 3 -#define SOL_VERSION_MINOR 2 -#define SOL_VERSION_PATCH 3 -#define SOL_VERSION_STRING "3.2.3" -#define SOL_VERSION ((SOL_VERSION_MAJOR * 100000) + (SOL_VERSION_MINOR * 100) + (SOL_VERSION_PATCH)) - -#define SOL_TOKEN_TO_STRING_POST_EXPANSION_I_(_TOKEN) #_TOKEN -#define SOL_TOKEN_TO_STRING_I_(_TOKEN) SOL_TOKEN_TO_STRING_POST_EXPANSION_I_(_TOKEN) - -#define SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT) _LEFT##_RIGHT -#define SOL_CONCAT_TOKENS_I_(_LEFT, _RIGHT) SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT) - -#define SOL_RAW_IS_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) != 0) -#define SOL_RAW_IS_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3) == 0) -#define SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) > 3) -#define SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3 OP_SYMBOL 3) < 0) - -#define SOL_IS_ON(OP_SYMBOL) SOL_RAW_IS_ON(OP_SYMBOL ## _I_) -#define SOL_IS_OFF(OP_SYMBOL) SOL_RAW_IS_OFF(OP_SYMBOL ## _I_) -#define SOL_IS_DEFAULT_ON(OP_SYMBOL) SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL ## _I_) -#define SOL_IS_DEFAULT_OFF(OP_SYMBOL) SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL ## _I_) - -#define SOL_ON | -#define SOL_OFF ^ -#define SOL_DEFAULT_ON + -#define SOL_DEFAULT_OFF - - -#if defined(SOL_BUILD_CXX_MODE) - #if (SOL_BUILD_CXX_MODE != 0) - #define SOL_BUILD_CXX_MODE_I_ SOL_ON - #else - #define SOL_BUILD_CXX_MODE_I_ SOL_OFF - #endif -#elif defined(__cplusplus) - #define SOL_BUILD_CXX_MODE_I_ SOL_DEFAULT_ON -#else - #define SOL_BUILD_CXX_MODE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_BUILD_C_MODE) - #if (SOL_BUILD_C_MODE != 0) - #define SOL_BUILD_C_MODE_I_ SOL_ON - #else - #define SOL_BUILD_C_MODE_I_ SOL_OFF - #endif -#elif defined(__STDC__) - #define SOL_BUILD_C_MODE_I_ SOL_DEFAULT_ON -#else - #define SOL_BUILD_C_MODE_I_ SOL_DEFAULT_OFF -#endif - -#if SOL_IS_ON(SOL_BUILD_C_MODE) - #include - #include - #include -#else - #include - #include - #include -#endif - -#if defined(SOL_COMPILER_VCXX) - #if defined(SOL_COMPILER_VCXX != 0) - #define SOL_COMPILER_VCXX_I_ SOL_ON - #else - #define SOL_COMPILER_VCXX_I_ SOL_OFF - #endif -#elif defined(_MSC_VER) - #define SOL_COMPILER_VCXX_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_VCXX_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_GCC) - #if defined(SOL_COMPILER_GCC != 0) - #define SOL_COMPILER_GCC_I_ SOL_ON - #else - #define SOL_COMPILER_GCC_I_ SOL_OFF - #endif -#elif defined(__GNUC__) - #define SOL_COMPILER_GCC_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_GCC_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_CLANG) - #if defined(SOL_COMPILER_CLANG != 0) - #define SOL_COMPILER_CLANG_I_ SOL_ON - #else - #define SOL_COMPILER_CLANG_I_ SOL_OFF - #endif -#elif defined(__clang__) - #define SOL_COMPILER_CLANG_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_CLANG_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_EDG) - #if defined(SOL_COMPILER_EDG != 0) - #define SOL_COMPILER_EDG_I_ SOL_ON - #else - #define SOL_COMPILER_EDG_I_ SOL_OFF - #endif -#else - #define SOL_COMPILER_EDG_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_MINGW) - #if (SOL_COMPILER_MINGW != 0) - #define SOL_COMPILER_MINGW_I_ SOL_ON - #else - #define SOL_COMPILER_MINGW_I_ SOL_OFF - #endif -#elif defined(__MINGW32__) - #define SOL_COMPILER_MINGW_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_MINGW_I_ SOL_DEFAULT_OFF -#endif - -#if SIZE_MAX <= 0xFFFFULL - #define SOL_PLATFORM_X16_I_ SOL_ON - #define SOL_PLATFORM_X86_I_ SOL_OFF - #define SOL_PLATFORM_X64_I_ SOL_OFF -#elif SIZE_MAX <= 0xFFFFFFFFULL - #define SOL_PLATFORM_X16_I_ SOL_OFF - #define SOL_PLATFORM_X86_I_ SOL_ON - #define SOL_PLATFORM_X64_I_ SOL_OFF -#else - #define SOL_PLATFORM_X16_I_ SOL_OFF - #define SOL_PLATFORM_X86_I_ SOL_OFF - #define SOL_PLATFORM_X64_I_ SOL_ON -#endif - -#define SOL_PLATFORM_ARM32_I_ SOL_OFF -#define SOL_PLATFORM_ARM64_I_ SOL_OFF - -#if defined(SOL_PLATFORM_WINDOWS) - #if (SOL_PLATFORM_WINDOWS != 0) - #define SOL_PLATFORM_WINDOWS_I_ SOL_ON - #else - #define SOL_PLATFORM_WINDOWS_I_ SOL_OFF - #endif -#elif defined(_WIN32) - #define SOL_PLATFORM_WINDOWS_I_ SOL_DEFAULT_ON -#else - #define SOL_PLATFORM_WINDOWS_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_CYGWIN) - #if (SOL_PLATFORM_CYGWIN != 0) - #define SOL_PLATFORM_CYGWIN_I_ SOL_ON - #else - #define SOL_PLATFORM_CYGWIN_I_ SOL_ON - #endif -#elif defined(__CYGWIN__) - #define SOL_PLATFORM_CYGWIN_I_ SOL_DEFAULT_ON -#else - #define SOL_PLATFORM_CYGWIN_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_APPLE) - #if (SOL_PLATFORM_APPLE != 0) - #define SOL_PLATFORM_APPLE_I_ SOL_ON - #else - #define SOL_PLATFORM_APPLE_I_ SOL_OFF - #endif -#elif defined(__APPLE__) - #define SOL_PLATFORM_APPLE_I_ SOL_DEFAULT_ON -#else - #define SOL_PLATFORM_APPLE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_UNIX) - #if (SOL_PLATFORM_UNIX != 0) - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_ON - #else - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_OFF - #endif -#elif defined(__unix__) - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_DEFAUKT_ON -#else - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_LINUX) - #if (SOL_PLATFORM_LINUX != 0) - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_ON - #else - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_OFF - #endif -#elif defined(__LINUX__) - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_DEFAUKT_ON -#else - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_DEFAULT_OFF -#endif - -#define SOL_PLATFORM_APPLE_IPHONE_I_ SOL_OFF -#define SOL_PLATFORM_BSDLIKE_I_ SOL_OFF - -#if defined(SOL_IN_DEBUG_DETECTED) - #if SOL_IN_DEBUG_DETECTED != 0 - #define SOL_DEBUG_BUILD_I_ SOL_ON - #else - #define SOL_DEBUG_BUILD_I_ SOL_OFF - #endif -#elif !defined(NDEBUG) - #if SOL_IS_ON(SOL_COMPILER_VCXX) && defined(_DEBUG) - #define SOL_DEBUG_BUILD_I_ SOL_ON - #elif (SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC)) && !defined(__OPTIMIZE__) - #define SOL_DEBUG_BUILD_I_ SOL_ON - #else - #define SOL_DEBUG_BUILD_I_ SOL_OFF - #endif -#else - #define SOL_DEBUG_BUILD_I_ SOL_DEFAULT_OFF -#endif // We are in a debug mode of some sort - -#if defined(SOL_NO_EXCEPTIONS) - #if (SOL_NO_EXCEPTIONS != 0) - #define SOL_EXCEPTIONS_I_ SOL_OFF - #else - #define SOL_EXCEPTIONS_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_VCXX) - #if !defined(_CPPUNWIND) - #define SOL_EXCEPTIONS_I_ SOL_OFF - #else - #define SOL_EXCEPTIONS_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC) - #if !defined(__EXCEPTIONS) - #define SOL_EXCEPTIONS_I_ SOL_OFF - #else - #define SOL_EXCEPTIONS_I_ SOL_ON - #endif -#else - #define SOL_EXCEPTIONS_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_NO_RTTI) - #if (SOL_NO_RTTI != 0) - #define SOL_RTTI_I_ SOL_OFF - #else - #define SOL_RTTI_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_VCXX) - #if !defined(_CPPRTTI) - #define SOL_RTTI_I_ SOL_OFF - #else - #define SOL_RTTI_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC) - #if !defined(__GXX_RTTI) - #define SOL_RTTI_I_ SOL_OFF - #else - #define SOL_RTTI_I_ SOL_ON - #endif -#else - #define SOL_RTTI_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_NO_THREAD_LOCAL) - #if SOL_NO_THREAD_LOCAL != 0 - #define SOL_USE_THREAD_LOCAL_I_ SOL_OFF - #else - #define SOL_USE_THREAD_LOCAL_I_ SOL_ON - #endif -#else - #define SOL_USE_THREAD_LOCAL_I_ SOL_DEFAULT_ON -#endif // thread_local keyword is bjorked on some platforms - -#if defined(SOL_ALL_SAFETIES_ON) - #if SOL_ALL_SAFETIES_ON != 0 - #define SOL_ALL_SAFETIES_ON_I_ SOL_ON - #else - #define SOL_ALL_SAFETIES_ON_I_ SOL_OFF - #endif -#else - #define SOL_ALL_SAFETIES_ON_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_SAFE_GETTER) - #if SOL_SAFE_GETTER != 0 - #define SOL_SAFE_GETTER_I_ SOL_ON - #else - #define SOL_SAFE_GETTER_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_GETTER_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_USERTYPE) - #if SOL_SAFE_USERTYPE != 0 - #define SOL_SAFE_USERTYPE_I_ SOL_ON - #else - #define SOL_SAFE_USERTYPE_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_USERTYPE_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_REFERENCES) - #if SOL_SAFE_REFERENCES != 0 - #define SOL_SAFE_REFERENCES_I_ SOL_ON - #else - #define SOL_SAFE_REFERENCES_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_REFERENCES_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_FUNCTIONS) - #if SOL_SAFE_FUNCTIONS != 0 - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON - #else - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_OFF - #endif -#elif defined (SOL_SAFE_FUNCTION_OBJECTS) - #if SOL_SAFE_FUNCTION_OBJECTS != 0 - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON - #else - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_FUNCTION_CALLS) - #if SOL_SAFE_FUNCTION_CALLS != 0 - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON - #else - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_PROXIES) - #if SOL_SAFE_PROXIES != 0 - #define SOL_SAFE_PROXIES_I_ SOL_ON - #else - #define SOL_SAFE_PROXIES_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_PROXIES_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_NUMERICS) - #if SOL_SAFE_NUMERICS != 0 - #define SOL_SAFE_NUMERICS_I_ SOL_ON - #else - #define SOL_SAFE_NUMERICS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_NUMERICS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_ALL_INTEGER_VALUES_FIT) - #if (SOL_ALL_INTEGER_VALUES_FIT != 0) - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_ON - #else - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_OFF - #endif -#elif !SOL_IS_DEFAULT_OFF(SOL_SAFE_NUMERICS) && SOL_IS_OFF(SOL_SAFE_NUMERICS) - // if numerics is intentionally turned off, flip this on - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_DEFAULT_ON -#else - // default to off - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_SAFE_STACK_CHECK) - #if SOL_SAFE_STACK_CHECK != 0 - #define SOL_SAFE_STACK_CHECK_I_ SOL_ON - #else - #define SOL_SAFE_STACK_CHECK_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_STACK_CHECK_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_NO_CHECK_NUMBER_PRECISION) - #if SOL_NO_CHECK_NUMBER_PRECISION != 0 - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF - #else - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #endif -#elif defined(SOL_NO_CHECKING_NUMBER_PRECISION) - #if SOL_NO_CHECKING_NUMBER_PRECISION != 0 - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF - #else - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #elif SOL_IS_ON(SOL_SAFE_NUMERICS) - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_ON - #else - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_STRINGS_ARE_NUMBERS) - #if (SOL_STRINGS_ARE_NUMBERS != 0) - #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_ON - #else - #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_OFF - #endif -#else - #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_ENABLE_INTEROP) - #if SOL_ENABLE_INTEROP != 0 - #define SOL_USE_INTEROP_I_ SOL_ON - #else - #define SOL_USE_INTEROP_I_ SOL_OFF - #endif -#elif defined(SOL_USE_INTEROP) - #if SOL_USE_INTEROP != 0 - #define SOL_USE_INTEROP_I_ SOL_ON - #else - #define SOL_USE_INTEROP_I_ SOL_OFF - #endif -#else - #define SOL_USE_INTEROP_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_NO_NIL) - #if (SOL_NO_NIL != 0) - #define SOL_NIL_I_ SOL_OFF - #else - #define SOL_NIL_I_ SOL_ON - #endif -#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil) - #define SOL_NIL_I_ SOL_DEFAULT_OFF -#else - #define SOL_NIL_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_USERTYPE_TYPE_BINDING_INFO) - #if (SOL_USERTYPE_TYPE_BINDING_INFO != 0) - #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_ON - #else - #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_OFF - #endif -#else - #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_DEFAULT_ON -#endif // We should generate a my_type.__type table with lots of class information for usertypes - -#if defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT) - #if (SOL_AUTOMAGICAL_TYPES_BY_DEFAULT != 0) - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON - #else - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF - #endif -#elif defined(SOL_DEFAULT_AUTOMAGICAL_USERTYPES) - #if (SOL_DEFAULT_AUTOMAGICAL_USERTYPES != 0) - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON - #else - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF - #endif -#else - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_DEFAULT_ON -#endif // make is_automagical on/off by default - -#if defined(SOL_STD_VARIANT) - #if (SOL_STD_VARIANT != 0) - #define SOL_STD_VARIANT_I_ SOL_ON - #else - #define SOL_STD_VARIANT_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_COMPILER_CLANG) && SOL_IS_ON(SOL_PLATFORM_APPLE) - #if defined(__has_include) - #if __has_include() - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON - #else - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_OFF - #endif - #else - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_OFF - #endif - #else - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON - #endif -#endif // make is_automagical on/off by default - -#if defined(SOL_NOEXCEPT_FUNCTION_TYPE) - #if (SOL_NOEXCEPT_FUNCTION_TYPE != 0) - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON - #else - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF - #endif -#else - #if defined(__cpp_noexcept_function_type) - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON - #elif SOL_IS_ON(SOL_COMPILER_VCXX) && (defined(_MSVC_LANG) && (_MSVC_LANG < 201403L)) - // There is a bug in the VC++ compiler?? - // on /std:c++latest under x86 conditions (VS 15.5.2), - // compiler errors are tossed for noexcept markings being on function types - // that are identical in every other way to their non-noexcept marked types function types... - // VS 2019: There is absolutely a bug. - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF - #else - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_DEFAULT_ON - #endif -#endif // noexcept is part of a function's type - -#if defined(SOL_STACK_STRING_OPTIMIZATION_SIZE) && SOL_STACK_STRING_OPTIMIZATION_SIZE > 0 - #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ SOL_STACK_STRING_OPTIMIZATION_SIZE -#else - #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ 1024 -#endif - -#if defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 - #define SOL_ID_SIZE_I_ SOL_ID_SIZE -#else - #define SOL_ID_SIZE_I_ 512 -#endif - -#if defined(LUA_IDSIZE) && LUA_IDSIZE > 0 - #define SOL_FILE_ID_SIZE_I_ LUA_IDSIZE -#elif defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 - #define SOL_FILE_ID_SIZE_I_ SOL_FILE_ID_SIZE -#else - #define SOL_FILE_ID_SIZE_I_ 2048 -#endif - -#if defined(SOL_PRINT_ERRORS) - #if (SOL_PRINT_ERRORS != 0) - #define SOL_PRINT_ERRORS_I_ SOL_ON - #else - #define SOL_PRINT_ERRORS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_PRINT_ERRORS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_PRINT_ERRORS_I_ SOL_DEFAULT_ON - #else - #define SOL_PRINT_ERRORS_I_ SOL_OFF - #endif -#endif - -#if defined(SOL_DEFAULT_PASS_ON_ERROR) - #if (SOL_DEFAULT_PASS_ON_ERROR != 0) - #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_ON - #else - #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_OFF - #endif -#else - #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_USING_CXX_LUA) - #if (SOL_USING_CXX_LUA != 0) - #define SOL_USE_CXX_LUA_I_ SOL_ON - #else - #define SOL_USE_CXX_LUA_I_ SOL_OFF - #endif -#elif defined(SOL_USE_CXX_LUA) - #if (SOL_USE_CXX_LUA != 0) - #define SOL_USE_CXX_LUA_I_ SOL_ON - #else - #define SOL_USE_CXX_LUA_I_ SOL_OFF - #endif -#else - #define SOL_USE_CXX_LUA_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_USING_CXX_LUAJIT) - #if (SOL_USING_CXX_LUA != 0) - #define SOL_USE_CXX_LUAJIT_I_ SOL_ON - #else - #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF - #endif -#elif defined(SOL_USE_CXX_LUAJIT) - #if (SOL_USE_CXX_LUA != 0) - #define SOL_USE_CXX_LUAJIT_I_ SOL_ON - #else - #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF - #endif -#else - #define SOL_USE_CXX_LUAJIT_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_NO_LUA_HPP) - #if (SOL_NO_LUA_HPP != 0) - #define SOL_USE_LUA_HPP_I_ SOL_OFF - #else - #define SOL_USE_LUA_HPP_I_ SOL_ON - #endif -#elif defined(SOL_USING_CXX_LUA) - #define SOL_USE_LUA_HPP_I_ SOL_OFF -#elif defined(__has_include) - #if __has_include() - #define SOL_USE_LUA_HPP_I_ SOL_ON - #else - #define SOL_USE_LUA_HPP_I_ SOL_OFF - #endif -#else - #define SOL_USE_LUA_HPP_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_CONTAINERS_START) - #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START -#elif defined(SOL_CONTAINERS_START_INDEX) - #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START_INDEX -#elif defined(SOL_CONTAINER_START_INDEX) - #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINER_START_INDEX -#else - #define SOL_CONTAINER_START_INDEX_I_ 1 -#endif - -#if defined (SOL_NO_MEMORY_ALIGNMENT) - #if (SOL_NO_MEMORY_ALIGNMENT != 0) - #define SOL_ALIGN_MEMORY_I_ SOL_OFF - #else - #define SOL_ALIGN_MEMORY_I_ SOL_ON - #endif -#else - #define SOL_ALIGN_MEMORY_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_USE_BOOST) - #if (SOL_USE_BOOST != 0) - #define SOL_USE_BOOST_I_ SOL_ON - #else - #define SOL_USE_BOOST_I_ SOL_OFF - #endif -#else - #define SOL_USE_BOOST_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_USE_UNSAFE_BASE_LOOKUP) - #if (SOL_USE_UNSAFE_BASE_LOOKUP != 0) - #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_ON - #else - #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_OFF - #endif -#else - #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_INSIDE_UNREAL) - #if (SOL_INSIDE_UNREAL != 0) - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_ON - #else - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_OFF - #endif -#else - #if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_SERVER) - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_ON - #else - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_NO_COMPAT) - #if (SOL_NO_COMPAT != 0) - #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_OFF - #else - #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_ON - #endif -#else - #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_GET_FUNCTION_POINTER_UNSAFE) - #if (SOL_GET_FUNCTION_POINTER_UNSAFE != 0) - #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_ON - #else - #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_OFF - #endif -#else - #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_FUNCTION_CALL_VALUE_SEMANTICS) - #if (SOL_FUNCTION_CALL_VALUE_SEMANTICS != 0) - #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_ON - #else - #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_OFF - #endif -#else - #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_MINGW_CCTYPE_IS_POISONED) - #if (SOL_MINGW_CCTYPE_IS_POISONED != 0) - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_ON - #else - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_OFF - #endif -#elif SOL_IS_ON(SOL_COMPILER_MINGW) && defined(__GNUC__) && (__GNUC__ < 6) - // MinGW is off its rocker in some places... - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_ON -#else - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_CHAR8_T) - #if (SOL_CHAR8_T != 0) - #define SOL_CHAR8_T_I_ SOL_ON - #else - #define SOL_CHAR8_T_I_ SOL_OFF - #endif -#else - #if defined(__cpp_char8_t) - #define SOL_CHAR8_T_I_ SOL_DEFAULT_ON - #else - #define SOL_CHAR8_T_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if SOL_IS_ON(SOL_USE_BOOST) - #include - - #if BOOST_VERSION >= 107500 // Since Boost 1.75.0 boost::none is constexpr - #define SOL_BOOST_NONE_CONSTEXPR_I_ constexpr - #else - #define SOL_BOOST_NONE_CONSTEXPR_I_ const - #endif // BOOST_VERSION -#else - // assume boost isn't using a garbage version - #define SOL_BOOST_NONE_CONSTEXPR_I_ constexpr -#endif - -#if defined(SOL2_CI) - #if (SOL2_CI != 0) - #define SOL2_CI_I_ SOL_ON - #else - #define SOL2_CI_I_ SOL_OFF - #endif -#else - #define SOL2_CI_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_C_ASSERT) - #define SOL_USER_C_ASSERT_I_ SOL_ON -#else - #define SOL_USER_C_ASSERT_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_M_ASSERT) - #define SOL_USER_M_ASSERT_I_ SOL_ON -#else - #define SOL_USER_M_ASSERT_I_ SOL_DEFAULT_OFF -#endif - -// beginning of sol/prologue.hpp - -#if defined(SOL_PROLOGUE_I_) - #error "[sol2] Library Prologue was already included in translation unit and not properly ended with an epilogue." -#endif - -#define SOL_PROLOGUE_I_ 1 - -#if SOL_IS_ON(SOL_BUILD_CXX_MODE) - #define _FWD(...) static_cast( __VA_ARGS__ ) - - #if SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define _MOVE(...) static_cast<__typeof( __VA_ARGS__ )&&>( __VA_ARGS__ ) - #else - #include - - #define _MOVE(...) static_cast<::std::remove_reference_t<( __VA_ARGS__ )>&&>( __VA_OPT__(,) ) - #endif -#endif - -// end of sol/prologue.hpp - -// beginning of sol/epilogue.hpp - -#if !defined(SOL_PROLOGUE_I_) - #error "[sol2] Library Prologue is missing from this translation unit." -#else - #undef SOL_PROLOGUE_I_ -#endif - -#if SOL_IS_ON(SOL_BUILD_CXX_MODE) - #undef _FWD - #undef _MOVE -#endif - -// end of sol/epilogue.hpp - -// beginning of sol/detail/build_version.hpp - -#if defined(SOL_DLL) - #if (SOL_DLL != 0) - #define SOL_DLL_I_ SOL_ON - #else - #define SOL_DLL_I_ SOL_OFF - #endif -#elif SOL_IS_ON(SOL_COMPILER_VCXX) && (defined(DLL_) || defined(_DLL)) - #define SOL_DLL_I_ SOL_DEFAULT_ON -#else - #define SOL_DLL_I_ SOL_DEFAULT_OFF -#endif // DLL definition - -#if defined(SOL_HEADER_ONLY) - #if (SOL_HEADER_ONLY != 0) - #define SOL_HEADER_ONLY_I_ SOL_ON - #else - #define SOL_HEADER_ONLY_I_ SOL_OFF - #endif -#else - #define SOL_HEADER_ONLY_I_ SOL_DEFAULT_OFF -#endif // Header only library - -#if defined(SOL_BUILD) - #if (SOL_BUILD != 0) - #define SOL_BUILD_I_ SOL_ON - #else - #define SOL_BUILD_I_ SOL_OFF - #endif -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_BUILD_I_ SOL_DEFAULT_OFF -#else - #define SOL_BUILD_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_UNITY_BUILD) - #if (SOL_UNITY_BUILD != 0) - #define SOL_UNITY_BUILD_I_ SOL_ON - #else - #define SOL_UNITY_BUILD_I_ SOL_OFF - #endif -#else - #define SOL_UNITY_BUILD_I_ SOL_DEFAULT_OFF -#endif // Header only library - -#if defined(SOL_C_FUNCTION_LINKAGE) - #define SOL_C_FUNCTION_LINKAGE_I_ SOL_C_FUNCTION_LINKAGE -#else - #if SOL_IS_ON(SOL_BUILD_CXX_MODE) - // C++ - #define SOL_C_FUNCTION_LINKAGE_I_ extern "C" - #else - // normal - #define SOL_C_FUNCTION_LINKAGE_I_ - #endif // C++ or not -#endif // Linkage specification for C functions - -#if defined(SOL_API_LINKAGE) - #define SOL_API_LINKAGE_I_ SOL_API_LINKAGE -#else - #if SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) || SOL_IS_ON(SOL_PLATFORM_WINDOWS) || SOL_IS_ON(SOL_PLATFORM_CYGWIN) - // MSVC Compiler; or, Windows, or Cygwin platforms - #if SOL_IS_ON(SOL_BUILD) - // Building the library - #if SOL_IS_ON(SOL_COMPILER_GCC) - // Using GCC - #define SOL_API_LINKAGE_I_ __attribute__((dllexport)) - #else - // Using Clang, MSVC, etc... - #define SOL_API_LINKAGE_I_ __declspec(dllexport) - #endif - #else - #if SOL_IS_ON(SOL_COMPILER_GCC) - #define SOL_API_LINKAGE_I_ __attribute__((dllimport)) - #else - #define SOL_API_LINKAGE_I_ __declspec(dllimport) - #endif - #endif - #else - // extern if building normally on non-MSVC - #define SOL_API_LINKAGE_I_ extern - #endif - #elif SOL_IS_ON(SOL_UNITY_BUILD) - // Built-in library, like how stb typical works - #if SOL_IS_ON(SOL_HEADER_ONLY) - // Header only, so functions are defined "inline" - #define SOL_API_LINKAGE_I_ inline - #else - // Not header only, so seperately compiled files - #define SOL_API_LINKAGE_I_ extern - #endif - #else - // Normal static library - #if SOL_IS_ON(SOL_BUILD_CXX_MODE) - #define SOL_API_LINKAGE_I_ - #else - #define SOL_API_LINKAGE_I_ extern - #endif - #endif // DLL or not -#endif // Build definitions - -#if defined(SOL_PUBLIC_FUNC_DECL) - #define SOL_PUBLIC_FUNC_DECL_I_ SOL_PUBLIC_FUNC_DECL -#else - #define SOL_PUBLIC_FUNC_DECL_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_INTERNAL_FUNC_DECL_) - #define SOL_INTERNAL_FUNC_DECL_I_ SOL_INTERNAL_FUNC_DECL_ -#else - #define SOL_INTERNAL_FUNC_DECL_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_PUBLIC_FUNC_DEF) - #define SOL_PUBLIC_FUNC_DEF_I_ SOL_PUBLIC_FUNC_DEF -#else - #define SOL_PUBLIC_FUNC_DEF_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_INTERNAL_FUNC_DEF) - #define SOL_INTERNAL_FUNC_DEF_I_ SOL_INTERNAL_FUNC_DEF -#else - #define SOL_INTERNAL_FUNC_DEF_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_FUNC_DECL) - #define SOL_FUNC_DECL_I_ SOL_FUNC_DECL -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_FUNC_DECL_I_ -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_FUNC_DECL_I_ extern __declspec(dllexport) - #else - #define SOL_FUNC_DECL_I_ extern __declspec(dllimport) - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_FUNC_DECL_I_ extern __attribute__((visibility("default"))) - #else - #define SOL_FUNC_DECL_I_ extern - #endif -#endif - -#if defined(SOL_FUNC_DEFN) - #define SOL_FUNC_DEFN_I_ SOL_FUNC_DEFN -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_FUNC_DEFN_I_ inline -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_FUNC_DEFN_I_ __declspec(dllexport) - #else - #define SOL_FUNC_DEFN_I_ __declspec(dllimport) - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_FUNC_DEFN_I_ __attribute__((visibility("default"))) - #else - #define SOL_FUNC_DEFN_I_ - #endif -#endif - -#if defined(SOL_HIDDEN_FUNC_DECL) - #define SOL_HIDDEN_FUNC_DECL_I_ SOL_HIDDEN_FUNC_DECL -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_HIDDEN_FUNC_DECL_I_ -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_HIDDEN_FUNC_DECL_I_ extern __declspec(dllexport) - #else - #define SOL_HIDDEN_FUNC_DECL_I_ extern __declspec(dllimport) - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_HIDDEN_FUNC_DECL_I_ extern __attribute__((visibility("default"))) - #else - #define SOL_HIDDEN_FUNC_DECL_I_ extern - #endif -#endif - -#if defined(SOL_HIDDEN_FUNC_DEFN) - #define SOL_HIDDEN_FUNC_DEFN_I_ SOL_HIDDEN_FUNC_DEFN -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_HIDDEN_FUNC_DEFN_I_ inline -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_HIDDEN_FUNC_DEFN_I_ - #else - #define SOL_HIDDEN_FUNC_DEFN_I_ - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_HIDDEN_FUNC_DEFN_I_ __attribute__((visibility("hidden"))) - #else - #define SOL_HIDDEN_FUNC_DEFN_I_ - #endif -#endif - -// end of sol/detail/build_version.hpp - -// end of sol/version.hpp - -#include -#include -#include - -#if SOL_IS_ON(SOL_USE_CXX_LUA) || SOL_IS_ON(SOL_USE_CXX_LUAJIT) -struct lua_State; -#else -extern "C" { -struct lua_State; -} -#endif // C++ Mangling for Lua vs. Not - -namespace sol { - - enum class type; - - class stateless_reference; - template - class basic_reference; - using reference = basic_reference; - using main_reference = basic_reference; - class stateless_stack_reference; - class stack_reference; - - template - class basic_bytecode; - - struct lua_value; - - struct proxy_base_tag; - template - struct proxy_base; - template - struct table_proxy; - - template - class basic_table_core; - template - using table_core = basic_table_core; - template - using main_table_core = basic_table_core; - template - using stack_table_core = basic_table_core; - template - using basic_table = basic_table_core; - using table = table_core; - using global_table = table_core; - using main_table = main_table_core; - using main_global_table = main_table_core; - using stack_table = stack_table_core; - using stack_global_table = stack_table_core; - - template - struct basic_lua_table; - using lua_table = basic_lua_table; - using stack_lua_table = basic_lua_table; - - template - class basic_usertype; - template - using usertype = basic_usertype; - template - using stack_usertype = basic_usertype; - - template - class basic_metatable; - using metatable = basic_metatable; - using stack_metatable = basic_metatable; - - template - struct basic_environment; - using environment = basic_environment; - using main_environment = basic_environment; - using stack_environment = basic_environment; - - template - class basic_function; - template - class basic_protected_function; - using unsafe_function = basic_function; - using safe_function = basic_protected_function; - using main_unsafe_function = basic_function; - using main_safe_function = basic_protected_function; - using stack_unsafe_function = basic_function; - using stack_safe_function = basic_protected_function; - using stack_aligned_unsafe_function = basic_function; - using stack_aligned_safe_function = basic_protected_function; - using protected_function = safe_function; - using main_protected_function = main_safe_function; - using stack_protected_function = stack_safe_function; - using stack_aligned_protected_function = stack_aligned_safe_function; -#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS) - using function = protected_function; - using main_function = main_protected_function; - using stack_function = stack_protected_function; - using stack_aligned_function = stack_aligned_safe_function; -#else - using function = unsafe_function; - using main_function = main_unsafe_function; - using stack_function = stack_unsafe_function; - using stack_aligned_function = stack_aligned_unsafe_function; -#endif - using stack_aligned_stack_handler_function = basic_protected_function; - - struct unsafe_function_result; - struct protected_function_result; - using safe_function_result = protected_function_result; -#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS) - using function_result = safe_function_result; -#else - using function_result = unsafe_function_result; -#endif - - template - class basic_object_base; - template - class basic_object; - template - class basic_userdata; - template - class basic_lightuserdata; - template - class basic_coroutine; - template - class basic_packaged_coroutine; - template - class basic_thread; - - using object = basic_object; - using userdata = basic_userdata; - using lightuserdata = basic_lightuserdata; - using thread = basic_thread; - using coroutine = basic_coroutine; - using packaged_coroutine = basic_packaged_coroutine; - using main_object = basic_object; - using main_userdata = basic_userdata; - using main_lightuserdata = basic_lightuserdata; - using main_coroutine = basic_coroutine; - using stack_object = basic_object; - using stack_userdata = basic_userdata; - using stack_lightuserdata = basic_lightuserdata; - using stack_thread = basic_thread; - using stack_coroutine = basic_coroutine; - - struct stack_proxy_base; - struct stack_proxy; - struct variadic_args; - struct variadic_results; - struct stack_count; - struct this_state; - struct this_main_state; - struct this_environment; - - class state_view; - class state; - - template - struct as_table_t; - template - struct as_container_t; - template - struct nested; - template - struct light; - template - struct user; - template - struct as_args_t; - template - struct protect_t; - template - struct policy_wrapper; - - template - struct usertype_traits; - template - struct unique_usertype_traits; - - template - struct types { - typedef std::make_index_sequence indices; - static constexpr std::size_t size() { - return sizeof...(Args); - } - }; - - template - struct derive : std::false_type { - typedef types<> type; - }; - - template - struct base : std::false_type { - typedef types<> type; - }; - - template - struct weak_derive { - static bool value; - }; - - template - bool weak_derive::value = false; - - namespace stack { - struct record; - } - -#if SOL_IS_OFF(SOL_USE_BOOST) - template - class optional; - - template - class optional; -#endif - - using check_handler_type = int(lua_State*, int, type, type, const char*); - -} // namespace sol - -#define SOL_BASE_CLASSES(T, ...) \ - namespace sol { \ - template <> \ - struct base : std::true_type { \ - typedef ::sol::types<__VA_ARGS__> type; \ - }; \ - } \ - void a_sol3_detail_function_decl_please_no_collide() -#define SOL_DERIVED_CLASSES(T, ...) \ - namespace sol { \ - template <> \ - struct derive : std::true_type { \ - typedef ::sol::types<__VA_ARGS__> type; \ - }; \ - } \ - void a_sol3_detail_function_decl_please_no_collide() - -#endif // SOL_FORWARD_HPP -// end of sol/forward.hpp - -#endif // SOL_SINGLE_INCLUDE_FORWARD_HPP diff --git a/grass.png b/grass.png deleted file mode 100644 index 3212025..0000000 Binary files a/grass.png and /dev/null differ diff --git a/hills.png b/hills.png deleted file mode 100644 index 1101b9f..0000000 Binary files a/hills.png and /dev/null differ diff --git a/lightup.png b/lightup.png deleted file mode 100644 index 5afa324..0000000 Binary files a/lightup.png and /dev/null differ diff --git a/main.cpp b/main.cpp index 8ab7e53..114be03 100644 --- a/main.cpp +++ b/main.cpp @@ -1,11 +1,36 @@ #define OLC_PGE_APPLICATION -#include "pixelGameEngine.h" -#include "olcutils.h" +#include "olcPixelGameEngine.h" -using namespace olc; +enum state{ + TITLE_SCREEN, + RUNNING_GAME, + WIN_GAME, + LOSE_GAME +}; class Example : public olc::PixelGameEngine { + float ballx = 200; + float bally = 200; + float ballXSpd = -80; + float ballYSpd = 80; + float ballRadius = 10; + + float paddlex = 20; + float paddley; + float paddleWidth = 30; + float paddleHeight = 100; + + float enemyPaddleX = 20; + float enemyPaddleY; + float enemyPaddleWidth = 30; + float enemyPaddleHeight = 100; + + int playerScore = 0; + int enemyScore = 0; + + state GameState = TITLE_SCREEN; + public: Example() { @@ -13,67 +38,183 @@ public: } public: - bool RayVsRect(const vf2d ray_origin, const vf2d ray_dir, const olc::utils::geom2d::rect target, vf2d&contact_point, vf2d&contact_normal, float&t_hit_near){ - - contact_normal = { 0, 0 }; - contact_point = { 0, 0 }; - - vf2d t_near = {(target.pos.x - ray_origin.x) / ray_dir.x, (target.pos.y - ray_origin.y) / ray_dir.y}; - vf2d t_far = {(target.pos.x + target.size.x - ray_origin.x) / ray_dir.x, (target.pos.y + target.size.y - ray_origin.y) / ray_dir.y}; - - if (t_near.x > t_far.x) {float b; b = t_near.x; t_near.x = t_far.x; t_far.x = b;}; - if (t_near.y > t_far.y) {float b; b = t_near.y; t_near.y = t_far.y; t_far.y = b;}; - - if (t_near.x > t_far.y || t_near.y > t_far.x) return false; - - t_hit_near = fmax(t_near.x, t_near.y); - float t_hit_far = fmin(t_far.x, t_far.y); - - if (t_hit_far < 0) return false; - - contact_point.x = ray_origin.x + t_hit_near * ray_dir.x; - contact_point.y = ray_origin.y + t_hit_near * ray_dir.y; - - if (t_near.x > t_near.y) - if ( 1.0f / ray_dir.x < 0) - contact_normal = { 1, 0 }; - else - contact_normal = { -1, 0}; - else - if ( t_near.x < t_near.y) - if ( 1.0f / ray_dir.y < 0) - contact_normal = { 0, 1 }; - else - contact_normal = { 0, -1 }; - - return true; - - - } - vf2d originPoint={16,16}; bool OnUserCreate() override { // Called once at the start, so create things here + + paddley = ScreenHeight()/2; + enemyPaddleX = ScreenWidth()-20; + enemyPaddleY = ScreenHeight()/2; + + srand(time(NULL)); + return true; } bool OnUserUpdate(float fElapsedTime) override { - vf2d velocity={(GetKey(D).bHeld-GetKey(A).bHeld)*20*fElapsedTime,(GetKey(S).bHeld-GetKey(W).bHeld)*20*fElapsedTime}; - vf2d contact_point; - vf2d contact_normal; - float t_hit_near; - - Clear(Pixel(64,64,255)); - if (!olc::utils::geom2d::overlaps(olc::utils::geom2d::circle{originPoint+velocity,5},olc::utils::geom2d::rect{{32,32},{64,32}})) { - originPoint+=velocity; - DrawCircle(originPoint,5); - } else { - DrawCircle(originPoint,5,RED); - } - DrawLine(originPoint,GetMousePos()); - - DrawRect({32,32},{64,32},RayVsRect(originPoint, GetMousePos()-originPoint, olc::utils::geom2d::rect{{32,32},{64,32}},contact_point,contact_normal,t_hit_near)&&t_hit_near<1?YELLOW:WHITE); + // called once per frame + + Clear(olc::VERY_DARK_GREY); + + if (GameState == TITLE_SCREEN) { + std::string titleText = "PONG"; + std::string spacebarText = "Press to Begin!"; + + DrawString(ScreenWidth() / 2 - GetTextSize(titleText).x/2*6, 80 - GetTextSize(titleText).y/2*6, titleText, olc::BLACK, 6); + DrawString(ScreenWidth() / 2 - GetTextSize(spacebarText).x/2*3, 240 - GetTextSize(spacebarText).y/2*3, spacebarText, olc::BLACK, 3); + + if (GetKey(olc::SPACE).bPressed) { + GameState = RUNNING_GAME; + playerScore = 0; + enemyScore = 0; + } + } else + if (GameState == WIN_GAME) { + Clear(olc::DARK_BLUE); + std::string winText = "YOU WIN!"; + std::string spacebarText = "Press to Play Again!"; + + DrawString(ScreenWidth() / 2 - GetTextSize(winText).x/2*6, 80 - GetTextSize(winText).y/2*6, winText, olc::WHITE, 6); + DrawString(ScreenWidth() / 2 - GetTextSize(spacebarText).x/2*2, 240 - GetTextSize(spacebarText).y/2*2, spacebarText, olc::WHITE, 2); + + if (GetKey(olc::SPACE).bPressed) { + GameState = TITLE_SCREEN; + } + } else + if (GameState == LOSE_GAME) { + Clear(olc::DARK_RED); + std::string loseText = "YOU LOSE!"; + std::string spacebarText = "Press to Play Again!"; + + DrawString(ScreenWidth() / 2 - GetTextSize(loseText).x/2*6, 80 - GetTextSize(loseText).y/2*6, loseText, olc::WHITE, 6); + DrawString(ScreenWidth() / 2 - GetTextSize(spacebarText).x/2*2, 240 - GetTextSize(spacebarText).y/2*2, spacebarText, olc::WHITE, 2); + + if (GetKey(olc::SPACE).bPressed) { + GameState = TITLE_SCREEN; + } + } else + if (GameState == RUNNING_GAME) { + + ballx += ballXSpd * fElapsedTime; // move the ball horizontally + bally += ballYSpd * fElapsedTime; // move the ball vertically + + //Related to Ball Horizontal Collision Checking + float ballLeft = ballx - ballRadius; + float ballRight = ballx + ballRadius; + float paddleRight = paddlex + paddleWidth/2; + float enemyPaddleLeft = enemyPaddleX - enemyPaddleWidth/2; + + //Related to Ball Vertical Collision Checking + float ballTop = bally - ballRadius; + float ballBottom = bally + ballRadius; + float paddleTop = paddley - paddleHeight/2; + float paddleBottom = paddley + paddleHeight/2; + float enemyPaddleTop = enemyPaddleY - enemyPaddleHeight/2; + float enemyPaddleBottom = enemyPaddleY + enemyPaddleHeight/2; + + if ( + ballLeft < paddleRight && + ballTop < paddleBottom && + ballBottom > paddleTop + ) { //If the ball collides with the paddle. + ballXSpd *= -1.1; + ballYSpd *= 1.1; + ballx=paddleRight+ballRadius; + } + + if ( + ballRight > enemyPaddleLeft && + ballTop < enemyPaddleBottom && + ballBottom > enemyPaddleTop + ) { //If the ball collides with the paddle. + ballXSpd *= -1.1; + ballYSpd *= 1.1; + ballx=enemyPaddleLeft-ballRadius; + } + + if (ballBottom > ScreenHeight()) { //If the ball touches the bottom edge, reverse its Y direction. + ballYSpd *= -1; + bally = ScreenHeight()-ballRadius; + } + if ( //If the ball touches the top edge, reverse its Y direction. + ballTop < 0 + ) { + ballYSpd *= -1; + bally = ballRadius; + } + + if (ballRight > ScreenWidth()) { //If the ball touches the right edge, award a point to the player. + playerScore += 1; + ballx = ScreenWidth()/2; + bally = ScreenHeight()/2; + + ballXSpd = 80; + ballYSpd = 80; + + int randomNumber = rand() % 2; //Get a random number that is 0 or 1. + if (randomNumber == 0) { + ballXSpd *= -1; + } + + randomNumber = rand() % 2; + if (randomNumber == 0) { + ballYSpd *= -1; + } + } + if (ballLeft < 0) { //If the ball touches the left edge, award a point to the enemy. + enemyScore += 1; + ballx = ScreenWidth()/2; + bally = ScreenHeight()/2; + + ballXSpd = 80; + ballYSpd = 80; + + int randomNumber = rand() % 2; //Get a random number that is 0 or 1. + if (randomNumber == 0) { + ballXSpd *= -1; + } + + randomNumber = rand() % 2; + if (randomNumber == 0) { + ballYSpd *= -1; + } + } + + if (GetKey(olc::UP).bHeld) { + paddley -= 120 * fElapsedTime; //move the paddle up at 120 pixels / s + } + if (GetKey(olc::DOWN).bHeld) { + paddley += 120 * fElapsedTime; //move the paddle down at 120 pixels / s + } + + if (bally < enemyPaddleY) { + enemyPaddleY -= 100 * fElapsedTime; + } + if (bally > enemyPaddleY) { + enemyPaddleY += 100 * fElapsedTime; + } + + if (playerScore >= 5) { + GameState = WIN_GAME; + } + if (enemyScore >= 5) { + GameState = LOSE_GAME; + } + + + DrawCircle(ballx,bally,ballRadius,olc::YELLOW); + FillRect(paddlex - paddleWidth/2, paddley - paddleHeight/2, paddleWidth, paddleHeight, olc::GREEN); //Draw a paddle centered at the paddle position. + FillRect(enemyPaddleX - enemyPaddleWidth/2, enemyPaddleY - enemyPaddleHeight/2, enemyPaddleWidth, enemyPaddleHeight, olc::DARK_RED); //Draw a paddle centered at the paddle position. + + DrawString(30,30,std::to_string(playerScore),olc::WHITE,4); + + std::string enemyScoreText = std::to_string(enemyScore); + + DrawString(ScreenWidth() - 30 - GetTextSize(enemyScoreText).x*4 , 30, enemyScoreText,olc::WHITE, 4); + + } + return true; } }; @@ -82,7 +223,7 @@ public: int main() { Example demo; - if (demo.Construct(128, 120, 8, 8)) + if (demo.Construct(640, 480, 4, 4)) demo.Start(); return 0; diff --git a/pixelGameEngine.h b/olcPixelGameEngine.h similarity index 100% rename from pixelGameEngine.h rename to olcPixelGameEngine.h diff --git a/olcutils.h b/olcutils.h deleted file mode 100644 index 4d7e9d7..0000000 --- a/olcutils.h +++ /dev/null @@ -1,1024 +0,0 @@ -/* - OneLoneCoder - Geometry 2D v1.00 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - A collection of 2D Geometric primitives and functions to work with - and between them. - - - License (OLC-3) - ~~~~~~~~~~~~~~~ - - Copyright 2018 - 2022 OneLoneCoder.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions or derivations of source code must retain the above - copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions or derivative works in binary form must reproduce - the above copyright notice. This list of conditions and the following - disclaimer must be reproduced in the documentation and/or other - materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Links - ~~~~~ - YouTube: https://www.youtube.com/javidx9 - Discord: https://discord.gg/WhwHUMV - Twitter: https://www.twitter.com/javidx9 - Twitch: https://www.twitch.tv/javidx9 - GitHub: https://www.github.com/onelonecoder - Homepage: https://www.onelonecoder.com - - Author - ~~~~~~ - David Barr, aka javidx9, �OneLoneCoder 2019, 2020, 2021, 2022 - -*/ - -#include "pixelGameEngine.h" - -namespace olc::utils::geom2d -{ - // Lemon Meringue - const double pi = 3.141592653589793238462643383279502884; - - // Floating point error margin - const double epsilon = 0.001; - - //https://stackoverflow.com/questions/1903954/is-there-a-standard-sign-function-signum-sgn-in-c-c - template - constexpr int sgn(T val) { return (T(0) < val) - (val < T(0)); } - - // Defines a line segment - template - struct line - { - olc::v2d_generic start; - olc::v2d_generic end; - - inline line(const olc::v2d_generic& s = { T(0), T(0) }, - const olc::v2d_generic& e = { T(0), T(0) }) - : start(s), end(e) - { } - - - // Get length of line - inline constexpr T length() - { - return (end - start).mag(); - } - - // Get length of line^2 - inline constexpr T length2() - { - return (end - start).mag2(); - } - - inline constexpr olc::v2d_generic vector() const - { - return (end - start); - } - - // Given a real distance, get point along line - inline constexpr olc::v2d_generic rpoint(const T& distance) const - { - return start + (end - start).norm() * distance; - } - - // Given a unit distance, get point along line - inline constexpr olc::v2d_generic upoint(const T& distance) const - { - return start + (end - start) * distance; - } - - // Return which side of the line does a point lie - inline constexpr int32_t side(const olc::v2d_generic& point) const - { - double d = (end - start).cross(point - start); - if (d < 0) - return -1; - else - if (d > 0) - return 1; - else - return 0; - } - }; - - template - struct ray - { - olc::v2d_generic origin; - olc::v2d_generic direction; - }; - - template - struct rect - { - olc::v2d_generic pos; - olc::v2d_generic size; - - inline rect(const olc::v2d_generic& p = { T(0), T(0) }, - const olc::v2d_generic& s = { T(1), T(1) }) - : pos(p), size(s) - { } - - inline olc::v2d_generic middle() const - { - return pos + (size * double(0.5)); - } - - // Get line segment from top side of rectangle - inline line top() const - { - return { pos, {pos.x + size.x, pos.y } }; - } - - // Get line segment from bottom side of rectangle - inline line bottom() const - { - return { {pos.x, pos.y + size.y}, pos + size }; - } - - // Get line segment from left side of rectangle - inline line left() const - { - return { pos, {pos.x, pos.y + size.y} }; - } - - // Get line segment from right side of rectangle - inline line right() const - { - return { {pos.x + size.x, pos.y }, pos + size }; - } - - // Get a line from an indexed side, starting top, going clockwise - inline line side(const size_t i) const - { - if (i & 0b11 == 0) return top(); - if (i & 0b11 == 1) return right(); - if (i & 0b11 == 2) return bottom(); - if (i & 0b11 == 3) return left(); - } - - // Get area of rectangle - inline constexpr T area() const - { - return size.x * size.y; - } - - // Get perimeter of rectangle - inline constexpr T perimeter() const - { - return T(2) * (size.x + size.y); - } - }; - - - template - struct circle - { - olc::v2d_generic pos; - T radius = T(0); - - inline circle(const olc::v2d_generic& p = { T(0), T(0) }, const T r = T(0)) - : pos(p), radius(r) - { } - - // Get area of circle - inline constexpr T area() const - { - return T(pi) * radius * radius; - } - - // Get circumference of circle - inline constexpr T perimeter() const - { - return T(2.0 * pi) * radius; - } - - // Get circumference of circle - inline constexpr T circumference() const - { - return perimeter(); - } - }; - - - template - struct triangle - { - std::array, 3> pos; - - inline triangle( - const olc::v2d_generic& p0 = { T(0), T(0) }, - const olc::v2d_generic& p1 = { T(0), T(0) }, - const olc::v2d_generic& p2 = { T(0), T(0) }) - : pos{ p0,p1,p2 } - { } - - // Get a line from an indexed side, starting top, going clockwise - inline line side(const size_t i) const - { - return line(pos[i % 3], pos[(i + 1) % 3]); - } - - // Get area of triangle - inline constexpr T area() const - { - return double(0.5) * std::abs( - (pos[0].x * (pos[1].y - pos[2].y)) + - (pos[1].x * (pos[2].y - pos[0].y)) + - (pos[2].x * (pos[0].y - pos[1].y))); - } - - // Get perimeter of triangle - inline constexpr T perimeter() const - { - return line(pos[0], pos[1]).length() - + line(pos[1], pos[2]).length() - + line(pos[2], pos[0]).length(); - } - }; - - - template - struct polygon - { - std::vector> vPoints; - }; - - - // ========================================================================================================================= - // Closest(shape, point) =================================================================================================== - - // Returns closest point to point - template - inline olc::v2d_generic closest(const olc::v2d_generic& p1, const olc::v2d_generic& p2) - { - return p1; - } - - // Returns closest point on line to point - template - inline olc::v2d_generic closest(const line& l, const olc::v2d_generic& p) - { - auto d = l.vector(); - double u = std::clamp(double(d.dot(p - l.start) / d.mag2()), 0.0, 1.0); - return l.start + d * u; - } - - // Returns closest point on circle to point - template - inline olc::v2d_generic closest(const circle& c, const olc::v2d_generic& p) - { - return c.pos + (p - c.pos).norm() * c.radius; - } - - // Returns closest point on rectangle to point - template - inline olc::v2d_generic closest(const rect& r, const olc::v2d_generic& p) - { - // This could be a "constrain" function hmmmm - // TODO: Not quite what i wanted, should restrain to boundary - return olc::v2d_generic{ std::clamp(p.x, r.pos.x, r.pos.x + r.size.x), std::clamp(p.y, r.pos.y, r.pos.y + r.size.y) }; - - } - - // Returns closest point on triangle to point - template - inline olc::v2d_generic closest(const triangle& t, const olc::v2d_generic& p) - { - // TODO: - return olc::v2d_generic(); - } - - - - - - - - - - - - // ================================================================================================================ - // POINT ========================================================================================================== - - // Checks if point contains point - template - inline constexpr bool contains(const olc::v2d_generic& p1, const olc::v2d_generic& p2) - { - return (p1 - p2).mag2() < epsilon; - } - - // Checks if line contains point - template - inline constexpr bool contains(const line& l, const olc::v2d_generic& p) - { - double d = ((p.x - l.start.x) * (l.end.y - l.start.y) - (p.y - l.start.y) * (l.end.x - l.start.x)); - if (std::abs(d) < epsilon) - { - // point is on line - double u = l.vector().dot(p - l.start) / l.vector().mag2(); - return (u >= double(0.0) && u <= double(1.0)); - } - - return false; - } - - // Checks if rectangle contains point - template - inline constexpr bool contains(const rect& r, const olc::v2d_generic& p) - { - return !(p.x < r.pos.x || p.y < r.pos.y || - p.x > (r.pos.x + r.size.x) || p.y > (r.pos.y + r.size.y)); - } - - // Checks if circle contains a point - template - inline constexpr bool contains(const circle& c, const olc::v2d_generic& p) - { - return (c.pos - p).mag2() < (c.radius * c.radius); - } - - // Checks if triangle contains a point - template - inline constexpr bool contains(const triangle& t, const olc::v2d_generic& p) - { - // http://jsfiddle.net/PerroAZUL/zdaY8/1/ - T2 A = T2(0.5) * (-t.pos[1].y * t.pos[2].x + t.pos[0].y * (-t.pos[1].x + t.pos[2].x) + t.pos[0].x * (t.pos[1].y - t.pos[2].y) + t.pos[1].x * t.pos[2].y); - T2 sign = A < T2(0) ? T2(-1) : T2(1); - T2 s = (t.pos[0].y * t.pos[2].x - t.pos[0].x * t.pos[2].y + (t.pos[2].y - t.pos[0].y) * p.x + (t.pos[0].x - t.pos[2].x) * p.y) * sign; - T2 v = (t.pos[0].x * t.pos[1].y - t.pos[0].y * t.pos[1].x + (t.pos[0].y - t.pos[1].y) * p.x + (t.pos[1].x - t.pos[0].x) * p.y) * sign; - return s > T2(0) && v > T2(0) && (s + v) < T2(2) * A * sign; - } - - - - - // Check if point overlaps with point (analagous to contains()) - template - inline constexpr bool overlaps(const olc::v2d_generic& p1, const olc::v2d_generic& p2) - { - return contains(p1, p2); - } - - // Checks if line segment overlaps with point - template - inline constexpr bool overlaps(const line& l, const olc::v2d_generic& p) - { - return contains(l, p); - } - - // Checks if rectangle overlaps with point - template - inline constexpr bool overlaps(const rect& r, const olc::v2d_generic& p) - { - return contains(r, p); - } - - // Checks if circle overlaps with point - template - inline constexpr bool overlaps(const circle& c, const olc::v2d_generic& p) - { - return contains(c, p); - } - - // Checks if triangle overlaps with point - template - inline constexpr bool overlaps(const triangle& t, const olc::v2d_generic& p) - { - return contains(t, p); - } - - - - - // Get intersection points where point intersects with point - template - inline std::vector> intersects(const olc::v2d_generic& p1, const olc::v2d_generic& p2) - { - if (contains(p1, p2)) - return { p1 }; - else - return {}; - } - - // Get intersection points where line segment intersects with point - template - inline std::vector> intersects(const line& l, const olc::v2d_generic& p) - { - if (contains(l, p)) - return { p }; - else - return {}; - } - - // Get intersection points where rectangle intersects with point - template - inline std::vector> intersects(const rect& r, const olc::v2d_generic& p) - { - std::vector> vPoints; - if (contains(r.top(), p)) vPoints.push_back(p); - if (contains(r.bottom(), p)) vPoints.push_back(p); - if (contains(r.left(), p)) vPoints.push_back(p); - if (contains(r.right(), p)) vPoints.push_back(p); - return vPoints; - } - - // Get intersection points where circle intersects with point - template - inline std::vector> intersects(const circle& c, const olc::v2d_generic& p) - { - if (std::abs((p - c.pos).mag2() - (c.radius * c.radius)) <= epsilon) - return { p }; - else - return {}; - } - - // Get intersection points where triangle intersects with point - template - inline std::vector> intersects(const triangle& r, const olc::v2d_generic& p) - { - // TODO: - return {}; - } - - - - - - - - - - - - - // ================================================================================================================ - // LINE =========================================================================================================== - - // Check if point contains line segment - template - inline constexpr bool contains(const olc::v2d_generic& p, const line& l) - { - return false; // It can't! - } - - // Check if line segment contains line segment - template - inline constexpr bool contains(const line& l1, const line& l2) - { - // TODO: Check if segments are colinear, and l1 exists within bounds of l2 - return false; - } - - // Check if rectangle contains line segment - template - inline constexpr bool contains(const rect& r, const line& l) - { - return contains(r, l.start) && contains(r, l.end); - } - - // Check if circle contains line segment - template - inline constexpr bool contains(const circle& c1, const line& l) - { - return contains(c1, l.start) && contains(c1, l.end); - } - - // Check if triangle contains line segment - template - inline constexpr bool contains(const triangle& t, const line& l) - { - return contains(t, l.start) && contains(t, l.end); - } - - - - - // Check if point overlaps line segment - template - inline constexpr bool overlaps(const olc::v2d_generic& p, const line& l) - { - return contains(l, p); - } - - // Check if line segment overlaps line segment - template - inline constexpr bool overlaps(const line& l1, const line& l2) - { - // TODO: - return false; - } - - // Check if rectangle overlaps line segment - template - inline constexpr bool overlaps(const rect& r, const line& l) - { - return contains(r, l.start) - || contains(r, l.end); - - // TODO: This method is no good, it cant detect lines whose start and end - // points are outside the rectangle - } - - // Check if circle overlaps line segment - template - inline constexpr bool overlaps(const circle& c, const line& l) - { - // TODO: - return false; - } - - // Check if triangle overlaps line segment - template - inline constexpr bool overlaps(const triangle& t, const line& l) - { - return overlaps(t, l.start) || overlaps(t, l.end); - - // TODO: This method is no good, it cant detect lines whose start and end - // points are outside the triangle - } - - - - - // Get intersection points where point intersects with line segment - template - inline std::vector> intersects(const olc::v2d_generic& p, const line& l) - { - // TODO: - return {}; - } - - // Get intersection points where line segment intersects with line segment - template - inline std::vector> intersects(const line& l1, const line& l2) - { - // TODO: - return {}; - } - - // Get intersection points where rectangle intersects with line segment - template - inline std::vector> intersects(const rect& r, const line& l) - { - // TODO: - return {}; - } - - // Get intersection points where circle intersects with line segment - template - inline std::vector> intersects(const circle& c, const line& l) - { - // TODO: - return {}; - } - - // Get intersection points where triangle intersects with line segment - template - inline std::vector> intersects(const triangle& t, const line& l) - { - // TODO: - return {}; - } - - - - - - - - - - - - - // ================================================================================================================ - // RECTANGLE ====================================================================================================== - - // Check if point contains rectangle - template - inline constexpr bool contains(const olc::v2d_generic& p, const rect& r) - { - return false; // It can't! - } - - // Check if line segment contains rectangle - template - inline constexpr bool contains(const line& l, const rect& r) - { - return false; // It can't - } - - // Check if rectangle contains rectangle - template - inline constexpr bool contains(const rect& r1, const rect& r2) - { - return (r2.pos.x >= r1.pos.x) && (r2.pos.x + r2.size.x < r1.pos.x + r1.size.x) && - (r2.pos.y >= r1.pos.y) && (r2.pos.y + r2.size.y < r1.pos.y + r1.size.y); - } - - // Check if circle contains rectangle - template - inline constexpr bool contains(const circle& c, const rect& r) - { - return contains(c, r.pos) - && contains(c, olc::v2d_generic{ r.pos.x + r.size.x, r.pos.y }) - && contains(c, olc::v2d_generic{ r.pos.x, r.pos.y + r.size.y }) - && contains(c, r.pos + r.size); - } - - // Check if triangle contains rectangle - template - inline constexpr bool contains(const triangle& t, const rect& r) - { - return contains(t, r.pos) - && contains(t, r.pos + r.size) - && contains(t, olc::v2d_generic{ r.pos.x + r.size.x,r.pos.y }) - && contains(t, olc::v2d_generic{ r.pos.x, r.pos.y + r.size.y }); - } - - - - - // Check if point overlaps rectangle - template - inline constexpr bool overlaps(const olc::v2d_generic& p, const rect& r) - { - return overlaps(r, p); - } - - // Check if line segment overlaps rectangle - template - inline constexpr bool overlaps(const line& l, const rect& r) - { - return overlaps(r, l); - } - - // Check if rectangle overlaps rectangle - template - inline constexpr bool overlaps(const rect& r1, const rect& r2) - { - return (r1.pos.x < r2.pos.x + r2.size.x && r1.pos.x + r1.size.x >= r2.pos.x && - r1.pos.y < r2.pos.y + r2.size.y && r1.pos.y + r1.size.y >= r2.pos.y); - } - - // Check if circle overlaps rectangle - template - inline constexpr bool overlaps(const circle& c, const rect& r) - { - // Inspired by this (very clever btw) - // https://stackoverflow.com/questions/45370692/circle-rectangle-collision-response - // But modified to work :P - T2 overlap = (olc::v2d_generic{ std::clamp(c.pos.x, r.pos.x, r.pos.x + r.size.x), std::clamp(c.pos.y, r.pos.y, r.pos.y + r.size.y) } - c.pos).mag2(); - if (std::isnan(overlap)) overlap = T2(0); - return (overlap - (c.radius * c.radius)) < T2(0); - } - - // Check if triangle overlaps rectangle - template - inline constexpr bool overlaps(const triangle& t, const rect& r) - { - return contains(t, r.pos) - || contains(t, r.pos + r.size) - || contains(t, olc::v2d_generic{ r.pos.x + r.size.x, r.pos.y }) - || contains(t, olc::v2d_generic{ r.pos.x, r.pos.y + r.size.y }); - - // TODO: This method is no good, consider rectangle with all vertices - // outside of triangle, but edges still crossing - } - - - - - // Get intersection points where point intersects with rectangle - template - inline std::vector> intersects(const olc::v2d_generic& p, const rect& r) - { - return intersects(r, p); - } - - // Get intersection points where line segment intersects with rectangle - template - inline std::vector> intersects(const line& l, const rect& r) - { - // TODO: - return {}; - } - - // Get intersection points where rectangle intersects with rectangle - template - inline std::vector> intersects(const rect& r1, const rect& r2) - { - // TODO: - return {}; - } - - // Get intersection points where circle intersects with rectangle - template - inline std::vector> intersects(const circle& c, const rect& r) - { - // TODO: - return {}; - } - - // Get intersection points where triangle intersects with rectangle - template - inline std::vector> intersects(const triangle& t, const rect& r) - { - // TODO: - return {}; - } - - - - - - - - - - - - - - // ================================================================================================================ - // CIRCLE ========================================================================================================= - - // Check if point contains circle - template - inline constexpr bool contains(const olc::v2d_generic& p, const circle& c) - { - return false; // It can't! - } - - // Check if line segment contains circle - template - inline constexpr bool contains(const line& l, const circle& c) - { - return false; // It can't! - } - - // Check if rectangle contains circle - template - inline constexpr bool contains(const rect& r, const circle& c) - { - // TODO: - return false; - } - - // Check if circle contains circle - template - inline constexpr bool contains(const circle& c1, const circle& c2) - { - return (c1.pos - c2.pos).mag2() <= (c1.radius - c2.radius) * (c1.radius - c2.radius); - } - - // Check if triangle contains circle - template - inline constexpr bool contains(const triangle& t, const circle& c) - { - // TODO: - return false; - } - - - - - // Check if point overlaps circle - template - inline constexpr bool overlaps(const olc::v2d_generic& p, const circle& c) - { - return overlaps(c, p); - } - - // Check if line segment overlaps circle - template - inline constexpr bool overlaps(const line& l, const circle& c) - { - return overlaps(c, l); - } - - // Check if rectangle overlaps circle - template - inline constexpr bool overlaps(const rect& r, const circle& c) - { - return overlaps(c, r); - } - - // Check if circle overlaps circle - template - inline constexpr bool overlaps(const circle& c1, const circle& c2) - { - return (c1.pos - c2.pos).mag2() <= (c1.radius + c2.radius) * (c1.radius + c2.radius); - } - - // Check if triangle overlaps circle - template - inline constexpr bool overlaps(const triangle& t, const circle& c) - { - // TODO: - return false; - } - - - - - // Get intersection points where point intersects with circle - template - inline std::vector> intersects(const olc::v2d_generic& p, const circle& c) - { - // TODO: - return {}; - } - - // Get intersection points where line segment intersects with circle - template - inline std::vector> intersects(const line& l, const circle& c) - { - // TODO: - return {}; - } - - // Get intersection points where rectangle intersects with circle - template - inline std::vector> intersects(const rect& r, const circle& c) - { - // TODO: - return {}; - } - - // Get intersection points where circle intersects with circle - template - inline std::vector> intersects(const circle& c1, const circle& c2) - { - // TODO: - return {}; - } - - // Get intersection points where triangle intersects with circle - template - inline std::vector> intersects(const triangle& t, const circle& c) - { - // TODO: - return {}; - } - - - - - - - - - - - - - - // ================================================================================================================ - // TRIANGLE ======================================================================================================= - - // Check if point contains triangle - template - inline constexpr bool contains(const olc::v2d_generic& p, const triangle& t) - { - return false; // It can't! - } - - // Check if line segment contains triangle - template - inline constexpr bool contains(const line& l, const triangle& t) - { - return false; // It can't - } - - // Check if rectangle contains triangle - template - inline constexpr bool contains(const rect& r, const triangle& t) - { - // TODO: - return false; - } - - // Check if circle contains triangle - template - inline constexpr bool contains(const circle& c, const triangle& t) - { - // TODO: - return false; - } - - // Check if triangle contains triangle - template - inline constexpr bool contains(const triangle& t1, const triangle& t2) - { - // TODO: - return false; - } - - - - - // Check if point overlaps triangle - template - inline constexpr bool overlaps(const olc::v2d_generic& p, const triangle& t) - { - return overlaps(t, p); - } - - // Check if line segment overlaps triangle - template - inline constexpr bool overlaps(const line& l, const triangle& t) - { - return overlaps(t, l); - } - - // Check if rectangle overlaps triangle - template - inline constexpr bool overlaps(const rect& r, const triangle& t) - { - return overlaps(t, r); - } - - // Check if circle overlaps triangle - template - inline constexpr bool overlaps(const circle& c, const triangle& t) - { - return overlaps(t, c); - } - - // Check if triangle overlaps triangle - template - inline constexpr bool overlaps(const triangle& t1, const triangle& t2) - { - // TODO: - return false; - } - - - - - // Get intersection points where point intersects with triangle - template - inline std::vector> intersects(const olc::v2d_generic& p, const triangle& t) - { - // TODO: - return {}; - } - - // Get intersection points where line segment intersects with triangle - template - inline std::vector> intersects(const line& l, const triangle& t) - { - // TODO: - return {}; - } - - // Get intersection points where rectangle intersects with triangle - template - inline std::vector> intersects(const rect& r, const triangle& t) - { - // TODO: - return {}; - } - - // Get intersection points where circle intersects with triangle - template - inline std::vector> intersects(const circle& c, const triangle& t) - { - // TODO: - return {}; - } - - // Get intersection points where triangle intersects with triangle - template - inline std::vector> intersects(const triangle& t1, const triangle& t2) - { - // TODO: - return {}; - } - -} \ No newline at end of file diff --git a/quickgui.h b/quickgui.h deleted file mode 100644 index c445acf..0000000 --- a/quickgui.h +++ /dev/null @@ -1,786 +0,0 @@ -/* - OneLoneCoder - QuickGUI v1.00 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - A semi-immediate mode GUI for very simple GUI stuff. - Includes: - Label - Displays a single-line string - TextBox - Click to enter/edit single-line text - Button - A clickable labelled rectangle - CheckBox - A clickable labelled rectangle that retains state - Slider - An omnidirectional draggable handle between two values - - License (OLC-3) - ~~~~~~~~~~~~~~~ - - Copyright 2018 - 2021 OneLoneCoder.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions or derivations of source code must retain the above - copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions or derivative works in binary form must reproduce - the above copyright notice. This list of conditions and the following - disclaimer must be reproduced in the documentation and/or other - materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Links - ~~~~~ - YouTube: https://www.youtube.com/javidx9 - Discord: https://discord.gg/WhwHUMV - Twitter: https://www.twitter.com/javidx9 - Twitch: https://www.twitch.tv/javidx9 - GitHub: https://www.github.com/onelonecoder - Homepage: https://www.onelonecoder.com - - Author - ~~~~~~ - David Barr, aka javidx9, ©OneLoneCoder 2019, 2020, 2021, 2022 - -*/ - -#ifndef OLC_PGEX_QUICKGUI_H -#define OLC_PGEX_QUICKGUI_H - -#include "pixelGameEngine.h" - - -namespace olc::QuickGUI -{ - class Manager; - - // Virtual base class for all controls - class BaseControl - { - public: - BaseControl(olc::QuickGUI::Manager& manager); - virtual ~BaseControl(); - - public: - // Switches the control on/off - void Enable(const bool bEnable); - // Sets whether or not the control is interactive/displayed - bool bVisible = true; - - // True on single frame control begins being manipulated - bool bPressed = false; - // True on all frames control is under user manipulation - bool bHeld = false; - // True on single frame control ceases being manipulated - bool bReleased = false; - - public: - // Updates the controls behvaiour - virtual void Update(olc::PixelGameEngine* pge) = 0; - // Draws the control using "sprite" based CPU operations - virtual void Draw(olc::PixelGameEngine* pge) = 0; - // Draws the control using "decal" based GPU operations - virtual void DrawDecal(olc::PixelGameEngine* pge) = 0; - - protected: - // Controls are related to a manager, where the theme resides - // and control groups can be implemented - olc::QuickGUI::Manager& m_manager; - - // All controls exists in one of four states - // Disabled - Greyed out and not interactive - // Normal - interactive and operational - // Hover - currently under the users mouse focus - // Click - user is interacting with the control - enum class State { Disabled, Normal, Hover, Click } m_state = State::Normal; - - // To add a "swish" to things, controls can fade between states - float m_fTransition = 0.0; - }; - - - // A QuickGUI::Manager acts as a convenient grouping of controls - class Manager - { - public: - // Construct Manager, bCleanUpForMe will automatically DELETE any controls - // given to this manager via AddControl() if true - Manager(const bool bCleanUpForMe = true); - virtual ~Manager(); - - public: - // Add a gui element derived form BaseControl to this manager - void AddControl(BaseControl* control); - // Updates all controls this manager operates - void Update(olc::PixelGameEngine* pge); - // Draws as "sprite" all controls this manager operates - void Draw(olc::PixelGameEngine* pge); - // Draws as "decal" all controls this manager operates - void DrawDecal(olc::PixelGameEngine* pge); - - public: // This managers "Theme" can be set here - // Various element colours - olc::Pixel colNormal = olc::DARK_BLUE; - olc::Pixel colHover = olc::BLUE; - olc::Pixel colClick = olc::CYAN; - olc::Pixel colDisable = olc::DARK_GREY; - olc::Pixel colBorder = olc::WHITE; - olc::Pixel colText = olc::WHITE; - // Speed to transiton from Normal -> Hover - float fHoverSpeedOn = 10.0f; - // Speed to transiton from Hover -> Normal - float fHoverSpeedOff = 4.0f; - - private: - // Should this manager call delete on the controls it opeerates? - bool m_bEraseControlsOnDestroy = true; - // Container of controls - std::vector m_vControls; - }; - - - // Creates a Label Control - it's just text! - class Label : public BaseControl - { - public: - Label(olc::QuickGUI::Manager& manager, // Associate with a Manager - const std::string& text, // Text to display - const olc::vf2d& pos, // Location of label top-left - const olc::vf2d& size); // Size of label - - public: - // Position of button - olc::vf2d vPos; - // Size of button - olc::vf2d vSize; - // Text displayed on button - std::string sText; - // Show a border? - bool bHasBorder = false; - // Show a background? - bool bHasBackground = false; - // Where should the text be positioned? - enum class Alignment - {Left, Centre, Right} nAlign = Alignment::Centre; - - public: // BaseControl overrides - void Update(olc::PixelGameEngine* pge) override; - void Draw(olc::PixelGameEngine* pge) override; - void DrawDecal(olc::PixelGameEngine* pge) override; - }; - - class TextBox : public Label - { - public: - TextBox(olc::QuickGUI::Manager& manager, // Associate with a Manager - const std::string& text, // Text to display - const olc::vf2d& pos, // Location of text box top-left - const olc::vf2d& size); // Size of text box - - public: // BaseControl overrides - void Update(olc::PixelGameEngine* pge) override; - void Draw(olc::PixelGameEngine* pge) override; - void DrawDecal(olc::PixelGameEngine* pge) override; - - protected: - bool m_bTextEdit = false; - - }; - - // Creates a Button Control - a clickable, labelled rectangle - class Button : public BaseControl - { - public: - Button(olc::QuickGUI::Manager& manager, // Associate with a Manager - const std::string& text, // Text to display - const olc::vf2d& pos, // Location of button top-left - const olc::vf2d& size); // Size of button - - public: - // Position of button - olc::vf2d vPos; - // Size of button - olc::vf2d vSize; - // Text displayed on button - std::string sText; - - public: // BaseControl overrides - void Update(olc::PixelGameEngine* pge) override; - void Draw(olc::PixelGameEngine* pge) override; - void DrawDecal(olc::PixelGameEngine* pge) override; - }; - - // Creates a Button Control - a clickable, labelled rectangle - class CheckBox : public Button - { - public: - CheckBox(olc::QuickGUI::Manager& manager, // Associate with a Manager - const std::string& text, // Text to display - const bool check, // Is checked or not? - const olc::vf2d& pos, // Location of button top-left - const olc::vf2d& size); // Size of button - - public: - bool bChecked = false; - - public: // BaseControl overrides - void Update(olc::PixelGameEngine* pge) override; - void Draw(olc::PixelGameEngine* pge) override; - void DrawDecal(olc::PixelGameEngine* pge) override; - }; - - - // Creates a Slider Control - a grabbable handle that slides between two locations - class Slider : public BaseControl - { - public: - Slider(olc::QuickGUI::Manager& manager, // Associate with a Manager - const olc::vf2d& posmin, // Screen location of "minimum" - const olc::vf2d& posmax, // Screen location of "maximum" - const float valmin, // Value of minimum - const float valmax, // Value of maximum - const float value); // Starting value - - public: - // Minium value - float fMin = -100.0f; - // Maximum value - float fMax = +100.0f; - // Current value - float fValue = 0.0f; - // Size of grab handle - float fGrabRad = 8.0f; - // Location of minimum/start - olc::vf2d vPosMin; - // Location of maximum/end - olc::vf2d vPosMax; - - public: // BaseControl overrides - void Update(olc::PixelGameEngine* pge) override; - void Draw(olc::PixelGameEngine* pge) override; - void DrawDecal(olc::PixelGameEngine* pge) override; - }; - -} - - -#ifdef OLC_PGEX_QUICKGUI -#undef OLC_PGEX_QUICKGUI -namespace olc::QuickGUI -{ - -#pragma region BaseControl - BaseControl::BaseControl(olc::QuickGUI::Manager& manager) : m_manager(manager) - { - m_manager.AddControl(this); - } - - BaseControl::~BaseControl() - { - - } - - void BaseControl::Enable(const bool bEnable) - { - m_state = bEnable ? State::Normal : State::Disabled; - } -#pragma endregion - -#pragma region Manager - Manager::Manager(const bool bCleanUpForMe) - { - m_bEraseControlsOnDestroy = bCleanUpForMe; - } - - Manager::~Manager() - { - if (m_bEraseControlsOnDestroy) - for (auto& p : m_vControls) - delete p; - - m_vControls.clear(); - } - - void Manager::AddControl(BaseControl* control) - { - m_vControls.push_back(control); - } - - void Manager::Update(olc::PixelGameEngine* pge) - { - for (auto& p : m_vControls) p->Update(pge); - } - - void Manager::Draw(olc::PixelGameEngine* pge) - { - for (auto& p : m_vControls) p->Draw(pge); - } - - void Manager::DrawDecal(olc::PixelGameEngine* pge) - { - for (auto& p : m_vControls) p->DrawDecal(pge); - } -#pragma endregion - -#pragma region Label - Label::Label(olc::QuickGUI::Manager& manager, const std::string& text, const olc::vf2d& pos, const olc::vf2d& size) - : BaseControl(manager) - { - vPos = pos; vSize = size; sText = text; - } - - void Label::Update(olc::PixelGameEngine* pge) - { - - } - - void Label::Draw(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - if (bHasBackground) - { - pge->FillRect(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colNormal); - } - - if(bHasBorder) - pge->DrawRect(vPos, vSize - olc::vf2d(1, 1), m_manager.colBorder); - - olc::vf2d vText = pge->GetTextSizeProp(sText); - switch (nAlign) - { - case Alignment::Left: - pge->DrawStringProp(olc::vf2d( vPos.x + 2.0f, vPos.y + (vSize.y - vText.y) * 0.5f ), sText, m_manager.colText); - break; - case Alignment::Centre: - pge->DrawStringProp(vPos + (vSize - vText) * 0.5f, sText, m_manager.colText); - break; - case Alignment::Right: - pge->DrawStringProp(olc::vf2d{ vPos.x + vSize.x - vText.x - 2.0f, vPos.y + (vSize.y - vText.y) * 0.5f }, sText, m_manager.colText); - break; - } - } - - void Label::DrawDecal(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - if (bHasBackground) - { - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colNormal); - } - - if (bHasBorder) - { - pge->SetDecalMode(olc::DecalMode::WIREFRAME); - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2,2), m_manager.colBorder); - pge->SetDecalMode(olc::DecalMode::NORMAL); - } - - olc::vf2d vText = pge->GetTextSizeProp(sText); - switch (nAlign) - { - case Alignment::Left: - pge->DrawStringPropDecal({ vPos.x + 2.0f, vPos.y + (vSize.y - vText.y) * 0.5f }, sText, m_manager.colText); - break; - case Alignment::Centre: - pge->DrawStringPropDecal(vPos + (vSize - vText) * 0.5f, sText, m_manager.colText); - break; - case Alignment::Right: - pge->DrawStringPropDecal({ vPos.x + vSize.x - vText.x - 2.0f, vPos.y + (vSize.y - vText.y) * 0.5f }, sText, m_manager.colText); - break; - } - } -#pragma endregion - - -#pragma region TextBox - TextBox::TextBox(olc::QuickGUI::Manager& manager, const std::string& text, const olc::vf2d& pos, const olc::vf2d& size) - : Label(manager, text, pos, size) - { - nAlign = Alignment::Left; - bHasBorder = true; - bHasBackground = false; - } - - void TextBox::Update(olc::PixelGameEngine* pge) - { - if (m_state == State::Disabled || !bVisible) - return; - - bPressed = false; - bReleased = false; - - olc::vf2d vMouse = pge->GetMousePos(); - - if (vMouse.x >= vPos.x && vMouse.x < vPos.x + vSize.x && - vMouse.y >= vPos.y && vMouse.y < vPos.y + vSize.y) - { - // Released inside box does nothing to me, but i may have - // to finish off the neighbours... oo err - bReleased = pge->GetMouse(olc::Mouse::LEFT).bReleased; - if (bReleased && pge->IsTextEntryEnabled() && !m_bTextEdit) - { - pge->TextEntryEnable(false); - } - - bPressed = pge->GetMouse(olc::Mouse::LEFT).bPressed; - if (bPressed && !pge->IsTextEntryEnabled() && !m_bTextEdit) - { - pge->TextEntryEnable(true, sText); - m_bTextEdit = true; - } - - bHeld = pge->GetMouse(olc::Mouse::LEFT).bHeld; - - - } - else - { - // Released outside box - bReleased = pge->GetMouse(olc::Mouse::LEFT).bReleased; - if (bReleased && m_bTextEdit) - { - sText = pge->TextEntryGetString(); - pge->TextEntryEnable(false); - m_bTextEdit = false; - } - } - - if (m_bTextEdit && pge->IsTextEntryEnabled()) - sText = pge->TextEntryGetString(); - } - - void TextBox::Draw(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - if (bHasBackground) - { - pge->FillRect(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colNormal); - } - - if (bHasBorder) - pge->DrawRect(vPos, vSize - olc::vf2d(1, 1), m_manager.colBorder); - - if (m_bTextEdit && pge->IsTextEntryEnabled()) - { - // Draw Cursor - int32_t i = pge->TextEntryGetCursor(); - olc::vf2d vCursorPos = pge->GetTextSizeProp(sText.substr(0, i)); - pge->FillRect(olc::vf2d(vPos.x + 2.0f + vCursorPos.x, (vPos.y + (vSize.y - 10.0f) * 0.5f)), { 2, 10 }, m_manager.colText); - } - - // Draw Text - olc::vf2d vText = pge->GetTextSizeProp(sText); - pge->DrawStringProp(olc::vf2d(vPos.x + 2.0f, vPos.y + (vSize.y - vText.y) * 0.5f), sText, m_manager.colText); - - } - - void TextBox::DrawDecal(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - if (bHasBackground) - { - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colNormal); - } - - if (bHasBorder) - { - pge->SetDecalMode(olc::DecalMode::WIREFRAME); - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colBorder); - pge->SetDecalMode(olc::DecalMode::NORMAL); - } - - if (m_bTextEdit && pge->IsTextEntryEnabled()) - { - // Draw Cursor - int32_t i = pge->TextEntryGetCursor(); - olc::vf2d vCursorPos = pge->GetTextSizeProp(sText.substr(0, i)); - pge->FillRectDecal(olc::vf2d(vPos.x + 2.0f + vCursorPos.x, (vPos.y + (vSize.y - 10.0f) * 0.5f)), { 2, 10 }, m_manager.colText); - } - - // Draw Text - olc::vf2d vText = pge->GetTextSizeProp(sText); - pge->DrawStringPropDecal(olc::vf2d(vPos.x + 2.0f, vPos.y + (vSize.y - vText.y) * 0.5f), sText, m_manager.colText); - } -#pragma endregion - -#pragma region Button - Button::Button(olc::QuickGUI::Manager& manager, const std::string& text, const olc::vf2d& pos, const olc::vf2d& size) - : BaseControl(manager) - { - vPos = pos; vSize = size; sText = text; - } - - void Button::Update(olc::PixelGameEngine* pge) - { - if (m_state == State::Disabled || !bVisible) - return; - - bPressed = false; - bReleased = false; - float fElapsedTime = pge->GetElapsedTime(); - - olc::vf2d vMouse = pge->GetMousePos(); - if (m_state != State::Click) - { - if (vMouse.x >= vPos.x && vMouse.x < vPos.x + vSize.x && - vMouse.y >= vPos.y && vMouse.y < vPos.y + vSize.y) - { - m_fTransition += fElapsedTime * m_manager.fHoverSpeedOn; - m_state = State::Hover; - - bPressed = pge->GetMouse(olc::Mouse::LEFT).bPressed; - if (bPressed) - { - m_state = State::Click; - } - - bHeld = pge->GetMouse(olc::Mouse::LEFT).bHeld; - } - else - { - m_fTransition -= fElapsedTime * m_manager.fHoverSpeedOff; - m_state = State::Normal; - } - } - else - { - bHeld = pge->GetMouse(olc::Mouse::LEFT).bHeld; - bReleased = pge->GetMouse(olc::Mouse::LEFT).bReleased; - if (bReleased) m_state = State::Normal; - } - - m_fTransition = std::clamp(m_fTransition, 0.0f, 1.0f); - } - - void Button::Draw(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - switch (m_state) - { - case State::Disabled: - pge->FillRect(vPos, vSize, m_manager.colDisable); - break; - case State::Normal: - case State::Hover: - pge->FillRect(vPos, vSize, olc::PixelLerp(m_manager.colNormal, m_manager.colHover, m_fTransition)); - break; - case State::Click: - pge->FillRect(vPos, vSize, m_manager.colClick); - break; - } - - pge->DrawRect(vPos, vSize - olc::vf2d(1, 1), m_manager.colBorder); - olc::vf2d vText = pge->GetTextSizeProp(sText); - pge->DrawStringProp(vPos + (vSize - vText) * 0.5f, sText, m_manager.colText); - } - - void Button::DrawDecal(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - switch (m_state) - { - case State::Disabled: - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colDisable); - break; - case State::Normal: - case State::Hover: - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), olc::PixelLerp(m_manager.colNormal, m_manager.colHover, m_fTransition)); - break; - case State::Click: - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colClick); - break; - } - pge->SetDecalMode(olc::DecalMode::WIREFRAME); - pge->FillRectDecal(vPos + olc::vf2d(1, 1), vSize - olc::vf2d(2, 2), m_manager.colBorder); - pge->SetDecalMode(olc::DecalMode::NORMAL); - - olc::vf2d vText = pge->GetTextSizeProp(sText); - pge->DrawStringPropDecal(vPos + (vSize - vText) * 0.5f, sText, m_manager.colText); - } -#pragma endregion - - -#pragma region CheckBox - CheckBox::CheckBox(olc::QuickGUI::Manager& manager, const std::string& text, const bool check, const olc::vf2d& pos, const olc::vf2d& size) - : Button(manager, text, pos, size) - { - bChecked = check; - } - - void CheckBox::Update(olc::PixelGameEngine* pge) - { - if (m_state == State::Disabled || !bVisible) - return; - - Button::Update(pge); - if (bPressed) bChecked = !bChecked; - } - - void CheckBox::Draw(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - Button::Draw(pge); - - if (bChecked) - pge->DrawRect(vPos + olc::vf2d(2, 2), vSize - olc::vi2d(4, 4), m_manager.colBorder); - } - - void CheckBox::DrawDecal(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - Button::DrawDecal(pge); - - pge->SetDecalMode(olc::DecalMode::WIREFRAME); - pge->FillRectDecal(vPos + olc::vf2d(2,2), vSize - olc::vf2d(4, 4), m_manager.colBorder); - pge->SetDecalMode(olc::DecalMode::NORMAL); - - olc::vf2d vText = pge->GetTextSizeProp(sText); - pge->DrawStringPropDecal(vPos + (vSize - vText) * 0.5f, sText, m_manager.colText); - } -#pragma endregion - -#pragma region Slider - Slider::Slider(olc::QuickGUI::Manager& manager, const olc::vf2d& posmin, const olc::vf2d& posmax, const float valmin, const float valmax, const float value) - : BaseControl(manager) - { - vPosMin = posmin; vPosMax = posmax; fMin = valmin; fMax = valmax; fValue = value; - } - - void Slider::Update(olc::PixelGameEngine* pge) - { - if (m_state == State::Disabled || !bVisible) - return; - - float fElapsedTime = pge->GetElapsedTime(); - - olc::vf2d vMouse = pge->GetMousePos(); - bHeld = false; - if (m_state == State::Click) - { - olc::vf2d d = vPosMax - vPosMin; - float u = d.dot(vMouse - vPosMin) / d.mag2(); - fValue = u * (fMax - fMin) + fMin; - bHeld = true; - } - else - { - olc::vf2d vSliderPos = vPosMin + (vPosMax - vPosMin) * ((fValue - fMin) / (fMax - fMin)); - if ((vMouse - vSliderPos).mag2() <= int32_t(fGrabRad) * int32_t(fGrabRad)) - { - m_fTransition += fElapsedTime * m_manager.fHoverSpeedOn; - m_state = State::Hover; - if (pge->GetMouse(olc::Mouse::LEFT).bPressed) - { - m_state = State::Click; - bPressed = true; - } - } - else - m_state = State::Normal; - } - - if (pge->GetMouse(olc::Mouse::LEFT).bReleased) - { - m_state = State::Normal; - bReleased = true; - } - - if (m_state == State::Normal) - { - m_fTransition -= fElapsedTime * m_manager.fHoverSpeedOff; - m_state = State::Normal; - bHeld = false; - } - - fValue = std::clamp(fValue, fMin, fMax); - m_fTransition = std::clamp(m_fTransition, 0.0f, 1.0f); - } - - void Slider::Draw(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - pge->DrawLine(vPosMin, vPosMax, m_manager.colBorder); - olc::vf2d vSliderPos = vPosMin + (vPosMax - vPosMin) * ((fValue - fMin) / (fMax - fMin)); - - switch (m_state) - { - case State::Disabled: - pge->FillCircle(vSliderPos, int32_t(fGrabRad), m_manager.colDisable); - break; - case State::Normal: - case State::Hover: - pge->FillCircle(vSliderPos, int32_t(fGrabRad), olc::PixelLerp(m_manager.colNormal, m_manager.colHover, m_fTransition)); - break; - case State::Click: - pge->FillCircle(vSliderPos, int32_t(fGrabRad), m_manager.colClick); - break; - } - - - pge->DrawCircle(vSliderPos, int32_t(fGrabRad), m_manager.colBorder); - } - - void Slider::DrawDecal(olc::PixelGameEngine* pge) - { - if (!bVisible) - return; - - pge->DrawLineDecal(vPosMin, vPosMax, m_manager.colBorder); - olc::vf2d vSliderPos = vPosMin + (vPosMax - vPosMin) * ((fValue - fMin) / (fMax - fMin)); - - switch (m_state) - { - case State::Disabled: - pge->FillRectDecal(vSliderPos - olc::vf2d(fGrabRad, fGrabRad), olc::vf2d(fGrabRad, fGrabRad) * 2.0f, m_manager.colDisable); - break; - case State::Normal: - case State::Hover: - pge->FillRectDecal(vSliderPos - olc::vf2d(fGrabRad, fGrabRad), olc::vf2d(fGrabRad, fGrabRad) * 2.0f, olc::PixelLerp(m_manager.colNormal, m_manager.colHover, m_fTransition)); - break; - case State::Click: - pge->FillRectDecal(vSliderPos - olc::vf2d(fGrabRad, fGrabRad), olc::vf2d(fGrabRad, fGrabRad) * 2.0f, m_manager.colClick); - break; - } - - pge->SetDecalMode(olc::DecalMode::WIREFRAME); - pge->FillRectDecal(vSliderPos - olc::vf2d(fGrabRad, fGrabRad), olc::vf2d(fGrabRad, fGrabRad) * 2.0f, m_manager.colBorder); - pge->SetDecalMode(olc::DecalMode::NORMAL); - } - - -#pragma endregion - -} -#endif // OLC_PGEX_QUICKGUI -#endif // OLC_PGEX_QUICKGUI_H \ No newline at end of file diff --git a/road.png b/road.png deleted file mode 100644 index d188bd3..0000000 Binary files a/road.png and /dev/null differ diff --git a/sol.hpp b/sol.hpp deleted file mode 100644 index 01a508e..0000000 --- a/sol.hpp +++ /dev/null @@ -1,28907 +0,0 @@ -// The MIT License (MIT) - -// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// This file was generated with a script. -// Generated 2022-10-23 03:24:40.159358 UTC -// This header was generated with sol v3.3.0 (revision 0386513a) -// https://github.com/ThePhD/sol2 - -#ifndef SOL_SINGLE_INCLUDE_HPP -#define SOL_SINGLE_INCLUDE_HPP - -// beginning of sol/sol.hpp - -#ifndef SOL_HPP -#define SOL_HPP - -// beginning of sol/version.hpp - -#include "config.hpp" - -#define SOL_VERSION_MAJOR 3 -#define SOL_VERSION_MINOR 2 -#define SOL_VERSION_PATCH 3 -#define SOL_VERSION_STRING "3.2.3" -#define SOL_VERSION ((SOL_VERSION_MAJOR * 100000) + (SOL_VERSION_MINOR * 100) + (SOL_VERSION_PATCH)) - -#define SOL_TOKEN_TO_STRING_POST_EXPANSION_I_(_TOKEN) #_TOKEN -#define SOL_TOKEN_TO_STRING_I_(_TOKEN) SOL_TOKEN_TO_STRING_POST_EXPANSION_I_(_TOKEN) - -#define SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT) _LEFT##_RIGHT -#define SOL_CONCAT_TOKENS_I_(_LEFT, _RIGHT) SOL_CONCAT_TOKENS_POST_EXPANSION_I_(_LEFT, _RIGHT) - -#define SOL_RAW_IS_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) != 0) -#define SOL_RAW_IS_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3) == 0) -#define SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL) ((3 OP_SYMBOL 3) > 3) -#define SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL) ((3 OP_SYMBOL 3 OP_SYMBOL 3) < 0) - -#define SOL_IS_ON(OP_SYMBOL) SOL_RAW_IS_ON(OP_SYMBOL ## _I_) -#define SOL_IS_OFF(OP_SYMBOL) SOL_RAW_IS_OFF(OP_SYMBOL ## _I_) -#define SOL_IS_DEFAULT_ON(OP_SYMBOL) SOL_RAW_IS_DEFAULT_ON(OP_SYMBOL ## _I_) -#define SOL_IS_DEFAULT_OFF(OP_SYMBOL) SOL_RAW_IS_DEFAULT_OFF(OP_SYMBOL ## _I_) - -#define SOL_ON | -#define SOL_OFF ^ -#define SOL_DEFAULT_ON + -#define SOL_DEFAULT_OFF - - -#if defined(SOL_BUILD_CXX_MODE) - #if (SOL_BUILD_CXX_MODE != 0) - #define SOL_BUILD_CXX_MODE_I_ SOL_ON - #else - #define SOL_BUILD_CXX_MODE_I_ SOL_OFF - #endif -#elif defined(__cplusplus) - #define SOL_BUILD_CXX_MODE_I_ SOL_DEFAULT_ON -#else - #define SOL_BUILD_CXX_MODE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_BUILD_C_MODE) - #if (SOL_BUILD_C_MODE != 0) - #define SOL_BUILD_C_MODE_I_ SOL_ON - #else - #define SOL_BUILD_C_MODE_I_ SOL_OFF - #endif -#elif defined(__STDC__) - #define SOL_BUILD_C_MODE_I_ SOL_DEFAULT_ON -#else - #define SOL_BUILD_C_MODE_I_ SOL_DEFAULT_OFF -#endif - -#if SOL_IS_ON(SOL_BUILD_C_MODE) - #include - #include - #include -#else - #include - #include - #include -#endif - -#if defined(SOL_COMPILER_VCXX) - #if defined(SOL_COMPILER_VCXX != 0) - #define SOL_COMPILER_VCXX_I_ SOL_ON - #else - #define SOL_COMPILER_VCXX_I_ SOL_OFF - #endif -#elif defined(_MSC_VER) - #define SOL_COMPILER_VCXX_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_VCXX_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_GCC) - #if defined(SOL_COMPILER_GCC != 0) - #define SOL_COMPILER_GCC_I_ SOL_ON - #else - #define SOL_COMPILER_GCC_I_ SOL_OFF - #endif -#elif defined(__GNUC__) - #define SOL_COMPILER_GCC_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_GCC_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_CLANG) - #if defined(SOL_COMPILER_CLANG != 0) - #define SOL_COMPILER_CLANG_I_ SOL_ON - #else - #define SOL_COMPILER_CLANG_I_ SOL_OFF - #endif -#elif defined(__clang__) - #define SOL_COMPILER_CLANG_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_CLANG_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_EDG) - #if defined(SOL_COMPILER_EDG != 0) - #define SOL_COMPILER_EDG_I_ SOL_ON - #else - #define SOL_COMPILER_EDG_I_ SOL_OFF - #endif -#else - #define SOL_COMPILER_EDG_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_COMPILER_MINGW) - #if (SOL_COMPILER_MINGW != 0) - #define SOL_COMPILER_MINGW_I_ SOL_ON - #else - #define SOL_COMPILER_MINGW_I_ SOL_OFF - #endif -#elif defined(__MINGW32__) - #define SOL_COMPILER_MINGW_I_ SOL_DEFAULT_ON -#else - #define SOL_COMPILER_MINGW_I_ SOL_DEFAULT_OFF -#endif - -#if SIZE_MAX <= 0xFFFFULL - #define SOL_PLATFORM_X16_I_ SOL_ON - #define SOL_PLATFORM_X86_I_ SOL_OFF - #define SOL_PLATFORM_X64_I_ SOL_OFF -#elif SIZE_MAX <= 0xFFFFFFFFULL - #define SOL_PLATFORM_X16_I_ SOL_OFF - #define SOL_PLATFORM_X86_I_ SOL_ON - #define SOL_PLATFORM_X64_I_ SOL_OFF -#else - #define SOL_PLATFORM_X16_I_ SOL_OFF - #define SOL_PLATFORM_X86_I_ SOL_OFF - #define SOL_PLATFORM_X64_I_ SOL_ON -#endif - -#define SOL_PLATFORM_ARM32_I_ SOL_OFF -#define SOL_PLATFORM_ARM64_I_ SOL_OFF - -#if defined(SOL_PLATFORM_WINDOWS) - #if (SOL_PLATFORM_WINDOWS != 0) - #define SOL_PLATFORM_WINDOWS_I_ SOL_ON - #else - #define SOL_PLATFORM_WINDOWS_I_ SOL_OFF - #endif -#elif defined(_WIN32) - #define SOL_PLATFORM_WINDOWS_I_ SOL_DEFAULT_ON -#else - #define SOL_PLATFORM_WINDOWS_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_CYGWIN) - #if (SOL_PLATFORM_CYGWIN != 0) - #define SOL_PLATFORM_CYGWIN_I_ SOL_ON - #else - #define SOL_PLATFORM_CYGWIN_I_ SOL_ON - #endif -#elif defined(__CYGWIN__) - #define SOL_PLATFORM_CYGWIN_I_ SOL_DEFAULT_ON -#else - #define SOL_PLATFORM_CYGWIN_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_APPLE) - #if (SOL_PLATFORM_APPLE != 0) - #define SOL_PLATFORM_APPLE_I_ SOL_ON - #else - #define SOL_PLATFORM_APPLE_I_ SOL_OFF - #endif -#elif defined(__APPLE__) - #define SOL_PLATFORM_APPLE_I_ SOL_DEFAULT_ON -#else - #define SOL_PLATFORM_APPLE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_UNIX) - #if (SOL_PLATFORM_UNIX != 0) - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_ON - #else - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_OFF - #endif -#elif defined(__unix__) - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_DEFAUKT_ON -#else - #define SOL_PLATFORM_UNIXLIKE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_PLATFORM_LINUX) - #if (SOL_PLATFORM_LINUX != 0) - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_ON - #else - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_OFF - #endif -#elif defined(__LINUX__) - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_DEFAUKT_ON -#else - #define SOL_PLATFORM_LINUXLIKE_I_ SOL_DEFAULT_OFF -#endif - -#define SOL_PLATFORM_APPLE_IPHONE_I_ SOL_OFF -#define SOL_PLATFORM_BSDLIKE_I_ SOL_OFF - -#if defined(SOL_IN_DEBUG_DETECTED) - #if SOL_IN_DEBUG_DETECTED != 0 - #define SOL_DEBUG_BUILD_I_ SOL_ON - #else - #define SOL_DEBUG_BUILD_I_ SOL_OFF - #endif -#elif !defined(NDEBUG) - #if SOL_IS_ON(SOL_COMPILER_VCXX) && defined(_DEBUG) - #define SOL_DEBUG_BUILD_I_ SOL_ON - #elif (SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC)) && !defined(__OPTIMIZE__) - #define SOL_DEBUG_BUILD_I_ SOL_ON - #else - #define SOL_DEBUG_BUILD_I_ SOL_OFF - #endif -#else - #define SOL_DEBUG_BUILD_I_ SOL_DEFAULT_OFF -#endif // We are in a debug mode of some sort - -#if defined(SOL_NO_EXCEPTIONS) - #if (SOL_NO_EXCEPTIONS != 0) - #define SOL_EXCEPTIONS_I_ SOL_OFF - #else - #define SOL_EXCEPTIONS_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_VCXX) - #if !defined(_CPPUNWIND) - #define SOL_EXCEPTIONS_I_ SOL_OFF - #else - #define SOL_EXCEPTIONS_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC) - #if !defined(__EXCEPTIONS) - #define SOL_EXCEPTIONS_I_ SOL_OFF - #else - #define SOL_EXCEPTIONS_I_ SOL_ON - #endif -#else - #define SOL_EXCEPTIONS_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_NO_RTTI) - #if (SOL_NO_RTTI != 0) - #define SOL_RTTI_I_ SOL_OFF - #else - #define SOL_RTTI_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_VCXX) - #if !defined(_CPPRTTI) - #define SOL_RTTI_I_ SOL_OFF - #else - #define SOL_RTTI_I_ SOL_ON - #endif -#elif SOL_IS_ON(SOL_COMPILER_CLANG) || SOL_IS_ON(SOL_COMPILER_GCC) - #if !defined(__GXX_RTTI) - #define SOL_RTTI_I_ SOL_OFF - #else - #define SOL_RTTI_I_ SOL_ON - #endif -#else - #define SOL_RTTI_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_NO_THREAD_LOCAL) - #if SOL_NO_THREAD_LOCAL != 0 - #define SOL_USE_THREAD_LOCAL_I_ SOL_OFF - #else - #define SOL_USE_THREAD_LOCAL_I_ SOL_ON - #endif -#else - #define SOL_USE_THREAD_LOCAL_I_ SOL_DEFAULT_ON -#endif // thread_local keyword is bjorked on some platforms - -#if defined(SOL_ALL_SAFETIES_ON) - #if SOL_ALL_SAFETIES_ON != 0 - #define SOL_ALL_SAFETIES_ON_I_ SOL_ON - #else - #define SOL_ALL_SAFETIES_ON_I_ SOL_OFF - #endif -#else - #define SOL_ALL_SAFETIES_ON_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_SAFE_GETTER) - #if SOL_SAFE_GETTER != 0 - #define SOL_SAFE_GETTER_I_ SOL_ON - #else - #define SOL_SAFE_GETTER_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_GETTER_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_GETTER_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_USERTYPE) - #if SOL_SAFE_USERTYPE != 0 - #define SOL_SAFE_USERTYPE_I_ SOL_ON - #else - #define SOL_SAFE_USERTYPE_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_USERTYPE_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_USERTYPE_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_REFERENCES) - #if SOL_SAFE_REFERENCES != 0 - #define SOL_SAFE_REFERENCES_I_ SOL_ON - #else - #define SOL_SAFE_REFERENCES_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_REFERENCES_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_REFERENCES_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_FUNCTIONS) - #if SOL_SAFE_FUNCTIONS != 0 - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON - #else - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_OFF - #endif -#elif defined (SOL_SAFE_FUNCTION_OBJECTS) - #if SOL_SAFE_FUNCTION_OBJECTS != 0 - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON - #else - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_FUNCTION_OBJECTS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_FUNCTION_CALLS) - #if SOL_SAFE_FUNCTION_CALLS != 0 - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON - #else - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_FUNCTION_CALLS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_PROXIES) - #if SOL_SAFE_PROXIES != 0 - #define SOL_SAFE_PROXIES_I_ SOL_ON - #else - #define SOL_SAFE_PROXIES_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_PROXIES_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_PROXIES_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_SAFE_NUMERICS) - #if SOL_SAFE_NUMERICS != 0 - #define SOL_SAFE_NUMERICS_I_ SOL_ON - #else - #define SOL_SAFE_NUMERICS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_NUMERICS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_NUMERICS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_ALL_INTEGER_VALUES_FIT) - #if (SOL_ALL_INTEGER_VALUES_FIT != 0) - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_ON - #else - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_OFF - #endif -#elif !SOL_IS_DEFAULT_OFF(SOL_SAFE_NUMERICS) && SOL_IS_OFF(SOL_SAFE_NUMERICS) - // if numerics is intentionally turned off, flip this on - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_DEFAULT_ON -#else - // default to off - #define SOL_ALL_INTEGER_VALUES_FIT_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_SAFE_STACK_CHECK) - #if SOL_SAFE_STACK_CHECK != 0 - #define SOL_SAFE_STACK_CHECK_I_ SOL_ON - #else - #define SOL_SAFE_STACK_CHECK_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_SAFE_STACK_CHECK_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_ON - #else - #define SOL_SAFE_STACK_CHECK_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_NO_CHECK_NUMBER_PRECISION) - #if SOL_NO_CHECK_NUMBER_PRECISION != 0 - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF - #else - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #endif -#elif defined(SOL_NO_CHECKING_NUMBER_PRECISION) - #if SOL_NO_CHECKING_NUMBER_PRECISION != 0 - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_OFF - #else - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #elif SOL_IS_ON(SOL_SAFE_NUMERICS) - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_ON - #else - #define SOL_NUMBER_PRECISION_CHECKS_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_STRINGS_ARE_NUMBERS) - #if (SOL_STRINGS_ARE_NUMBERS != 0) - #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_ON - #else - #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_OFF - #endif -#else - #define SOL_STRINGS_ARE_NUMBERS_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_ENABLE_INTEROP) - #if SOL_ENABLE_INTEROP != 0 - #define SOL_USE_INTEROP_I_ SOL_ON - #else - #define SOL_USE_INTEROP_I_ SOL_OFF - #endif -#elif defined(SOL_USE_INTEROP) - #if SOL_USE_INTEROP != 0 - #define SOL_USE_INTEROP_I_ SOL_ON - #else - #define SOL_USE_INTEROP_I_ SOL_OFF - #endif -#else - #define SOL_USE_INTEROP_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_NO_NIL) - #if (SOL_NO_NIL != 0) - #define SOL_NIL_I_ SOL_OFF - #else - #define SOL_NIL_I_ SOL_ON - #endif -#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil) - #define SOL_NIL_I_ SOL_DEFAULT_OFF -#else - #define SOL_NIL_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_USERTYPE_TYPE_BINDING_INFO) - #if (SOL_USERTYPE_TYPE_BINDING_INFO != 0) - #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_ON - #else - #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_OFF - #endif -#else - #define SOL_USERTYPE_TYPE_BINDING_INFO_I_ SOL_DEFAULT_ON -#endif // We should generate a my_type.__type table with lots of class information for usertypes - -#if defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT) - #if (SOL_AUTOMAGICAL_TYPES_BY_DEFAULT != 0) - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON - #else - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF - #endif -#elif defined(SOL_DEFAULT_AUTOMAGICAL_USERTYPES) - #if (SOL_DEFAULT_AUTOMAGICAL_USERTYPES != 0) - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_ON - #else - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_OFF - #endif -#else - #define SOL_DEFAULT_AUTOMAGICAL_USERTYPES_I_ SOL_DEFAULT_ON -#endif // make is_automagical on/off by default - -#if defined(SOL_STD_VARIANT) - #if (SOL_STD_VARIANT != 0) - #define SOL_STD_VARIANT_I_ SOL_ON - #else - #define SOL_STD_VARIANT_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_COMPILER_CLANG) && SOL_IS_ON(SOL_PLATFORM_APPLE) - #if defined(__has_include) - #if __has_include() - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON - #else - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_OFF - #endif - #else - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_OFF - #endif - #else - #define SOL_STD_VARIANT_I_ SOL_DEFAULT_ON - #endif -#endif // make is_automagical on/off by default - -#if defined(SOL_NOEXCEPT_FUNCTION_TYPE) - #if (SOL_NOEXCEPT_FUNCTION_TYPE != 0) - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON - #else - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF - #endif -#else - #if defined(__cpp_noexcept_function_type) - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_ON - #elif SOL_IS_ON(SOL_COMPILER_VCXX) && (defined(_MSVC_LANG) && (_MSVC_LANG < 201403L)) - // There is a bug in the VC++ compiler?? - // on /std:c++latest under x86 conditions (VS 15.5.2), - // compiler errors are tossed for noexcept markings being on function types - // that are identical in every other way to their non-noexcept marked types function types... - // VS 2019: There is absolutely a bug. - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_OFF - #else - #define SOL_USE_NOEXCEPT_FUNCTION_TYPE_I_ SOL_DEFAULT_ON - #endif -#endif // noexcept is part of a function's type - -#if defined(SOL_STACK_STRING_OPTIMIZATION_SIZE) && SOL_STACK_STRING_OPTIMIZATION_SIZE > 0 - #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ SOL_STACK_STRING_OPTIMIZATION_SIZE -#else - #define SOL_OPTIMIZATION_STRING_CONVERSION_STACK_SIZE_I_ 1024 -#endif - -#if defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 - #define SOL_ID_SIZE_I_ SOL_ID_SIZE -#else - #define SOL_ID_SIZE_I_ 512 -#endif - -#if defined(LUA_IDSIZE) && LUA_IDSIZE > 0 - #define SOL_FILE_ID_SIZE_I_ LUA_IDSIZE -#elif defined(SOL_ID_SIZE) && SOL_ID_SIZE > 0 - #define SOL_FILE_ID_SIZE_I_ SOL_FILE_ID_SIZE -#else - #define SOL_FILE_ID_SIZE_I_ 2048 -#endif - -#if defined(SOL_PRINT_ERRORS) - #if (SOL_PRINT_ERRORS != 0) - #define SOL_PRINT_ERRORS_I_ SOL_ON - #else - #define SOL_PRINT_ERRORS_I_ SOL_OFF - #endif -#else - #if SOL_IS_ON(SOL_ALL_SAFETIES_ON) - #define SOL_PRINT_ERRORS_I_ SOL_ON - #elif SOL_IS_ON(SOL_DEBUG_BUILD) - #define SOL_PRINT_ERRORS_I_ SOL_DEFAULT_ON - #else - #define SOL_PRINT_ERRORS_I_ SOL_OFF - #endif -#endif - -#if defined(SOL_DEFAULT_PASS_ON_ERROR) - #if (SOL_DEFAULT_PASS_ON_ERROR != 0) - #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_ON - #else - #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_OFF - #endif -#else - #define SOL_DEFAULT_PASS_ON_ERROR_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_USING_CXX_LUA) - #if (SOL_USING_CXX_LUA != 0) - #define SOL_USE_CXX_LUA_I_ SOL_ON - #else - #define SOL_USE_CXX_LUA_I_ SOL_OFF - #endif -#elif defined(SOL_USE_CXX_LUA) - #if (SOL_USE_CXX_LUA != 0) - #define SOL_USE_CXX_LUA_I_ SOL_ON - #else - #define SOL_USE_CXX_LUA_I_ SOL_OFF - #endif -#else - #define SOL_USE_CXX_LUA_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_USING_CXX_LUAJIT) - #if (SOL_USING_CXX_LUA != 0) - #define SOL_USE_CXX_LUAJIT_I_ SOL_ON - #else - #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF - #endif -#elif defined(SOL_USE_CXX_LUAJIT) - #if (SOL_USE_CXX_LUA != 0) - #define SOL_USE_CXX_LUAJIT_I_ SOL_ON - #else - #define SOL_USE_CXX_LUAJIT_I_ SOL_OFF - #endif -#else - #define SOL_USE_CXX_LUAJIT_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_NO_LUA_HPP) - #if (SOL_NO_LUA_HPP != 0) - #define SOL_USE_LUA_HPP_I_ SOL_OFF - #else - #define SOL_USE_LUA_HPP_I_ SOL_ON - #endif -#elif defined(SOL_USING_CXX_LUA) - #define SOL_USE_LUA_HPP_I_ SOL_OFF -#elif defined(__has_include) - #if __has_include() - #define SOL_USE_LUA_HPP_I_ SOL_ON - #else - #define SOL_USE_LUA_HPP_I_ SOL_OFF - #endif -#else - #define SOL_USE_LUA_HPP_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_CONTAINERS_START) - #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START -#elif defined(SOL_CONTAINERS_START_INDEX) - #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINERS_START_INDEX -#elif defined(SOL_CONTAINER_START_INDEX) - #define SOL_CONTAINER_START_INDEX_I_ SOL_CONTAINER_START_INDEX -#else - #define SOL_CONTAINER_START_INDEX_I_ 1 -#endif - -#if defined (SOL_NO_MEMORY_ALIGNMENT) - #if (SOL_NO_MEMORY_ALIGNMENT != 0) - #define SOL_ALIGN_MEMORY_I_ SOL_OFF - #else - #define SOL_ALIGN_MEMORY_I_ SOL_ON - #endif -#else - #define SOL_ALIGN_MEMORY_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_USE_BOOST) - #if (SOL_USE_BOOST != 0) - #define SOL_USE_BOOST_I_ SOL_ON - #else - #define SOL_USE_BOOST_I_ SOL_OFF - #endif -#else - #define SOL_USE_BOOST_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_USE_UNSAFE_BASE_LOOKUP) - #if (SOL_USE_UNSAFE_BASE_LOOKUP != 0) - #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_ON - #else - #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_OFF - #endif -#else - #define SOL_USE_UNSAFE_BASE_LOOKUP_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_INSIDE_UNREAL) - #if (SOL_INSIDE_UNREAL != 0) - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_ON - #else - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_OFF - #endif -#else - #if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_SERVER) - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_ON - #else - #define SOL_INSIDE_UNREAL_ENGINE_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if defined(SOL_NO_COMPAT) - #if (SOL_NO_COMPAT != 0) - #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_OFF - #else - #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_ON - #endif -#else - #define SOL_USE_COMPATIBILITY_LAYER_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_GET_FUNCTION_POINTER_UNSAFE) - #if (SOL_GET_FUNCTION_POINTER_UNSAFE != 0) - #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_ON - #else - #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_OFF - #endif -#else - #define SOL_GET_FUNCTION_POINTER_UNSAFE_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_FUNCTION_CALL_VALUE_SEMANTICS) - #if (SOL_FUNCTION_CALL_VALUE_SEMANTICS != 0) - #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_ON - #else - #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_OFF - #endif -#else - #define SOL_FUNCTION_CALL_VALUE_SEMANTICS_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_MINGW_CCTYPE_IS_POISONED) - #if (SOL_MINGW_CCTYPE_IS_POISONED != 0) - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_ON - #else - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_OFF - #endif -#elif SOL_IS_ON(SOL_COMPILER_MINGW) && defined(__GNUC__) && (__GNUC__ < 6) - // MinGW is off its rocker in some places... - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_ON -#else - #define SOL_MINGW_CCTYPE_IS_POISONED_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_CHAR8_T) - #if (SOL_CHAR8_T != 0) - #define SOL_CHAR8_T_I_ SOL_ON - #else - #define SOL_CHAR8_T_I_ SOL_OFF - #endif -#else - #if defined(__cpp_char8_t) - #define SOL_CHAR8_T_I_ SOL_DEFAULT_ON - #else - #define SOL_CHAR8_T_I_ SOL_DEFAULT_OFF - #endif -#endif - -#if SOL_IS_ON(SOL_USE_BOOST) - #include - - #if BOOST_VERSION >= 107500 // Since Boost 1.75.0 boost::none is constexpr - #define SOL_BOOST_NONE_CONSTEXPR_I_ constexpr - #else - #define SOL_BOOST_NONE_CONSTEXPR_I_ const - #endif // BOOST_VERSION -#else - // assume boost isn't using a garbage version - #define SOL_BOOST_NONE_CONSTEXPR_I_ constexpr -#endif - -#if defined(SOL2_CI) - #if (SOL2_CI != 0) - #define SOL2_CI_I_ SOL_ON - #else - #define SOL2_CI_I_ SOL_OFF - #endif -#else - #define SOL2_CI_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_C_ASSERT) - #define SOL_USER_C_ASSERT_I_ SOL_ON -#else - #define SOL_USER_C_ASSERT_I_ SOL_DEFAULT_OFF -#endif - -#if defined(SOL_M_ASSERT) - #define SOL_USER_M_ASSERT_I_ SOL_ON -#else - #define SOL_USER_M_ASSERT_I_ SOL_DEFAULT_OFF -#endif - -// beginning of sol/prologue.hpp - -#if defined(SOL_PROLOGUE_I_) - #error "[sol2] Library Prologue was already included in translation unit and not properly ended with an epilogue." -#endif - -#define SOL_PROLOGUE_I_ 1 - -#if SOL_IS_ON(SOL_BUILD_CXX_MODE) - #define _FWD(...) static_cast( __VA_ARGS__ ) - - #if SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define _MOVE(...) static_cast<__typeof( __VA_ARGS__ )&&>( __VA_ARGS__ ) - #else - #include - - #define _MOVE(...) static_cast<::std::remove_reference_t<( __VA_ARGS__ )>&&>( __VA_OPT__(,) ) - #endif -#endif - -// end of sol/prologue.hpp - -// beginning of sol/epilogue.hpp - -#if !defined(SOL_PROLOGUE_I_) - #error "[sol2] Library Prologue is missing from this translation unit." -#else - #undef SOL_PROLOGUE_I_ -#endif - -#if SOL_IS_ON(SOL_BUILD_CXX_MODE) - #undef _FWD - #undef _MOVE -#endif - -// end of sol/epilogue.hpp - -// beginning of sol/detail/build_version.hpp - -#if defined(SOL_DLL) - #if (SOL_DLL != 0) - #define SOL_DLL_I_ SOL_ON - #else - #define SOL_DLL_I_ SOL_OFF - #endif -#elif SOL_IS_ON(SOL_COMPILER_VCXX) && (defined(DLL_) || defined(_DLL)) - #define SOL_DLL_I_ SOL_DEFAULT_ON -#else - #define SOL_DLL_I_ SOL_DEFAULT_OFF -#endif // DLL definition - -#if defined(SOL_HEADER_ONLY) - #if (SOL_HEADER_ONLY != 0) - #define SOL_HEADER_ONLY_I_ SOL_ON - #else - #define SOL_HEADER_ONLY_I_ SOL_OFF - #endif -#else - #define SOL_HEADER_ONLY_I_ SOL_DEFAULT_OFF -#endif // Header only library - -#if defined(SOL_BUILD) - #if (SOL_BUILD != 0) - #define SOL_BUILD_I_ SOL_ON - #else - #define SOL_BUILD_I_ SOL_OFF - #endif -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_BUILD_I_ SOL_DEFAULT_OFF -#else - #define SOL_BUILD_I_ SOL_DEFAULT_ON -#endif - -#if defined(SOL_UNITY_BUILD) - #if (SOL_UNITY_BUILD != 0) - #define SOL_UNITY_BUILD_I_ SOL_ON - #else - #define SOL_UNITY_BUILD_I_ SOL_OFF - #endif -#else - #define SOL_UNITY_BUILD_I_ SOL_DEFAULT_OFF -#endif // Header only library - -#if defined(SOL_C_FUNCTION_LINKAGE) - #define SOL_C_FUNCTION_LINKAGE_I_ SOL_C_FUNCTION_LINKAGE -#else - #if SOL_IS_ON(SOL_BUILD_CXX_MODE) - // C++ - #define SOL_C_FUNCTION_LINKAGE_I_ extern "C" - #else - // normal - #define SOL_C_FUNCTION_LINKAGE_I_ - #endif // C++ or not -#endif // Linkage specification for C functions - -#if defined(SOL_API_LINKAGE) - #define SOL_API_LINKAGE_I_ SOL_API_LINKAGE -#else - #if SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) || SOL_IS_ON(SOL_PLATFORM_WINDOWS) || SOL_IS_ON(SOL_PLATFORM_CYGWIN) - // MSVC Compiler; or, Windows, or Cygwin platforms - #if SOL_IS_ON(SOL_BUILD) - // Building the library - #if SOL_IS_ON(SOL_COMPILER_GCC) - // Using GCC - #define SOL_API_LINKAGE_I_ __attribute__((dllexport)) - #else - // Using Clang, MSVC, etc... - #define SOL_API_LINKAGE_I_ __declspec(dllexport) - #endif - #else - #if SOL_IS_ON(SOL_COMPILER_GCC) - #define SOL_API_LINKAGE_I_ __attribute__((dllimport)) - #else - #define SOL_API_LINKAGE_I_ __declspec(dllimport) - #endif - #endif - #else - // extern if building normally on non-MSVC - #define SOL_API_LINKAGE_I_ extern - #endif - #elif SOL_IS_ON(SOL_UNITY_BUILD) - // Built-in library, like how stb typical works - #if SOL_IS_ON(SOL_HEADER_ONLY) - // Header only, so functions are defined "inline" - #define SOL_API_LINKAGE_I_ inline - #else - // Not header only, so seperately compiled files - #define SOL_API_LINKAGE_I_ extern - #endif - #else - // Normal static library - #if SOL_IS_ON(SOL_BUILD_CXX_MODE) - #define SOL_API_LINKAGE_I_ - #else - #define SOL_API_LINKAGE_I_ extern - #endif - #endif // DLL or not -#endif // Build definitions - -#if defined(SOL_PUBLIC_FUNC_DECL) - #define SOL_PUBLIC_FUNC_DECL_I_ SOL_PUBLIC_FUNC_DECL -#else - #define SOL_PUBLIC_FUNC_DECL_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_INTERNAL_FUNC_DECL_) - #define SOL_INTERNAL_FUNC_DECL_I_ SOL_INTERNAL_FUNC_DECL_ -#else - #define SOL_INTERNAL_FUNC_DECL_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_PUBLIC_FUNC_DEF) - #define SOL_PUBLIC_FUNC_DEF_I_ SOL_PUBLIC_FUNC_DEF -#else - #define SOL_PUBLIC_FUNC_DEF_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_INTERNAL_FUNC_DEF) - #define SOL_INTERNAL_FUNC_DEF_I_ SOL_INTERNAL_FUNC_DEF -#else - #define SOL_INTERNAL_FUNC_DEF_I_ SOL_API_LINKAGE_I_ -#endif - -#if defined(SOL_FUNC_DECL) - #define SOL_FUNC_DECL_I_ SOL_FUNC_DECL -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_FUNC_DECL_I_ -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_FUNC_DECL_I_ extern __declspec(dllexport) - #else - #define SOL_FUNC_DECL_I_ extern __declspec(dllimport) - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_FUNC_DECL_I_ extern __attribute__((visibility("default"))) - #else - #define SOL_FUNC_DECL_I_ extern - #endif -#endif - -#if defined(SOL_FUNC_DEFN) - #define SOL_FUNC_DEFN_I_ SOL_FUNC_DEFN -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_FUNC_DEFN_I_ inline -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_FUNC_DEFN_I_ __declspec(dllexport) - #else - #define SOL_FUNC_DEFN_I_ __declspec(dllimport) - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_FUNC_DEFN_I_ __attribute__((visibility("default"))) - #else - #define SOL_FUNC_DEFN_I_ - #endif -#endif - -#if defined(SOL_HIDDEN_FUNC_DECL) - #define SOL_HIDDEN_FUNC_DECL_I_ SOL_HIDDEN_FUNC_DECL -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_HIDDEN_FUNC_DECL_I_ -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_HIDDEN_FUNC_DECL_I_ extern __declspec(dllexport) - #else - #define SOL_HIDDEN_FUNC_DECL_I_ extern __declspec(dllimport) - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_HIDDEN_FUNC_DECL_I_ extern __attribute__((visibility("default"))) - #else - #define SOL_HIDDEN_FUNC_DECL_I_ extern - #endif -#endif - -#if defined(SOL_HIDDEN_FUNC_DEFN) - #define SOL_HIDDEN_FUNC_DEFN_I_ SOL_HIDDEN_FUNC_DEFN -#elif SOL_IS_ON(SOL_HEADER_ONLY) - #define SOL_HIDDEN_FUNC_DEFN_I_ inline -#elif SOL_IS_ON(SOL_DLL) - #if SOL_IS_ON(SOL_COMPILER_VCXX) - #if SOL_IS_ON(SOL_BUILD) - #define SOL_HIDDEN_FUNC_DEFN_I_ - #else - #define SOL_HIDDEN_FUNC_DEFN_I_ - #endif - #elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG) - #define SOL_HIDDEN_FUNC_DEFN_I_ __attribute__((visibility("hidden"))) - #else - #define SOL_HIDDEN_FUNC_DEFN_I_ - #endif -#endif - -// end of sol/detail/build_version.hpp - -// end of sol/version.hpp - -#if SOL_IS_ON(SOL_INSIDE_UNREAL_ENGINE) -#ifdef check -#pragma push_macro("check") -#undef check -#endif -#endif // Unreal Engine 4 Bullshit - -#if SOL_IS_ON(SOL_COMPILER_GCC) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wshadow" -#pragma GCC diagnostic ignored "-Wconversion" -#if __GNUC__ > 6 -#pragma GCC diagnostic ignored "-Wnoexcept-type" -#endif -#elif SOL_IS_ON(SOL_COMPILER_CLANG) -#elif SOL_IS_ON(SOL_COMPILER_VCXX) -#pragma warning(push) -#pragma warning(disable : 4505) // unreferenced local function has been removed GEE THANKS -#endif // clang++ vs. g++ vs. VC++ - -// beginning of sol/forward.hpp - -#ifndef SOL_FORWARD_HPP -#define SOL_FORWARD_HPP - -#include -#include -#include - -#if SOL_IS_ON(SOL_USE_CXX_LUA) || SOL_IS_ON(SOL_USE_CXX_LUAJIT) -struct lua_State; -#else -extern "C" { -struct lua_State; -} -#endif // C++ Mangling for Lua vs. Not - -namespace sol { - - enum class type; - - class stateless_reference; - template - class basic_reference; - using reference = basic_reference; - using main_reference = basic_reference; - class stateless_stack_reference; - class stack_reference; - - template - class basic_bytecode; - - struct lua_value; - - struct proxy_base_tag; - template - struct proxy_base; - template - struct table_proxy; - - template - class basic_table_core; - template - using table_core = basic_table_core; - template - using main_table_core = basic_table_core; - template - using stack_table_core = basic_table_core; - template - using basic_table = basic_table_core; - using table = table_core; - using global_table = table_core; - using main_table = main_table_core; - using main_global_table = main_table_core; - using stack_table = stack_table_core; - using stack_global_table = stack_table_core; - - template - struct basic_lua_table; - using lua_table = basic_lua_table; - using stack_lua_table = basic_lua_table; - - template - class basic_usertype; - template - using usertype = basic_usertype; - template - using stack_usertype = basic_usertype; - - template - class basic_metatable; - using metatable = basic_metatable; - using stack_metatable = basic_metatable; - - template - struct basic_environment; - using environment = basic_environment; - using main_environment = basic_environment; - using stack_environment = basic_environment; - - template - class basic_function; - template - class basic_protected_function; - using unsafe_function = basic_function; - using safe_function = basic_protected_function; - using main_unsafe_function = basic_function; - using main_safe_function = basic_protected_function; - using stack_unsafe_function = basic_function; - using stack_safe_function = basic_protected_function; - using stack_aligned_unsafe_function = basic_function; - using stack_aligned_safe_function = basic_protected_function; - using protected_function = safe_function; - using main_protected_function = main_safe_function; - using stack_protected_function = stack_safe_function; - using stack_aligned_protected_function = stack_aligned_safe_function; -#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS) - using function = protected_function; - using main_function = main_protected_function; - using stack_function = stack_protected_function; - using stack_aligned_function = stack_aligned_safe_function; -#else - using function = unsafe_function; - using main_function = main_unsafe_function; - using stack_function = stack_unsafe_function; - using stack_aligned_function = stack_aligned_unsafe_function; -#endif - using stack_aligned_stack_handler_function = basic_protected_function; - - struct unsafe_function_result; - struct protected_function_result; - using safe_function_result = protected_function_result; -#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS) - using function_result = safe_function_result; -#else - using function_result = unsafe_function_result; -#endif - - template - class basic_object_base; - template - class basic_object; - template - class basic_userdata; - template - class basic_lightuserdata; - template - class basic_coroutine; - template - class basic_packaged_coroutine; - template - class basic_thread; - - using object = basic_object; - using userdata = basic_userdata; - using lightuserdata = basic_lightuserdata; - using thread = basic_thread; - using coroutine = basic_coroutine; - using packaged_coroutine = basic_packaged_coroutine; - using main_object = basic_object; - using main_userdata = basic_userdata; - using main_lightuserdata = basic_lightuserdata; - using main_coroutine = basic_coroutine; - using stack_object = basic_object; - using stack_userdata = basic_userdata; - using stack_lightuserdata = basic_lightuserdata; - using stack_thread = basic_thread; - using stack_coroutine = basic_coroutine; - - struct stack_proxy_base; - struct stack_proxy; - struct variadic_args; - struct variadic_results; - struct stack_count; - struct this_state; - struct this_main_state; - struct this_environment; - - class state_view; - class state; - - template - struct as_table_t; - template - struct as_container_t; - template - struct nested; - template - struct light; - template - struct user; - template - struct as_args_t; - template - struct protect_t; - template - struct policy_wrapper; - - template - struct usertype_traits; - template - struct unique_usertype_traits; - - template - struct types { - typedef std::make_index_sequence indices; - static constexpr std::size_t size() { - return sizeof...(Args); - } - }; - - template - struct derive : std::false_type { - typedef types<> type; - }; - - template - struct base : std::false_type { - typedef types<> type; - }; - - template - struct weak_derive { - static bool value; - }; - - template - bool weak_derive::value = false; - - namespace stack { - struct record; - } - -#if SOL_IS_OFF(SOL_USE_BOOST) - template - class optional; - - template - class optional; -#endif - - using check_handler_type = int(lua_State*, int, type, type, const char*); - -} // namespace sol - -#define SOL_BASE_CLASSES(T, ...) \ - namespace sol { \ - template <> \ - struct base : std::true_type { \ - typedef ::sol::types<__VA_ARGS__> type; \ - }; \ - } \ - void a_sol3_detail_function_decl_please_no_collide() -#define SOL_DERIVED_CLASSES(T, ...) \ - namespace sol { \ - template <> \ - struct derive : std::true_type { \ - typedef ::sol::types<__VA_ARGS__> type; \ - }; \ - } \ - void a_sol3_detail_function_decl_please_no_collide() - -#endif // SOL_FORWARD_HPP -// end of sol/forward.hpp - -// beginning of sol/forward_detail.hpp - -#ifndef SOL_FORWARD_DETAIL_HPP -#define SOL_FORWARD_DETAIL_HPP - -// beginning of sol/traits.hpp - -// beginning of sol/tuple.hpp - -// beginning of sol/base_traits.hpp - -#include - -namespace sol { - namespace detail { - struct unchecked_t { }; - const unchecked_t unchecked = unchecked_t {}; - } // namespace detail - - namespace meta { - using sfinae_yes_t = std::true_type; - using sfinae_no_t = std::false_type; - - template - using void_t = void; - - template - using unqualified = std::remove_cv>; - - template - using unqualified_t = typename unqualified::type; - - namespace meta_detail { - template - struct unqualified_non_alias : unqualified { }; - - template