|
def tick args |
|
args.outputs[:water].set w: 1280, h: 720, background_color: [255, 255, 255] |
|
args.outputs[:water].primitives << 3.map do |i| |
|
sprite_size = 720 |
|
[ |
|
{ |
|
x: 0, |
|
y: Grid.h / 2 - i * sprite_size + Kernel.tick_count % sprite_size, |
|
w: sprite_size, h: sprite_size, |
|
path: "sprites/flow-like-water/water.png", |
|
a: 128, |
|
}, |
|
{ |
|
x: 720, |
|
y: Grid.h / 2 - i * sprite_size + Kernel.tick_count % sprite_size, |
|
w: sprite_size, h: sprite_size, |
|
path: "sprites/flow-like-water/water.png", |
|
a: 128, |
|
}, |
|
{ |
|
x: Grid.w / 2 - i * sprite_size + Kernel.tick_count % sprite_size, |
|
y: 0, |
|
w: sprite_size, h: sprite_size, |
|
path: "sprites/flow-like-water/water.png", |
|
a: 128, |
|
}, |
|
] |
|
end |
|
|
|
args.outputs[:displacement].set w: 1280, h: 720, background_color: [255, 255, 255] |
|
args.outputs[:displacement].primitives << 3.map do |i| |
|
sprite_size = 720 |
|
[ |
|
{ |
|
x: Grid.w / 2 - i * sprite_size + Kernel.tick_count % sprite_size, |
|
y: 0, |
|
w: sprite_size, h: sprite_size, |
|
path: "sprites/flow-like-water/water-displacement.png", |
|
a: 128 |
|
}, |
|
{ |
|
x: 0, |
|
y: Grid.h / 2 - i * sprite_size + Kernel.tick_count % sprite_size, |
|
w: sprite_size, h: sprite_size, |
|
path: "sprites/flow-like-water/water-displacement.png", |
|
a: 128 |
|
}, |
|
{ |
|
x: 720, |
|
y: Grid.h / 2 - i * sprite_size + Kernel.tick_count % sprite_size, |
|
w: sprite_size, h: sprite_size, |
|
path: "sprites/flow-like-water/water-displacement.png", |
|
a: 128 |
|
} |
|
] |
|
end |
|
|
|
args.outputs.shader = { |
|
path: "shaders/effect.frag.hlsl", |
|
textures: [ |
|
:displacement |
|
] |
|
} |
|
|
|
args.outputs.primitives << { x: 0, y: 0, w: 1280, h: 720, path: :water } |
|
args.outputs.primitives << { x: args.state.tick_count % 1280, |
|
y: args.state.tick_count % 720, |
|
text: "flow like water", |
|
anchor_x: 0.5, |
|
anchor_y: 0.5, |
|
size_px: 100, |
|
r: 1, |
|
g: 1, |
|
b: 1 } |
|
|
|
args.outputs.primitives << { x: args.inputs.mouse.x, |
|
y: args.inputs.mouse.y, |
|
w: 64, h: 64, |
|
path: "sprites/square/blue.png", |
|
anchor_x: 0.5 , anchor_y: 0.5 } |
|
end |