graphics - 重新编写并使用重新处理

标签 graphics rescript

我在尝试安装 Reprocessing 时遇到了很多麻烦,Reprocessing 是一种可以从 ReasonML 或 ReScript 使用的基本图形库,并且已经以各种方式进行了更新,但文档/自述文件有点不完整,各种消息来源表明它与全局安装的bucketscript等可能存在冲突。

所以我的问题(我会自己回答)是“2021 年,我如何在 Mac 上安装 Reprocessing 并使演示程序显示一些图形?”

最佳答案

以下是我在运行 Mojave 的 Mac 上执行的一系列操作,其中已经安装了 Node 和 Rescript,我想摆脱它们并从头开始。并非所有步骤都是必要的,但这些步骤有效。值得一提的是,Python 也已安装。为了完成这一切,我打开了一个运行 Bash 的终端窗口。一行中从“//”开始的所有内容都是注释。我的主目录中还有一个名为 cs17 的文件夹,其中有一些先前尝试留下的垃圾。

npm uninstall -g bs-platform          // get rid of bucklescript
nvm deactivate                        // get ready to uninstall Javascript
nvm uninstall node                    // do it
nvm install node                      // start with a fresh Javascript
npm install reprocessing              // use the package manager to install reprocessing
cd ~/cs17                             // go to the target directory
/bin/rm -rf *                         // and clean it out
git clone https://github.com/bsansouci/reprocessing-example.git // grab example code
npm install                           // I don't know why one should do this, but some instruction said to
cd reprocessing-example/              // change to the directory in which the sample code lives

npm install bsb                       // reinstall bsb, so that I can compile ReasonML and ReScript code
npm run build                         // compile everything (for "native" use perhaps?)
npm run build:web                     // compile things so that they can run in a browser
python -m SimpleHTTPServer            // start a simple webserver than can serve up this project

最后,在 Chrome 中,访问 http://localhost:8000/ 并看到一个粉色方 block ,上面绘制了一个较小的蓝色方 block 。成功!

我希望这对其他人有一些用处,即使这不是明确的(甚至不是理性的!)答案。

关于graphics - 重新编写并使用重新处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66717197/

相关文章:

module - 如何在 rescript 中将类型构造函数设为私有(private)(当前模块除外)?

arrays - 如何在 ReScript 中一般遍历数组?

r - ggplot2 轴标签分组

graphics - Skia 或 Direct2D 如何使用 GPU 渲染线或多边形?

java - 将缓冲图像保存为 gif

ocaml - 如何编写自定义 ppx 装饰器来重写脚本?

c# - 如何在 Unity 中屏蔽自定义 UI 图形?

javascript - 在cocos2d-js中绘制切片

javascript - 如何在没有突变的情况下按功能创建有效的组?