Skip to content

Commit

Permalink
Move render targets to rt.um
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Maškarinec <[email protected]>
  • Loading branch information
marekmaskarinec committed Oct 6, 2024
1 parent 1105be8 commit 5980a92
Show file tree
Hide file tree
Showing 8 changed files with 4,013 additions and 4,031 deletions.
2 changes: 1 addition & 1 deletion lib/sokol
31 changes: 31 additions & 0 deletions samples/rt/main.um
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

import (
"canvas.um"
"th.um"
"window.um"
"rt.um"
"std.um"
)

fn init*() {
window::setup("Render target sample", 640, 480)

target, err := rt::mk(th::Vf2{10, 10}, .nearest)
std::exitif(err)

window::onFrame.register(|target| {
std::exitif(target.begin())

r := 5
a := th::time / 2000.0 * 360
s := th::Vf2{ r, 0 }.rotated({ r, r }, a)
e := th::Vf2{ r, 2 * r }.rotated({ r, r }, a)
canvas::drawLine(th::black, s, e, 1)

std::exitif(target.end())

target.toImage().draw({
s: { 64, 48 }
})
})
}
29 changes: 15 additions & 14 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,29 @@ HELPER_SCRIPT = cmd/buildhelper.um
EM_TARGET = src/staembed.c
UMKA_MODULES = \
umka/anim.um \
umka/atlas.um \
umka/audio.um \
umka/canvas.um \
umka/coll.um \
umka/color.um \
umka/csv.um \
umka/ent.um \
umka/font.um \
umka/image.um \
umka/input.um \
umka/lerp.um \
umka/misc.um \
umka/canvas.um \
umka/rect.um \
umka/tilemap.um \
umka/window.um \
umka/nav.um \
umka/particles.um \
umka/lerp.um \
umka/font.um \
umka/th.um \
umka/signal.um \
umka/atlas.um \
umka/shader.um \
umka/color.um \
umka/coll.um \
umka/placeholders.um \
umka/nav.um \
umka/ui.um
umka/rect.um \
umka/rt.um \
umka/shader.um \
umka/signal.um \
umka/th.um \
umka/tilemap.um \
umka/ui.um \
umka/window.um
UMKA_DOCS=$(UMKA_MODULES:.um=.md)
MMDOC=$(UMKA_BIN) cmd/mmdoc/mmdoc.um
IMAGES_MOD = umka/placeholders.um
Expand Down
Loading

0 comments on commit 5980a92

Please sign in to comment.