Skip to content

Commit

Permalink
#206 Created js app and html dev file for DiceLess.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Feb 22, 2023
1 parent 1478ee2 commit 385bf83
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
30 changes: 30 additions & 0 deletions Dev/DevPages/DiceLessSbtFast.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<head>
<title>OpenStrat: DiceLess</title>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width'>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<style>
body { margin: 0px; overflow: hidden; }
</style>
</head>
<body>
<canvas id='scanv'></canvas>
<noscript>
This page will not function properly without Javascript enabled
</noscript>
<script type='text/javascript'>
// aid local development in ensuring script not cached during a simple refresh
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", "../SbtDir/DiceLessJs/target/scala-3.2.2/dicelessjs-fastopt.js?"+Date.now().toString());
document.getElementsByTagName("head")[0].appendChild(script);
script.addEventListener('load', function(e) {
DiceLessJsApp.main();
});
</script>
</body>

</html>
30 changes: 30 additions & 0 deletions Dev/DevPages/DiceLessSbtFull.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<head>
<title>OpenStrat: DiceLess</title>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width'>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<style>
body { margin: 0px; overflow: hidden; }
</style>
</head>
<body>
<canvas id='scanv'></canvas>
<noscript>
This page will not function properly without Javascript enabled
</noscript>
<script type='text/javascript'>
// aid local development in ensuring script not cached during a simple refresh
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", "../SbtDir/DiceLessJs/target/scala-3.2.2/dicelessjs-opt.js?"+Date.now().toString());
document.getElementsByTagName("head")[0].appendChild(script);
script.addEventListener('load', function(e) {
DiceLessJsApp.main();
});
</script>
</body>

</html>
9 changes: 9 additions & 0 deletions Dev/JsAppsSrc/DiceLessApp/DiceLessJsApp.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Copyright 2018-23 Richard Oliver. Licensed under Apache Licence version 2.0. */
package ostrat; package pSJs
import scalajs.js.annotation._, dless._, prid.phex._

@JSExportTopLevel("DiceLessJsApp")
object DiceLessJsApp
{
@JSExport def main(): Unit = DLessGui(CanvasJs, DLessScen1, HGView(141, 524, 20))
}
5 changes: 4 additions & 1 deletion openstrat.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,16 @@ def jsApp(name: String) = mainProj(name, name + "Js").enablePlugins(ScalaJSPlugi
),
)

lazy val DiceLessJs = jsApp("DiceLess").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/DiceLessApp")
lazy val Bc305Js = jsApp("Bc305").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/Bc305App")
lazy val WebGlJs = jsApp("WebGl").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/GlApp")
lazy val ZugJs = jsApp("Zug").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/ZugApp")
lazy val WW2Js = jsApp("WW2").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/WW2App")
lazy val Y1783Js = jsApp("Y1783").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/Y1783App")
lazy val Bc305Js = jsApp("Bc305").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/Bc305App")

lazy val PlanetsJs = jsApp("Planets").settings(Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Dev/JsAppsSrc/PlanetsApp")


val moduleDirs: List[String] = List("Util", "Geom", "Earth", "Tiling", "EGrid", "Dev")
val specDirs: List[String] = List("Util/srcParse", "Geom/src3d", "Geom/srcGui", "Geom/srcWeb", "Earth/srcPts", "Dev/srcGrand")
val CommonDirs: List[String] = moduleDirs.flatMap(m => List(m + "/src", m + "/ExsSrc")) ::: specDirs
Expand Down

0 comments on commit 385bf83

Please sign in to comment.