Harbor

branch main
showing the latest snapshot on main
main.odin 791 B · Plain text
examples/frame_intent/main.odin 0644 Raw
package main

import "core:fmt"
import gpu "../.."

main :: proc() {
	ctx := gpu.init_context(width = 320, height = 240)
	frame := gpu.begin_frame(ctx)
	defer gpu.destroy_frame(&frame)

	target := gpu.begin_target(&frame, gpu.present_target(ctx))
	_ = gpu.push_layer(&frame, {name = "ui", sort_base = 10_000, order = .Strict})

	_ = gpu.draw_rect(&frame, {
		x = 16,
		y = 16,
		width = 64,
		height = 32,
		color = gpu.WHITE,
	})
	_ = gpu.draw_text_run(&frame, {
		glyphs = []gpu.Glyph_Quad{
			{x = 24, y = 24, width = 6, height = 8, u0 = 0, v0 = 0, u1 = 1, v1 = 1, color = gpu.WHITE},
		},
		sort_key = 1,
	})

	gpu.end_target(&frame, target)
	if !gpu.submit(&frame) {
		fmt.println("frame_intent: submit validation failed")
		return
	}
	fmt.println("frame_intent: built frame intent")
}