From a45f6b81f3cb191b3dc70eb77fc95e921709c34e Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Mon, 17 Nov 2014 14:05:52 -0800 Subject: Revising cds2014 samples based on first round of feedback. Adding water.cc to commit history. Sample changed to reduce the need to understand row-major, changed doc to match. Changing python codelab to run locally. Pulling in new web devenv version with better copy paste. BUG=None R=jmedley@chromium.org TBR=binji@chromium.org Review URL: https://codereview.chromium.org/731323003 Cr-Commit-Position: refs/heads/master@{#304492} --- native_client_sdk/doc_generated/cds2014/cpp.html | 10 ++++------ native_client_sdk/doc_generated/cds2014/python.html | 14 ++++++++------ native_client_sdk/doc_generated/sdk/download.html | 5 ++--- native_client_sdk/src/doc/cds2014/cpp.rst | 12 +++--------- native_client_sdk/src/doc/cds2014/python.rst | 12 +++++++----- native_client_sdk/src/doc/nacldev/setup_web.inc | 2 +- 6 files changed, 25 insertions(+), 30 deletions(-) (limited to 'native_client_sdk') diff --git a/native_client_sdk/doc_generated/cds2014/cpp.html b/native_client_sdk/doc_generated/cds2014/cpp.html index 761972e..c437318 100644 --- a/native_client_sdk/doc_generated/cds2014/cpp.html +++ b/native_client_sdk/doc_generated/cds2014/cpp.html @@ -204,6 +204,8 @@ This will require digging into some C++ code.

since you might decide later that you like fire better, I know I do:

 cp fire.cc water.cc
+git add water.cc
+git commit -am "adding water"
 

For this codelab, you’ll only need to change water.cc.

The task of turning fire into water involves two key challenges:

@@ -222,7 +224,7 @@ our flame effect is actually monochrome. A single intensity value is used in the flame simulation. This is then converted to color based on a multi-color gradient. To alter the color-scheme, locate this palette, and exchange -the red component for blue.

+the red component (first) with blue (third).

Hint: Focus your energies on the CreatePalette function.

You can test you changes at any time with:

@@ -234,11 +236,7 @@ While smoke, and well flame, rises, we want our water to go down.

The simulation of fire loops over each pixel, bottom row to top row, diffusing “fire stuff” behind the sweep. -You’ll want to reverse this. -Note the simulation buffer is stored in Row-major order from bottom to top. -Accesses of + width and - width are used to reach rows above and below -the current line.

+You’ll want to reverse this.

Hint: You’ll need to change the y loop direction in the UpdateFlames function.

Up high, down low

While you can now use the mouse to inject a trickle of water. diff --git a/native_client_sdk/doc_generated/cds2014/python.html b/native_client_sdk/doc_generated/cds2014/python.html index bef59c75..4955a4c 100644 --- a/native_client_sdk/doc_generated/cds2014/python.html +++ b/native_client_sdk/doc_generated/cds2014/python.html @@ -43,7 +43,7 @@ if (!('application/x-pnacl' in navigator.mimeTypes)) {

Setup

For this codelab, you will need to point your web browser at the Beta preview of our in-browser NaCl Dev Environment.

-Click here to open the environment.

While no installation is needed, the first load of the page will require you to agree to allow the page unlimited storage (Click “Ok” in the bar at the top of your browser window.)

@@ -191,15 +191,17 @@ Just one thing is missing, that whole diffing thing...

 make
 
-

This will copy the sample to /tmp/differ (clobbering whatever is already -there). It will also attempt to open the sample, but will be blocked by -a popup blocker. Click on the URL to accept the popup.

+

This will attempt to open the sample, but will be blocked by +a popup blocker the first time. Click on the URL to accept the popup. +It also clobbers /tmp/differ for good measure.

As you can see, this isn’t quite what we’re going for.

You’ll want to modify diff.py, using the editor you selected earlier. You’ll probably want to consult the difflib documentation. I would suggest you check out the HtmlDiff class and make use of -the make_file member function. I would also suggest the splitlines +the make_file member function. Note our goal is to create a +full HTML diff, so the make_table function is insufficient. +I would also suggest the splitlines function may come in handy.

You can test diff.py manually as you would in a normal UNIX environment. It can be run like this:

@@ -207,7 +209,7 @@ It can be run like this:

./diff.py before.txt after.txt out.html

Once everything is working diff.html will contain an html diff. -Run make again to deploy and test the full app.

+After the initial make you can hit “Run” to test your changes.

Now get to it, and good luck!

What you’ve learned

While the details of building and packaging Python have been diff --git a/native_client_sdk/doc_generated/sdk/download.html b/native_client_sdk/doc_generated/sdk/download.html index 496bb7d..acb1b32 100644 --- a/native_client_sdk/doc_generated/sdk/download.html +++ b/native_client_sdk/doc_generated/sdk/download.html @@ -23,13 +23,12 @@ command line.

Follow the steps below to download and install the Native Client SDK.

Prerequisites

-

Python 2.7

+

Python 2.7

Make sure that the Python executable is in your PATH variable. Python 3.x is not yet supported.