Skip to content

Commit

Permalink
start to implement hsv->rgb in wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
pufferfish101007 committed Oct 18, 2023
1 parent 6434901 commit 050f765
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/targets/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,9 @@ pub mod func_indices {
pub const CAST_ANY_FLOAT: u32 = 41;
pub const CAST_ANY_BOOL: u32 = 42;
pub const TABLE_ADD_STRING: u32 = 43;
pub const SPRITE_UPDATE_PEN_COLOR: 44;

Check failure on line 690 in src/targets/wasm.rs

View workflow job for this annotation

GitHub Actions / Format

expected type, found `44`

Check failure on line 690 in src/targets/wasm.rs

View workflow job for this annotation

GitHub Actions / Build check

expected type, found `44`

Check failure on line 690 in src/targets/wasm.rs

View workflow job for this annotation

GitHub Actions / Lint (clippy)

expected type, found `44`
}
pub const BUILTIN_FUNCS: u32 = 44;
pub const BUILTIN_FUNCS: u32 = 45;
pub const IMPORTED_FUNCS: u32 = 36;

pub mod types {
Expand Down Expand Up @@ -1176,6 +1177,15 @@ impl From<IrProject> for WasmProject {
tbl_add_string_func.instruction(&Instruction::LocalGet(1));
tbl_add_string_func.instruction(&Instruction::End);
code.function(&tbl_add_string_func);

function.function(types::I32_NORESULT);
let mut sprite_update_pen_color_func = Function::new(vec![(1, ValType::I32), (3, ValType::f64)]);
sprite_update_pen_color_func.instruction(&Instruction::LocalGet(0));
sprite_update_pen_color_func.instruction(&Instruction::I32Const(48));
sprite_update_pen_color_func.instruction(&Instruction::I32Mul);
sprite_update_pen_color_func.instruction(&Instruction::I32Const((byte_offset::VARS as usize + project.vars.borrow().len() * 12 + 16).try_into().unwrap()));
sprite_update_pen_color_func.instruction(&Instruction::End);
code.function(&sprite_update_pen_color_func);

let mut gf_func = Function::new(vec![]);
let mut tick_func = Function::new(vec![(2, ValType::I32)]);
Expand Down

0 comments on commit 050f765

Please sign in to comment.