diff options
author | Li Haoyi <haoyi@dropbox.com> | 2014-11-07 08:51:18 -0800 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2014-11-07 08:51:18 -0800 |
commit | 00b8d7005e233bafced3467174e95cf6edb6eec1 (patch) | |
tree | 8d10038c70fe81e8c47e7b4e0ca95a51f956f410 /book/src/main/scalatex/book/handson | |
parent | 75e505e6a433657cff28501f296605012e1e759a (diff) | |
download | hands-on-scala-js-00b8d7005e233bafced3467174e95cf6edb6eec1.tar.gz hands-on-scala-js-00b8d7005e233bafced3467174e95cf6edb6eec1.tar.bz2 hands-on-scala-js-00b8d7005e233bafced3467174e95cf6edb6eec1.zip |
First flesh out of Semantic Differences
Diffstat (limited to 'book/src/main/scalatex/book/handson')
3 files changed, 3 insertions, 5 deletions
diff --git a/book/src/main/scalatex/book/handson/CanvasApp.scalatex b/book/src/main/scalatex/book/handson/CanvasApp.scalatex index 4d0e2ae..03a3779 100644 --- a/book/src/main/scalatex/book/handson/CanvasApp.scalatex +++ b/book/src/main/scalatex/book/handson/CanvasApp.scalatex @@ -108,7 +108,7 @@ In general, code like this will usually end up being necessary in a Scala.js program: the Javascript APIs that the browser provides to do things often ends up being somewhat roundabout and verbose. It's somewhat annoying to have to do for a small program such as this one, but in a larger application, the cost is both spread out over thousands of lines of code and also typically hidden away in some helpers, so you don't have to mess with this stuff unless you really want to. @sect{Defining our State} - @hl.ref("examples/demos/src/main/scala/canvasapp/FlappyLine.scala", "/*variables*/", end="def runDead") + @hl.ref("examples/demos/src/main/scala/canvasapp/FlappyLine.scala", "/*variables*/", end="def runLive") @p This is where we start defining things that are relevant to Flappy Box. There are roughly two groups of values here: immutable constants in the top group, and mutable variables in the bottom. The rough meaning of each variable is documented in the comments, and we'll see exactly how we use them later. @@ -137,7 +137,7 @@ @p This function basically contains all the game logic, from motion, to collision-detection, to rendering, so it's pretty large. Not that large though! And entirely understandable, even if it takes a few moments to read through. - @hl.ref("examples/demos/src/main/scala/canvasapp/FlappyLine.scala", "def runDead", end="def run") + @hl.ref("examples/demos/src/main/scala/canvasapp/FlappyLine.scala", "def runDead", "def run()") @p This is the function that handles what happens when you're dead. Essentially, we reset all the mutable variables to their initial state, and just count down the @hl.scala{dead} counter until it reaches zero and we're considered alive again. diff --git a/book/src/main/scalatex/book/handson/CommandLine.scalatex b/book/src/main/scalatex/book/handson/CommandLine.scalatex new file mode 100644 index 0000000..30404ce --- /dev/null +++ b/book/src/main/scalatex/book/handson/CommandLine.scalatex @@ -0,0 +1 @@ +TODO
\ No newline at end of file diff --git a/book/src/main/scalatex/book/handson/CrossModules.scalatex b/book/src/main/scalatex/book/handson/CrossModules.scalatex index 8cf5292..3e009d3 100644 --- a/book/src/main/scalatex/book/handson/CrossModules.scalatex +++ b/book/src/main/scalatex/book/handson/CrossModules.scalatex @@ -4,9 +4,6 @@ @p Not all code is developed in the browser. Maybe you want to run simple snippets of Scala.js which don't interact with the browser at all, and having to keep a browser open is an overkill. Maybe you want to write unit tests for your browser-destined code, so you can verify that it works without firing up Chrome. Maybe it's not a simple script but a re-distributable library, and you want to run the same command-line unit tests on both Scala.js and Scala-JVM to verify that the behavior is identical. This chapter will go through all these cases. -@sect{The Scala.js Command Line} - TODO - @sect{A Scala.js Module} TODO |