plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
7ae62f5
— Peter John
2026-11-02T20:31:27+05:30
T8: docs and examples
README.md
CHANGED
|
@@ -542,10 +542,12 @@ trait Entity(pos: Vec2, z: Int) =
|
|
|
542
542
|
self.draw() # runs the record's own draw
|
|
543
543
|
self.draw()
|
|
544
544
|
|
|
545
|
-
record House(Entity,
|
|
545
|
+
record House(Entity, kind: Int) =
|
|
546
|
-
fun update(self, dt: Float) =
|
|
546
|
+
fun update(self, dt: Float) = printLn("update")
|
|
547
|
-
fun draw(self) =
|
|
547
|
+
fun draw(self) = printLn("draw")
|
|
548
|
+
```
|
|
548
549
|
|
|
550
|
+
```plum
|
|
549
551
|
es := List[Entity]()
|
|
550
552
|
es.push(House(pos: p, z: 0, hits: 0, kind: 1)) # House converts to Entity
|
|
551
553
|
for e := range es
|
|
@@ -1088,7 +1090,9 @@ record Walker(Actor, speed: Float) =
|
|
|
1088
1090
|
self.x = self.x + self.speed * dt
|
|
1089
1091
|
fun draw(self, m: Affine, alpha: Float) =
|
|
1090
1092
|
drawRectBox(m, alpha, self.width, self.height, self.color)
|
|
1093
|
+
```
|
|
1091
1094
|
|
|
1095
|
+
```plum
|
|
1092
1096
|
stage.root.add(Walker(x: 0.0, y: 0.0, width: 8.0, height: 8.0, originX: 0.0, originY: 0.0, scaleX: 1.0, scaleY: 1.0, rotation: 0.0, color: Color.Red, visible: true, children: List[Actor](), parent: null, scratch: List[Actor](), cull: false, cullX: 0.0, cullY: 0.0, cullW: 0.0, cullH: 0.0, speed: 30.0))
|
|
1093
1097
|
```
|
|
1094
1098
|
|