V1[]
BTRIG
is not a function in SmileBasic V1.
V2[]
BTRIG
is a system function that takes no parameters and indicates what buttons have been recently pressed. It functions the same as Button(1), and is just a convenient alias.
The value returned by BTRIG()
is recalculated at the beginning of every "frame", that is, every 1/60th of a second (and for the duration of the frame, it does not change). If, during the previous frame, a button had changed from being up to being down, a bit is set in the value of BTRIG()
, otherwise (if the button had been down all during the previous frame, or if it had remained up, or if it had changed from being down to being up) the bit is clear.
BTRIG()
is usually used in conjunction with VSYNC
; e.g., without VSYNC 1
between successive calls to BTRIG()
, both calls may occur in the same frame, both indicating that a button has been recently pressed, and the program may behave as if the button had been pressed twice when it had actually only been pressed once.
The bit masks are the same as for BUTTON()
:
mask | button |
---|---|
1 | D-pad up |
2 | D-pad down |
4 | D-pad left |
8 | D-pad right |
16 | A |
32 | B |
64 | X |
128 | Y |
256 | L |
512 | R |
1024 | START |
2048 | SELECT |
Since SELECT stops any running program when it is pressed, using SELECT is not useful with BTRIG()
.
V3[]
BTRIG has been replaced by BUTTON(2) .