feat(pbs): align typed values and Pad input facade
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Log } from @sdk:log;
|
||||
import { Input } from @sdk:input;
|
||||
import { Pad, Button, Touch } from @sdk:input;
|
||||
import { Composer } from @sdk:composer;
|
||||
import { Gfx } from @sdk:gfx;
|
||||
import { Assets } from @sdk:asset;
|
||||
@@ -56,16 +56,14 @@ fn frame() -> void
|
||||
}
|
||||
}
|
||||
|
||||
let touch : InputTouch = Input.touch();
|
||||
let pad : InputPad = Input.pad();
|
||||
|
||||
if (touch.button().released())
|
||||
if (Touch.released())
|
||||
{
|
||||
frame_counter = 0;
|
||||
tile_id = 0;
|
||||
}
|
||||
|
||||
if (touch.button().down())
|
||||
if (Touch.down())
|
||||
{
|
||||
frame_counter = frame_counter + 1;
|
||||
if (frame_counter > MAX_FRAMES)
|
||||
@@ -87,21 +85,21 @@ fn frame() -> void
|
||||
Log.info("camera_x:" + camera_x);
|
||||
|
||||
Composer.set_camera(camera_x, 0);
|
||||
Composer.emit_sprite(tile_id, 0, touch.x() - 16, touch.y() + 8, 2, 0, true, false, 0);
|
||||
Composer.emit_sprite(tile_id, 0, (Touch.x() as int) - 16, (Touch.y() as int) + 8, 2, 0, true, false, 0);
|
||||
|
||||
let a : int = 10;
|
||||
let b : int = 15;
|
||||
let total : int = a + b;
|
||||
|
||||
if (pad.a().pressed())
|
||||
if (Pad.pressed(Button.A))
|
||||
{
|
||||
total += 25;
|
||||
}
|
||||
else if (pad.b().pressed())
|
||||
else if (Pad.pressed(Button.B))
|
||||
{
|
||||
total += 5;
|
||||
}
|
||||
else if (pad.x().pressed())
|
||||
else if (Pad.pressed(Button.X))
|
||||
{
|
||||
total -= 10;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user