Skip to content

Commit c29a617

Browse files
authored
Make fidget work with pixie. (#114)
Pixie is the new fidget. Replace everything in fidget here with pixie instead.
1 parent 54d4239 commit c29a617

File tree

7 files changed

+415
-31
lines changed

7 files changed

+415
-31
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ jobs:
2323

2424
- uses: jiro4989/setup-nim-action@v1
2525

26-
- uses: openrndr/setup-opengl@v1
27-
2826
- name: Install GUI
2927
run: |
3028
sudo apt update
3129
sudo apt install -y build-essential libalut-dev libasound2-dev libc6-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev mesa-utils pkg-config xorg-dev xvfb
32-
33-
- run: xvfb-run nimble test -y
30+
- run: nimble install -y
3431
- run: nim c -r tests/run.nim --compile --native --js

fidget.nimble

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ srcDir = "src"
1111
requires "nim >= 1.0.0"
1212
requires "chroma >= 0.1.3"
1313
requires "typography >= 0.4.0"
14-
requires "flippy >= 0.4.4"
14+
requires "pixie >= 0.0.2"
1515
requires "vmath >= 0.3.1"
1616
requires "print >= 0.1.0"
1717
requires "opengl >= 1.2.3"
1818
requires "html5_canvas >= 1.3"
1919
requires "staticglfw >= 4.1.2"
2020
requires "cligen >= 1.0.0"
21+
requires "supersnappy >= 1.0.0"

src/fidget/opengl/base.nim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ../common, ../input, ../internal, chroma, flippy, opengl, os, perf,
1+
import ../common, ../input, ../internal, chroma, pixie, opengl, os, perf,
22
staticglfw, times, typography/textboxes, unicode, vmath, strformat
33

44
when defined(glDebugMessageCallback):
@@ -420,8 +420,8 @@ proc setWindowBounds*(min, max: Vec2) =
420420

421421
proc takeScreenshot*(
422422
frame = rect(0, 0, windowFrame.x, windowFrame.y)
423-
): flippy.Image =
424-
result = newImage("", frame.w.int, frame.h.int, 4)
423+
): pixie.Image =
424+
result = newImage(frame.w.int, frame.h.int)
425425
glReadPixels(
426426
frame.x.GLint,
427427
frame.y.GLint,
@@ -431,4 +431,4 @@ proc takeScreenshot*(
431431
GL_UNSIGNED_BYTE,
432432
result.data[0].addr
433433
)
434-
result = result.flipVertical()
434+
result.flipVertical()

src/fidget/opengl/context.nim

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import buffers, chroma, flippy, hashes, opengl, os, shaders, strformat,
2-
strutils, tables, textures, times, vmath
1+
import buffers, chroma, pixie, hashes, opengl, os, shaders, strformat,
2+
strutils, tables, textures, times, vmath, formatflippy
33

44
const
55
quadLimit = 10_921
@@ -500,8 +500,8 @@ proc drawSprite*(
500500
proc fillRect*(ctx: Context, rect: Rect, color: Color) =
501501
const imgKey = hash("rect")
502502
if imgKey notin ctx.entries:
503-
var image = newImage(4, 4, 4)
504-
image.fill(rgba(255, 255, 255, 255))
503+
var image = newImage(4, 4)
504+
image.fill2(rgba(255, 255, 255, 255))
505505
ctx.putImage(imgKey, image)
506506

507507
let
@@ -528,8 +528,8 @@ proc fillRoundedRect*(ctx: Context, rect: Rect, color: Color, radius: float32) =
528528
w = ceil(rect.w).int
529529
h = ceil(rect.h).int
530530
if hash notin ctx.entries:
531-
var image = newImage(w, h, 4)
532-
image.fill(rgba(255, 255, 255, 0))
531+
var image = newImage(w, h)
532+
image.fill2(rgba(255, 255, 255, 0))
533533
image.fillRoundedRect(
534534
rect(0, 0, rect.w, rect.h),
535535
radius,
@@ -564,8 +564,8 @@ proc strokeRoundedRect*(
564564
w = ceil(rect.w).int
565565
h = ceil(rect.h).int
566566
if hash notin ctx.entries:
567-
var image = newImage(w, h, 4)
568-
image.fill(rgba(255, 255, 255, 0))
567+
var image = newImage(w, h)
568+
image.fill2(rgba(255, 255, 255, 0))
569569
image.strokeRoundedRect(
570570
rect(0, 0, rect.w, rect.h),
571571
radius,
@@ -599,8 +599,8 @@ proc line*(
599599
pos = vec2(min(a.x, b.x), min(a.y, b.y))
600600

601601
if hash notin ctx.entries:
602-
var image = newImage(w, h, 4)
603-
image.fill(rgba(255, 255, 255, 0))
602+
var image = newImage(w, h)
603+
image.fill2(rgba(255, 255, 255, 0))
604604
image.line(
605605
a-pos, b-pos,
606606
rgba(255, 255, 255, 255)

0 commit comments

Comments
 (0)