Skip to content

Commit af4e1c0

Browse files
committed
update readme, add scala repl, lib -> dep, bump versions etc
1 parent e86d1dd commit af4e1c0

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,31 @@ This repo is used in this course *(in Swedish)*: http://cs.lth.se/pgk with cours
1515

1616
## How to use introprog-scalalib
1717

18-
### Using scala-cli
18+
### Getting started using scala from the command line
1919

20-
You need [Scala Command Line Interface](https://scala-cli.virtuslab.org/install) at least version 1.0.0.
20+
You need to have [Scala installed](https://www.scala-lang.org/download/) using version 3.5.2 or later.
2121

22-
Add these magic comment lines starting with `//>` in the beginning of your Scala 3 file (bump your Scala version to the latest available):
22+
You can start the Scala REPL in the current directory with `introprog` directly available to play with using this command in a terminal window:
23+
```
24+
scala repl . --dep se.lth.cs::introprog:1.4.0
25+
```
26+
27+
You can then open a drawing window like so:
28+
```scala
29+
scala> val w = introprog.PixelWindow()
30+
val w: introprog.PixelWindow = introprog.PixelWindow@34f60be9
31+
32+
scala> w.drawText("Hello introprog.PixelWindow!", x = 100, y = 100)
33+
```
34+
35+
If you want to use `introprog` in your program, add these magic comment lines starting with `//>` in the beginning of your Scala 3 file (update the version number after `//> using scala` to the [latest release](https://www.scala-lang.org/)):
2336

2437
```
2538
//> using scala 3.5.2
2639
//> using dep se.lth.cs::introprog:1.3.1
2740
```
2841

29-
You run your code with `scala-cli run .` (note the ending dot, meaning "this dir")
42+
You can then run your code with `scala run .` (note the ending dot, meaning "current dir")
3043

3144
If your program looks like this:
3245

@@ -42,20 +55,18 @@ You should see green text in a new window after executing:
4255
```
4356
scala-cli run .
4457
```
45-
See: [api documentation for PixelWindow](https://fileadmin.cs.lth.se/pgk/api/api/introprog/PixelWindow.html)
58+
See: [api documentation for PixelWindow](https://fileadmin.cs.lth.se/pgk/api/api/introprog/PixelWindow.html) for more things you can do with a PixelWindow.
4659

47-
You can also give the `introprog` dependency directly at the command line, instead of the `using lib` directive:
60+
You can also give the `introprog` dependency directly at the command line, instead of the `using dep` directive:
4861
```
4962
scala-cli run . --dep se.lth.cs::introprog:1.4.0
5063
```
5164

52-
### Using sbt
65+
### Getting started using sbt
5366

54-
You need [Scala Build Tool](https://www.scala-sbt.org/download.html) at least version 1.5.2 (preferably 1.6.2 or later).
55-
56-
Put this text in a file called `build.sbt`
67+
If you use the [Scala Build Tool, version 1.6 or later](https://www.scala-sbt.org/download.html) then put this text in a file called `build.sbt`
5768
```
58-
scalaVersion := "3.3.0"
69+
scalaVersion := "3.5.2"
5970
libraryDependencies += "se.lth.cs" %% "introprog" % "1.4.0"
6071
```
6172

@@ -68,6 +79,7 @@ scala> val w = new introprog.PixelWindow()
6879
scala> w.fill(100,100,100,100,java.awt.Color.red)
6980
```
7081
See: [api documentation for PixelWindow](https://fileadmin.cs.lth.se/pgk/api/api/introprog/PixelWindow.html)
82+
7183
### Older Scala versions
7284

7385
If you want to use Scala 2.13 with 2.13.5 or later then use these special settings in `build.sbt`, esp. note that you should use version 1.1.5 of introprog:

0 commit comments

Comments
 (0)