Include for ScrollingWindowComponent was missing.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/30/head
sigonasr2, Sig, Sigo 11 months ago
parent e669968bc3
commit 516438b451
  1. 12
      .gitignore
  2. 4
      .vscode/settings.json
  3. BIN
      Adventures in Lestoria/Adventures in Lestoria.data
  4. 75
      Adventures in Lestoria/Adventures in Lestoria.html
  5. 1
      Adventures in Lestoria/Adventures in Lestoria.js
  6. BIN
      Adventures in Lestoria/Adventures in Lestoria.wasm
  7. 12
      Adventures in Lestoria/C++/scripts/web.sh
  8. 5
      Adventures in Lestoria/MenuComponent.cpp
  9. 2
      Adventures in Lestoria/ScrollableWindowComponent.h

12
.gitignore vendored

@ -383,3 +383,15 @@ Crawler/out
/Adventures in Lestoria/x64 /Adventures in Lestoria/x64
/Adventures in Lestoria/saves /Adventures in Lestoria/saves
/Adventures in Lestoria/assets/tmpsaves /Adventures in Lestoria/assets/tmpsaves
a.out
build/CMakeCache.txt
build/.cmake/api/v1/query/client-vscode/query.json
build/CMakeFiles/cmake.check_cache
build/CMakeFiles/3.16.3/CMakeCCompiler.cmake
build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake
build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin
build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin
build/CMakeFiles/3.16.3/CMakeSystem.cmake
build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c
build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp
test.cpp

@ -89,6 +89,8 @@
"regex": "cpp", "regex": "cpp",
"valarray": "cpp", "valarray": "cpp",
"*.inc": "cpp", "*.inc": "cpp",
"future": "cpp" "future": "cpp",
"any": "cpp",
"source_location": "cpp"
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 MiB

@ -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="Adventures in Lestoria.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

@ -15,19 +15,19 @@ then
em++ -std=c++20 -O2 ${EMSCRIPTEN_CUSTOM_PARAMS} -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 -s USE_FREETYPE=1 -c pixelGameEngine.cpp -o pixelGameEngine_wasm.o em++ -std=c++20 -O2 ${EMSCRIPTEN_CUSTOM_PARAMS} -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 -s USE_FREETYPE=1 -c pixelGameEngine.cpp -o pixelGameEngine_wasm.o
fi fi
if [ -d "assets" ]; then if [ -d "assets" ]; then
em++ -std=c++20 -O2 ${EMSCRIPTEN_CUSTOM_PARAMS} -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 -s USE_FREETYPE=1 $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine_wasm.o -o ${PROJECT_NAME}.html --preload-file ./assets em++ -std=c++20 -O2 ${EMSCRIPTEN_CUSTOM_PARAMS} -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 -s USE_FREETYPE=1 $(find . -type f -name "*.cpp" -not -path "./discord-files/*" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine_wasm.o -o "${PROJECT_NAME}.html" --preload-file ./assets
else else
em++ -std=c++20 -O2 ${EMSCRIPTEN_CUSTOM_PARAMS} -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 -s USE_FREETYPE=1 $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine_wasm.o -o ${PROJECT_NAME}.html em++ -std=c++20 -O2 ${EMSCRIPTEN_CUSTOM_PARAMS} -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 -s USE_FREETYPE=1 $(find . -type f -name "*.cpp" -not -path "./discord-files/*" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine_wasm.o -o "${PROJECT_NAME}.html"
fi fi
cp buildtemplate.html ${PROJECT_NAME}.html cp buildtemplate.html "${PROJECT_NAME}.html"
sed -i "s/_REPLACEME_/$PROJECT_NAME.js/" ${PROJECT_NAME}.html sed -i "s/_REPLACEME_/$PROJECT_NAME.js/" "${PROJECT_NAME}.html"
if [[ "$1" == "headless" || "$2" == "headless" ]]; then if [[ "$1" == "headless" || "$2" == "headless" ]]; then
echo "Running as headless web server" echo "Running as headless web server"
emrun --no_browser ${PROJECT_NAME}.html emrun --no_browser "${PROJECT_NAME}.html"
else else
emrun --serve_after_close ${PROJECT_NAME}.html emrun --serve_after_close "${PROJECT_NAME}.html"
fi fi
if [ $? -eq 127 ] if [ $? -eq 127 ]

@ -39,6 +39,7 @@ All rights reserved.
#include "MenuComponent.h" #include "MenuComponent.h"
#include "drawutil.h" #include "drawutil.h"
#include "util.h" #include "util.h"
#include "ScrollableWindowComponent.h"
INCLUDE_game INCLUDE_game
@ -211,7 +212,7 @@ void MenuComponent::_OnMouseOut(){
if(runHoverFunctions){ if(runHoverFunctions){
if(hoverState){ if(hoverState){
hoverState=false; hoverState=false;
//onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),dynamic_pointer_cast<ScrollableWindowComponent>(parentComponent.lock())}); onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),dynamic_pointer_cast<ScrollableWindowComponent>(parentComponent.lock())});
OnMouseOut(); OnMouseOut();
} }
} }
@ -221,7 +222,7 @@ void MenuComponent::_OnHover(){
if(hovered){ if(hovered){
if(runHoverFunctions&&!hoverState){ if(runHoverFunctions&&!hoverState){
hoverState=true; hoverState=true;
//onHover(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),dynamic_pointer_cast<ScrollableWindowComponent>(parentComponent.lock())}); onHover(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),dynamic_pointer_cast<ScrollableWindowComponent>(parentComponent.lock())});
OnHover(); OnHover();
} }
} }

@ -71,7 +71,7 @@ public:
} }
} }
virtual inline void RemoveButton(std::weak_ptr<MenuComponent>button){ virtual inline void RemoveButton(std::weak_ptr<MenuComponent>button){
auto componentSearchResults=std::find_if(components.begin(),components.end(),[&](const std::weak_ptr<MenuComponent>&ptr){return ptr.lock()==button.lock();}); auto componentSearchResults=std::find_if(components.begin(),components.end(),[&](std::weak_ptr<MenuComponent>ptr){return &*ptr.lock()==&*button.lock();});
if(componentSearchResults==components.end())ERR("Could not find Component"<<std::quoted(button.lock()->GetName())<<" inside the component list!"); if(componentSearchResults==components.end())ERR("Could not find Component"<<std::quoted(button.lock()->GetName())<<" inside the component list!");
components.erase(componentSearchResults); components.erase(componentSearchResults);
Menu::menus[button.lock()->parentMenu]->RecalculateComponentCount(); Menu::menus[button.lock()->parentMenu]->RecalculateComponentCount();

Loading…
Cancel
Save