[oden] Finish colors and cleanup
This commit is contained in:
parent
2322493efd
commit
ab91fcfc53
3 changed files with 33 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { load_texture } from "./assets";
|
||||
import { btn, Button } from "./input";
|
||||
import { Vec2, new_v2, vadd, vsub, vnorm, vmul } from "./vector";
|
||||
import { spr, circle, use_texture, Texture } from "./graphics";
|
||||
import { spr, use_texture, Texture } from "./graphics";
|
||||
import { has_collision, Level } from "./level";
|
||||
|
||||
export interface ActorProps {
|
||||
|
|
@ -191,7 +191,10 @@ export class Robo extends Actor {
|
|||
|
||||
const frame = (anim.start + ((clock / anim.speed) % anim.length)) >> 0;
|
||||
spr(x, y, w, h, frame * w, 0, 32, 32);
|
||||
circle(this.props.position.x, this.props.position.y, 16, 1);
|
||||
|
||||
// color(0, 0, 0, 0);
|
||||
// stroke(0, 0, 0, 1);
|
||||
// circle(this.props.position.x, this.props.position.y, 8, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue