uxnwithrosia

some uxn practice with friends :)
Log | Files | Refs

hello-keyboard.tal (835B)


      1 ( hello-keyboard.tal )
      2 
      3 ( devices )
      4 |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
      5 |20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
      6 |80 @Controller [ &vector $2 &button $1 &key $1 ]
      7 
      8 ( main program )
      9 |0100
     10       ( set system colors )
     11       #2ce9 .System/r DEO2
     12       #01c0 .System/g DEO2
     13       #2ce5 .System/b DEO2
     14 
     15       ( assign controller vector )
     16       ;on-controller .Controller/vector DEO2
     17 BRK
     18 
     19 ( run this code whenever a key is pressed or released )
     20 @on-controller ( -> )
     21       ( set  x,y coordinates )
     22       #0008 .Screen/x DEO2
     23       #0008 .Screen/y DEO2
     24 
     25       ( set sprite address )
     26       ;square .Screen/addr DEO2
     27 
     28       ( draw sprite in the background )
     29       ( using color 1 for the outline )
     30       #01 .Screen/sprite DEO
     31 BRK
     32 
     33 ( sprite )
     34 @square ff81 8181 8181 81ff