[oden] Finish colors and cleanup

This commit is contained in:
John Doty 2023-08-26 11:19:38 -07:00
parent 2322493efd
commit ab91fcfc53
3 changed files with 33 additions and 5 deletions

View file

@ -11,6 +11,31 @@ export function cls(r: number, g: number, b: number) {
core.cls(r, g, b);
}
/**
* Set the current drawing color. This is the fill color for shapes that have
* both stroke and fill.
*
* @param r - The red component of the color, from 0 to 1.
* @param g - The green component of the color, from 0 to 1.
* @param b - The blue component of the color, from 0 to 1.
* @param a - The alpha (transparency) of the color, from 0 (transparent) to 1 (opaque)
*/
export function color(r: number, g: number, b: number, a: number = 1) {
core.color(r, g, b, a);
}
/**
* Set the current stroke color, for shapes that have a stroke.
*
* @param r - The red component of the color, from 0 to 1.
* @param g - The green component of the color, from 0 to 1.
* @param b - The blue component of the color, from 0 to 1.
* @param a - The alpha (transparency) of the color, from 0 (transparent) to 1 (opaque)
*/
export function stroke(r: number, g: number, b: number, a: number = 1) {
core.stroke(r, g, b, a);
}
/**
* Print a message to the console.
*

View file

@ -185,7 +185,7 @@ impl WindowAndDevice {
// The instance is a handle to our GPU
// Backends::all => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::all() & !wgpu::Backends::VULKAN,
backends: wgpu::Backends::all(),
dx12_shader_compiler: Default::default(),
});
@ -814,7 +814,7 @@ impl<'a> FrameBuilder<'a> {
mode: DrawMode::Sprites,
stroke_color: [0.0, 0.0, 0.0, 1.0],
fill_color: [0.0, 0.0, 1.0, 1.0],
fill_color: [1.0, 1.0, 1.0, 1.0],
target: last_view,
color: None,
draw_calls: Vec::new(),
@ -989,7 +989,7 @@ impl<'a> FrameBuilder<'a> {
radius: cc.radius,
stroke_width: cc.stroke_width,
stroke_color,
fill_color: [1.0, 1.0, 1.0, 1.0],
fill_color,
});
}