Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/circle2circle.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: Circle
Expand All @@ -13,7 +13,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a.pos = getMousePos()
a.pos = window.mousePos.vec2
screen.fillCircle(a, parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/circle2line.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
c: Circle
Expand All @@ -14,7 +14,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

c.pos = getMousePos()
c.pos = window.mousePos.vec2
screen.fillCircle(c, parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/circle2rect.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: Circle
Expand All @@ -14,7 +14,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a.pos = getMousePos()
a.pos = window.mousePos.vec2
screen.fillCircle(a, parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/circle2seg.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: Circle
Expand All @@ -14,7 +14,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a.pos = getMousePos()
a.pos = window.mousePos.vec2
screen.fillCircle(a, parseHtmlColor("#2ecc71"))

var color =
Expand Down
10 changes: 5 additions & 5 deletions examples/convexhull.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, random, vmath
import bumpy, common, pixie/demo, random

var
points: seq[Vec2]
Expand Down Expand Up @@ -33,17 +33,17 @@ while true:
for p in points:
screen.strokeCircle(circle(p, 5), parseHtmlColor("#2ecc71"))

if isKeyDown(KEY_SPACE):
if window.buttonDown[KeySpace]:
gen()

if isMouseDown():
if window.buttonDown[MouseLeft]:
if dragging == -1:
for i, p in points:
if p.dist(getMousePos()) < 6:
if p.dist(window.mousePos.vec2) < 6:
dragging = i
if dragging != -1:
screen.fillCircle(circle(points[dragging], 7), parseHtmlColor("#2ecc71"))
points[dragging] = getMousePos()
points[dragging] = window.mousePos.vec2
hull = convexHull(points)
else:
dragging = -1
Expand Down
6 changes: 3 additions & 3 deletions examples/hull2hull.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, pixie/demo, random, vmath
import bumpy, pixie/demo, random

var
hull1: seq[Vec2]
Expand Down Expand Up @@ -43,7 +43,7 @@ while true:

var hull2shifted = hull2
for p in hull2shifted.mitems:
p += getMousePos() - vec2(100, 100)
p += window.mousePos.vec2 - vec2(100, 100)

hull2shifted.drawHull()

Expand Down Expand Up @@ -83,7 +83,7 @@ while true:
ctx.strokeStyle = rgba(0, 255, 0, 255)
ctx.strokeSegment(segment(avgA, avgA + normB*80))

if isKeyDown(KEY_SPACE):
if window.buttonDown[KeySpace]:
gen()

tick()
6 changes: 3 additions & 3 deletions examples/line2line.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

# The lines always overlap unless you get them to be perfectly parallel.

Expand All @@ -20,8 +20,8 @@ while true:

screen.fill(rgba(255, 255, 255, 255))

if getMousePos().x > 300:
a.b = getMousePos()
if window.mousePos.x > 300:
a.b = window.mousePos.vec2
else:
a.b = vec2(screen.width.float32, 300)
let windowEdge = Line(
Expand Down
4 changes: 2 additions & 2 deletions examples/line2poly.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

# The lines always overlap unless you get them to be perfectly parallel.

Expand All @@ -16,7 +16,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

l.b = getMousePos()
l.b = window.mousePos.vec2
let windowEdge = Line(
a: vec2(screen.width.float32, 0),
b: vec2(screen.width.float32, screen.height.float32)
Expand Down
4 changes: 2 additions & 2 deletions examples/line2rect.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

# The lines always overlap unless you get them to be perfectly parallel.

Expand All @@ -16,7 +16,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

l.b = getMousePos()
l.b = window.mousePos.vec2
let windowEdge = Line(
a: vec2(screen.width.float32, 0),
b: vec2(screen.width.float32, screen.height.float32)
Expand Down
4 changes: 2 additions & 2 deletions examples/line2seg.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

# The lines always overlap unless you get them to be perfectly parallel.

Expand All @@ -19,7 +19,7 @@ while true:
s.to.x = screen.width.float32 - 100
s.to.y = 500

l.b = getMousePos()
l.b = window.mousePos.vec2
let windowEdge = Line(
a: vec2(screen.width.float32, 0),
b: vec2(screen.width.float32, screen.height.float32)
Expand Down
4 changes: 2 additions & 2 deletions examples/point2circle.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: Vec2
Expand All @@ -12,7 +12,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a = getMousePos()
a = window.mousePos.vec2
screen.strokeCircle(circle(a, 10), parseHtmlColor("#2ecc71"))

var color =
Expand Down
6 changes: 2 additions & 4 deletions examples/point2line.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath

# The lines always overlap unless you get them to be perfectly parallel.
import bumpy, common, pixie/demo

var
l: Line
Expand All @@ -16,7 +14,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

p = getMousePos()
p = window.mousePos.vec2
screen.strokeCircle(circle(p, 10), parseHtmlColor("#2ecc71"))

let color =
Expand Down
4 changes: 2 additions & 2 deletions examples/point2point.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var a, b: Vec2
b.x = 300
Expand All @@ -9,7 +9,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a = getMousePos()
a = window.mousePos.vec2
screen.strokeCircle(circle(a, 10), parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/point2rect.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: Vec2
Expand All @@ -13,7 +13,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a = getMousePos()
a = window.mousePos.vec2
screen.strokeCircle(circle(a, 10), parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/point2seg.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: Vec2
Expand All @@ -13,7 +13,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a = getMousePos()
a = window.mousePos.vec2
screen.strokeCircle(circle(a, 10), parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/poly2circle.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
poly: seq[Vec2]
Expand All @@ -15,7 +15,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

circle.pos = getMousePos()
circle.pos = window.mousePos.vec2
screen.fillCircle(circle, parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/poly2point.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
poly: seq[Vec2]
Expand All @@ -14,7 +14,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

point = getMousePos()
point = window.mousePos.vec2
screen.fillCircle(circle(point, 10), parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/poly2poly.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: seq[Vec2]
Expand All @@ -14,7 +14,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

let mousePos = getMousePos()
let mousePos = window.mousePos.vec2
a.setLen(0)
a.add(vec2(-20, -10) + mousePos)
a.add(vec2(-30, -49) + mousePos)
Expand Down
4 changes: 2 additions & 2 deletions examples/poly2rect.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie, pixie/demo, vmath
import bumpy, common, pixie, pixie/demo

var
poly: seq[Vec2]
Expand All @@ -17,7 +17,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

rect.xy = getMousePos()
rect.xy = window.mousePos.vec2
screen.fillRect(rect, parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/poly2seg.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
poly: seq[Vec2]
Expand All @@ -17,7 +17,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

s.to = getMousePos()
s.to = window.mousePos.vec2
screen.strokeSegment(segment(s.at, s.to), parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/rect2rect.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
a: Rect
Expand All @@ -15,7 +15,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

a.xy = getMousePos()
a.xy = window.mousePos.vec2
screen.fillRect(a, parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/seg2rect.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, pixie/demo, vmath
import bumpy, common, pixie/demo

var
s: Segment
Expand All @@ -17,7 +17,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

s.to = getMousePos()
s.to = window.mousePos.vec2
screen.strokeSegment(segment(s.at, s.to), parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/seg2seg.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, pixie/demo, vmath
import bumpy, common, pixie/demo

var
d: Segment
Expand All @@ -17,7 +17,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

d.to = getMousePos()
d.to = window.mousePos.vec2
screen.strokeSegment(d, parseHtmlColor("#2ecc71"))

var color =
Expand Down
4 changes: 2 additions & 2 deletions examples/tri2point.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bumpy, chroma, common, pixie/demo, vmath
import bumpy, common, pixie/demo

var
tri: seq[Vec2]
Expand All @@ -13,7 +13,7 @@ start()
while true:
screen.fill(rgba(255, 255, 255, 255))

point = getMousePos()
point = window.mousePos.vec2
screen.fillCircle(circle(point, 10), parseHtmlColor("#2ecc71"))

var color =
Expand Down