File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,38 @@ The open source code is hosted at [[https://github.com/lunduniversity/introprog-
1818
1919- [[ introprog.examples]] with code examples demonstrating how to use this library.
2020
21- ## How to use this library with ` sbt `
21+ ## How to use introprog-scalalib
22+
23+ ### Using scala-cli
24+
25+ You need [ Scala Command Line Interface] ( https://scala-cli.virtuslab.org/install ) at least version 0.1.5.
26+
27+ Add these magic comment lines starting with ` //> ` in the beginning of your Scala 3 file:
28+
29+ ```
30+ //> using scala "3"
31+ //> using lib "se.lth.cs::introprog:1.3.1"
32+ ```
33+
34+ You run your code with ` scala-cli run . ` (note the ending dot, meaning "this dir")
35+
36+ If your program looks like this:
37+
38+ ```
39+ //> using scala "3"
40+ //> using lib "se.lth.cs::introprog:1.3.1"
41+
42+ @main def run =
43+ val w = introprog.PixelWindow()
44+ w.drawText("Hello introprog.PixelWindow!", x = 100, y = 100)
45+ ```
46+ You should see green text in a new window after executing:
47+ ```
48+ scala-cli run .
49+ ```
50+ See: [ api documentation for PixelWindow] ( https://fileadmin.cs.lth.se/pgk/api/api/introprog/PixelWindow.html )
51+
52+ ### Using sbt
2253
2354If you have [ sbt] ( https://www.scala-sbt.org/ ) installed then you can put this text in a file called ` build.sbt `
2455
You can’t perform that action at this time.
0 commit comments