Update SigScript

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2, Sig, Sigo 2 years ago
parent 4bda9c304e
commit d795b5df8a
  1. 2
      C++/scripts/md5
  2. 1
      C++/scripts/web.sh
  3. BIN
      C++ProjectTemplate
  4. 75
      C++ProjectTemplate.html
  5. 1
      C++ProjectTemplate.js
  6. BIN
      C++ProjectTemplate.wasm
  7. 13
      main.cpp
  8. BIN
      pixelGameEngine.o
  9. BIN
      pixelGameEngine_wasm.o

@ -4,4 +4,4 @@ debug.sh:849488515cab075948653c15eec4177b -
lines.sh:3b907786f7fc9204025993016c9080de -
release.sh:0ab321c3fa2f1a1b2f03b1aec3bce816 -
temp:d41d8cd98f00b204e9800998ecf8427e -
web.sh:ce7a991e69dd9745f057d06430e51a9e -
web.sh:4bbe9c5710a0ae4289468c3f7f340ff1 -

@ -8,6 +8,7 @@ fi
if [[ "$1" == "full" || "$2" == "full" ]]; then
rm "pixelGameEngine_wasm.o"
fi
source ../emsdk/emsdk_env.sh
if [ ! -f "pixelGameEngine_wasm.o" ]
then
printf "Pixel Game Engine compile object missing. Compiling for the first time..."

Binary file not shown.

@ -0,0 +1,75 @@
<!doctype html>
<html lang="en-us">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Emscripten-Generated Code</title>
<style>
html,body { width: 100%; height: 100%; }
body { font-family: arial; margin: 0; padding: 0; background: #000; }
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
div.emscripten_border { border: none; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; background-color: black; }
</style>
</head>
<body>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
<script type='text/javascript'>
var Module = {
preRun: [],
postRun: [],
canvas: (function() {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
};
</script>
<script async type="text/javascript" src="C++ProjectTemplate.js"></script>
<script type="text/javascript">
Module.canvas.addEventListener("resize", (e) => {
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;
}
// update dom attributes
Module.canvas.setAttribute("width", viewWidth);
Module.canvas.setAttribute("height", viewHeight);
var top = (e.detail.height - viewHeight) / 2;
var left = (e.detail.width - viewWidth) / 2;
// update styles
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 = "";
// trigger PGE update
Module._olc_PGE_UpdateWindowSize(viewWidth, viewHeight);
// ensure canvas has focus
Module.canvas.focus();
e.preventDefault();
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -16,21 +16,34 @@ public:
}
public:
olc::Key last;
bool OnUserCreate() override
{
std::cout<<"Test"<<std::endl;
ConsoleShow(olc::Key::A);
return true;
}
bool OnUserUpdate(float fElapsedTime) override
{
std::cout<<"Test 4"<<std::endl;
ConsoleCaptureStdOut(true);
std::cout<<"Test 2"<<std::endl;
ConsoleCaptureStdOut(false);
std::cout<<"Test 3"<<std::endl;
std::cout<<"A"<<std::endl;
Clear(BLACK);
DrawString({0,0},std::to_string(last));
return true;
}
bool OnUserDestroy()override{
return true;
}
void GetAnyKeyPress(olc::Key pressed)override{
last=pressed;
}
};
enum Direction{

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save