Add a clear function.
This commit is contained in:
parent
e740fd7688
commit
eb32577d38
|
@ -68,6 +68,7 @@ module Chalk
|
||||||
table.set_function "set_sound", FunctionEntry.new Builtin::InlineSetSoundFunction.new
|
table.set_function "set_sound", FunctionEntry.new Builtin::InlineSetSoundFunction.new
|
||||||
table.set_function "draw_number", FunctionEntry.new Builtin::InlineDrawNumberFunction.new
|
table.set_function "draw_number", FunctionEntry.new Builtin::InlineDrawNumberFunction.new
|
||||||
table.set_function "draw_sprite", FunctionEntry.new Builtin::InlineDrawSpriteFunction.new
|
table.set_function "draw_sprite", FunctionEntry.new Builtin::InlineDrawSpriteFunction.new
|
||||||
|
table.set_function "clear", FunctionEntry.new Builtin::InlineClearFunction.new
|
||||||
return table
|
return table
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -97,5 +97,15 @@ module Chalk
|
||||||
return Compiler::FunctionType.new([Compiler::Type::U8] * 3, Compiler::Type::U0)
|
return Compiler::FunctionType.new([Compiler::Type::U8] * 3, Compiler::Type::U0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class InlineClearFunction < InlineFunction
|
||||||
|
def generate!(emitter, params, table, target, free)
|
||||||
|
emitter.instructions << Ir::ClearInstruction.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def type
|
||||||
|
return Compiler::FunctionType.new(([] of Compiler::Type), Compiler::Type::U0)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user