//--------------------------------------------------------------------- // // Reach SLCD+/6/43 macro demo file, QVGA landscape // 01-24-2011 // //--------------------------------------------------------------------- /* single line comments can be 'C' style or C++ style */ // blank lines are allowed //--------------------------------------------------------------------- // The BMPload program generates a macros.h file that provides // the index number for each named macro //--------------------------------------------------------------------- // MACRO #1 (first one in the file) // This is the macro that invokes the self-running demo. // It is the default value for the *DEMOMAC command, so it starts // if the SLCD is powered on with its serial port looped back to itself. //--------------------------------------------------------------------- #define power_on_loopback_demo xbbs 255 // Max bright for demo m optional_calibration // check for touch calibration m clear // set black and white colors, clear screen m splash_logos // initial splash screen and button to next #end //--------------------------------------------------------------------- // MACROS #2 - #6 // These macros implement a number pad at relative (0,0) // It assumes button BMP 10, 11 are loaded // NOTE: Button #1 is reserved ("Next") //--------------------------------------------------------------------- #define number_pad //move entire keyboard to parameter location o `0` `1` //Key output area xi 40 50 0 // set font 24 for buttons f 24 // define button text using "simple math" with argument bdc 12 0 32 1 "`(`2`+1)`" 10 11 bdc 2 48 32 1 "`(`2`+2)`" 10 11 bdc 3 96 32 1 "`(`2`+3)`" 10 11 bdc 4 0 80 1 "`(`2`+4)`" 10 11 bdc 5 48 80 1 "`(`2`+5)`" 10 11 bdc 6 96 80 1 "`(`2`+6)`" 10 11 bdc 7 0 128 1 "`(`2`+7)`" 10 11 bdc 8 48 128 1 "`(`2`+8)`" 10 11 bdc 9 96 128 1 "`(`2`+9)`" 10 11 bdc 10 0 176 1 "*" 10 11 bdc 0 48 176 1 "`2`" 10 11 bdc 11 96 176 1 "#" 10 11 #end //--------------------------------------------------------------------- // Macro to set font and color for input box display. Foregorund color // is XOR of background color to match the buttons //--------------------------------------------------------------------- #define grey24 S 333 CCC f 24 #end //--------------------------------------------------------------------- // Write text to the screen (also includes macro parameter simple math) //--------------------------------------------------------------------- #define button_text m grey24 t "`0` " `(`1`+60)` `(`2`+3)` //uses output area location + offset #end //--------------------------------------------------------------------- // This macro enables the buttons specified in number_pad macro // to write text to the screen inside a bitmap // NOTE: Button #1 is reserved ("Next") //--------------------------------------------------------------------- #define attach_buttons xa 0 p button_text 0 `0` `1` xa 12 p button_text 1 `0` `1` xa 2 p button_text 2 `0` `1` xa 3 p button_text 3 `0` `1` xa 4 p button_text 4 `0` `1` xa 5 p button_text 5 `0` `1` xa 6 p button_text 6 `0` `1` xa 7 p button_text 7 `0` `1` xa 8 p button_text 8 `0` `1` xa 9 p button_text 9 `0` `1` xa 11 p button_text # `0` `1` xa 10 p button_text * `0` `1` #end //--------------------------------------------------------------------- // This macro creates a keypad and displays the key // using previous macros //--------------------------------------------------------------------- #define keypad_demo m clear f 24BC t "Macro Parameter Simple Math Demo" 5 5 f 16 t "Key button text" 220 60 t "utilizes" 220 90 t "Simple Math" 220 120 //The third parameter is used with simple math to create button text m number_pad 80 30 0 //parms: x offset, y offset, first button number m attach_buttons 80 30 //parms are x-y offset m next_button splash_keyboard #end #define rand_draw p `R1:5` m rand_color tr `R0:319` `R0:189` `R0:319` `R0:189` `R0:319` `R0:189` m rand_color c `R0:319` `R0:159` `R10:40` :repeat #end #define rand_color s `R0:16` 1 #end */ #define demo_end m clear #end */ #define clear o 0 0 ta LT s 0 1 z #end */ #define next_button o 0 0 f 13B bd 1 257 202 1 "Next" 16 11 1 2 xm 1 `0` #end #define splash_logos xi 5 0 0 m next_button splash_panel #end #define splash_panel xi 6 0 0 m next_button splash_fonts #end #define splash_slcd xbbs 255 // make sure we are on full bright m clear // clear screen xi 7 0 0 // show next buttton now because macro will stop on error // if CH16 font was not downloaded m next_button splash_drawing // show chinese font f 13 t "(Error - CH16 font not downloaded!!)" 53 193 utf8 on // enable UTF8 test f CH16 // select downloaded font t "Downloadable fonts: \xe4\xb8\x9c \xe4\xb8\x9a" 53 193 anic f 24B S 0f0 fff tf 0 "FLASHING TEXT" 45 110 T f 8x8 ani 1 wvr 188 ani 1 xi 27 150 130 ani 1 y 50 ani 1 wvr 188 ani 1 xi 26 150 130 ani 1 wvr 188 ani 1 xi 27 210 130 ani 1 y 50 ani 1 wvr 188 ani 1 xi 26 210 130 ani 1 wvr 188 ani 1 xi 27 270 130 ani 1 y 50 ani 1 wvr 188 ani 1 xi 26 270 130 ani 1 y 50 anie 1 ani 2 k 226 70 300 100 1 L ani 2 y 50 anie 2 k 100 60 180 110 10 u ani 3 s 0 1 ani 3 k 100 60 180 110 1 d ani 3 y 50 ani 4 s 0 1 ani 4 k 100 60 180 110 1 u ani 4 y 50 ani 5 anie 3 ani 5 y 500 ani 5 anid 3 0 ani 5 anie 4 ani 5 y 500 ani 5 anid 4 0 anie 5 S 000 fff #end #define splash_fonts // 15 m clear // clear screen f 24BC t "On-board Proportional Fonts" 10 5 sc 0 0 o 20 40 f 8 t "8 point font: quick brown fox 0123" f 16B t "\n" f 10 t "10 point: quick brown fox 0123" f 16B t "\n" f 13 t "13 point: quick brown fox 0123" f 16B t "\n" f 13B t "13 point bold: quick brown fox 0123" f 16B t "\n" f 16 t "16 point: quick brown fox 0123" f 16B t "\n" f 16B t "16 point bold: quick brown fox 0123" f 18BC t "\n18 point bold comic: quick fox 0123" t "\n" f 24 t "24 point: quick fox 0123" f 24B t "\n24 point bold: quick 01\n" f 32 t "32 point & " f 32B t "32 bold" m next_button splash_fixed_fonts #end #define splash_keyboard m clear // clear screen // clear string memory mpop -1 f 24BC t "Easy to use buttons" 54 0 f 13B // set up stateful button with macro callback m keyboard_button_display "Off" bd 2 50 24 2 "" "" 0 0 0 0 3 4 xa 2 p keyboard_button_display "On " xa 2 r keyboard_button_display "Off" // setup demo instant button bd 3 200 20 1 "Hold" 16 11 1 2 // adjust origin for keyboard o 0 72 // set font for buttons f16B // keyboard row one m drawKey 10 0 0 1 m drawKey 11 32 0 2 m drawKey 12 64 0 3 m drawKey 13 96 0 4 m drawKey 14 128 0 5 m drawKey 15 160 0 6 m drawKey 16 192 0 7 m drawKey 17 224 0 8 m drawKey 18 256 0 9 m drawKey 19 288 0 0 // keyboard row two m drawKey 20 0 32 Q m drawKey 21 32 32 W m drawKey 22 64 32 E m drawKey 23 96 32 R m drawKey 24 128 32 T m drawKey 25 160 32 Y m drawKey 26 192 32 U m drawKey 27 224 32 I m drawKey 28 256 32 O m drawKey 29 288 32 P // keyboard row three m drawKey 30 0 64 A m drawKey 31 32 64 S m drawKey 32 64 64 D m drawKey 33 96 64 F m drawKey 34 128 64 G m drawKey 35 160 64 H m drawKey 36 192 64 J m drawKey 37 224 64 K m drawKey 38 256 64 L m drawKey 39 288 64 " " // keyboard row four m drawKey 40 0 96 Z m drawKey 41 32 96 X m drawKey 42 64 96 C m drawKey 43 96 96 V m drawKey 44 128 96 B m drawKey 45 160 96 N m drawKey 46 192 96 M m drawKey 47 224 96 , m drawKey 48 256 96 - // special erase key - typematic f 16 bd 49 288 96 3 "rub" 5 9 10 11 xm 49 keyboard_erase // reset origin o 0 0 f 13B // draw cursor m keyboard_press "" // link to next screen m next_button state_save_restore_demo #end #define keyboard_button_display f 13B t "`0`" 85 34 #end // drawKey // args: index x y letter #define drawKey bd `0` `1` `2` 1 "`3`" 11 9 10 11 xa `0` p keyboard_press "`3`" #end // keyboard_press // arg letter #define keyboard_press mpush "`0`" t "`M`_ " 0 57 #end #define keyboard_erase mpop 1 m keyboard_press "" #end #define splash_charts m clear // clear screen f 24BC t "Data visualization charts" 28 0 // 5 levelbars o 43 40 m levelbar_init 0 o 96 40 m levelbar_init 1 o 149 40 m levelbar_init 2 o 202 40 m levelbar_init 3 o 255 40 m levelbar_init 4 // 1 long chart o 10 140 cd 0 0 0 301 49 1 3 1 100 008 2 F00 2 0F0 2 FFF p 2 l 302 0 302 50 l 0 50 302 50 o 0 0 // link to next screen m next_button demo_strip_chart m master_flopper #end #define levelbar_init ld `0` 0 0 20 80 0 0 1 888 100 F00 65 FF0 50 0F0 p 2 l 21 0 21 81 l 0 81 21 81 lv `0` 0 #end #define master_flopper // cycle through a prime (to slide on chart) number of relative randoms. // this thing updates REALLY fast so we need to slow it down a little. // 1 w 100 lv 0 `R10:50` lv 1 `R20:60` lv 2 `R20:60` lv 3 `R20:60` lv 4 `R10:50` cv 0 `R10:20` `R40:60` `R80:100` // 2 w 100 lv 0 `R10:50` lv 1 `R40:80` lv 2 `R40:90` lv 3 `R20:80` lv 4 `R10:50` cv 0 `R10:30` `R30:50` `R60:90` // 3 w 100 lv 0 `R20:70` lv 1 `R40:60` lv 2 `R60:100` lv 3 `R20:60` lv 4 `R20:50` cv 0 `R20:40` `R40:60` `R60:80` // 4 w 100 lv 0 `R20:50` lv 1 `R20:60` lv 2 `R60:80` lv 3 `R20:60` lv 4 `R20:50` cv 0 `R20:30` `R30:60` `R70:80` // 5 w 100 lv 0 `R30:50` lv 1 `R20:100` lv 2 `R40:100` lv 3 `R20:100` lv 4 `R30:50` cv 0 `R10:30` `R50:80` `R70:100` // 6 w 100 lv 0 `R40:80` lv 1 `R20:100` lv 2 `R40:100` lv 3 `R20:100` lv 4 `R40:80` cv 0 `R10:30` `R60:90` `R60:100` // 7 w 100 lv 0 `R20:50` lv 1 `R30:60` lv 2 `R60:80` lv 3 `R30:60` lv 4 `R20:50` cv 0 `R10:30` `R30:70` `R60:100` :repeat #end #define splash_drawing xbbs 255 // make sure we are on full m clear // clear screen f 18BC t "Fast colorful drawing primitives!" 10 210 m next_button panel_pattern m rand_draw #end // this is the last demo; "Next" button restarts demo without optional touch cal: #define splash_info z xi 8 0 0 s 0 1 // change this to "m next_button demo_end" to exit the demo instead of restarting it m next_button demo_nocalib m logo_bounce #end #define logo_bounce // to the right and down s 1 0 m showAt 0 0 m showAt 1 2 m showAt 2 4 m showAt 3 6 m showAt 4 8 m showAt 5 10 m showAt 6 12 m showAt 7 14 m showAt 8 16 m showAt 9 18 m showAt 10 20 m showAt 11 22 m showAt 12 24 m showAt 13 26 m showAt 14 28 m showAt 15 30 m showAt 16 32 m showAt 17 34 m showAt 18 36 m showAt 19 38 m showAt 20 40 m showAt 21 42 m showAt 22 44 m showAt 23 46 m showAt 24 48 m showAt 25 50 m showAt 26 52 m showAt 27 54 m showAt 28 56 m showAt 29 58 m showAt 30 60 m showAt 31 62 m showAt 32 64 m showAt 33 66 // to the right and up m showAt 34 64 m showAt 35 62 m showAt 36 60 m showAt 37 58 m showAt 38 56 m showAt 39 54 m showAt 40 52 m showAt 41 50 m showAt 42 48 m showAt 43 46 m showAt 44 44 m showAt 45 42 m showAt 46 40 m showAt 47 38 m showAt 48 36 m showAt 49 34 m showAt 50 32 m showAt 51 30 m showAt 52 28 m showAt 53 26 m showAt 54 24 m showAt 55 22 m showAt 56 20 m showAt 57 18 m showAt 58 16 m showAt 59 14 m showAt 60 12 m showAt 61 10 m showAt 62 8 m showAt 63 6 m showAt 64 4 m showAt 65 2 m showAt 66 0 // to the left and down m showAt 65 2 m showAt 64 4 m showAt 63 6 m showAt 62 8 m showAt 61 10 m showAt 60 12 m showAt 59 14 m showAt 58 16 m showAt 57 18 m showAt 56 20 m showAt 55 22 m showAt 54 24 m showAt 53 26 m showAt 52 28 m showAt 51 30 m showAt 50 32 m showAt 49 34 m showAt 48 36 m showAt 47 38 m showAt 46 40 m showAt 45 42 m showAt 44 44 m showAt 43 46 m showAt 42 48 m showAt 41 50 m showAt 40 52 m showAt 39 54 m showAt 38 56 m showAt 37 58 m showAt 36 60 m showAt 35 62 m showAt 34 64 m showAt 33 66 // to the left and up m showAt 32 64 m showAt 31 62 m showAt 30 60 m showAt 29 58 m showAt 28 56 m showAt 27 54 m showAt 26 52 m showAt 25 50 m showAt 24 48 m showAt 23 46 m showAt 22 44 m showAt 21 42 m showAt 20 40 m showAt 19 38 m showAt 18 36 m showAt 17 34 m showAt 16 32 m showAt 15 30 m showAt 14 28 m showAt 13 26 m showAt 12 24 m showAt 11 22 m showAt 10 20 m showAt 9 18 m showAt 8 16 m showAt 7 14 m showAt 6 12 m showAt 5 10 m showAt 4 8 m showAt 3 6 m showAt 2 4 m showAt 1 2 :repeat #end #define showAt o `0` `1` // set location wvr `1` 43 // wait for retrace xi 9 0 0 // display bitmap #end // to debug the mpush/mpop buffer #define display_memory t "`M`" #end // to debug poweron macros #define pontest beep 100 w 500 :repeat #end // startup calibration option #define optional_calibration s 0 1 z f24B // whole screen touch area xs 128 0 0 319 239 // if touched, execute macro xm 128 touch_calibrate t "Touch screen to calibrate." 20 100 w 1000 t "." w 1000 t "." w 1000 t "." w 1000 xc 128 #end // calibrate then run demo #define touch_calibrate tc m clear m splash_logos #end #define splash_fixed_fonts m clear // clear screen f 24BC t "Fixed Width Fonts Include:" 20 5 sc 0 0 o 25 40 f 4x6 t "4x6 font: quick brown fox 0123" f 8x10 t "\n" f 6x8 t "6x8 font: quick brown fox 0123" f 8x12 t "\n" f 8x8 t "8x8 font: quick brown fox 0123" f 8x12 t "\n" f 8x10 t "8x10 font: quick brown fox 0123" f 8x12 t "\n" f 8x13 t "8x13 font: quick brown fox 0123" f 8x16 t "\n" f 8x16 t "8x16 font: quick brown fox 0123" f 8x16 t "\n" f 12x24 t "12x24 font: quick 0123" f 12x24 t "\n" f 16x32i t "16x32 font: 0123" f 8x16 t "\n\n" f 32x64 t "32X64\xB0C" m next_button macro_parms #end // run demo without calibrate #define demo_nocalib m clear m splash_logos #end // demo the slider control #define demo_slider m clear // clear screen *debounce 10 // fast response for sliders f 24BC t "Slider Control Demo" 50 5 // display left slider sl 128 42 40 95 43 0 0 1 1 50 0 m slider128_update // display its value // when slider is touched, update the displayed value xm 128 slider128_update // display right slider and text sl 129 44 120 50 45 5 0 1 1 255 10 f 16 t "Move\nto\nchange\npanel\nbacklight" 220 80 // set to max sv 129 255 // implement setting m slider129_update // when slider is touched, use it to change brightness xm 129 slider129_update // link to next screen m next_button demo_sliding_compass #end // demo the sliding compass #define demo_sliding_compass m clear // clear screen f 24BC t "Sliding Compass Demo" 49 5 xbbs 255 // restore full bright *debounce 100 // restore default // compass pointer indicator tr 160 100 140 60 180 60 F00 // display initial compass slide xio 46 60 100 1 200 0 m next_button demo_meter1 m compass_slide_action #end #define compass_slide_action //move the compass around m compass_slide_offset 5 75 m compass_slide_offset 7 75 m compass_slide_offset 9 75 m compass_slide_offset 11 75 m compass_slide_offset 13 75 m compass_slide_offset 15 75 m compass_slide_offset 17 75 m compass_slide_offset 19 75 m compass_slide_offset 21 75 m compass_slide_offset 23 75 m compass_slide_offset 25 75 m compass_slide_offset 27 75 m compass_slide_offset 29 75 m compass_slide_offset 31 75 m compass_slide_offset 33 75 m compass_slide_offset 35 75 m compass_slide_offset 37 75 m compass_slide_offset 39 75 m compass_slide_offset 41 75 m compass_slide_offset 43 75 m compass_slide_offset 45 75 m compass_slide_offset 44 75 m compass_slide_offset 45 75 m compass_slide_offset 46 75 m compass_slide_offset 47 75 m compass_slide_offset 48 75 m compass_slide_offset 49 75 m compass_slide_offset 50 75 m compass_slide_offset 51 100 m compass_slide_offset 50 75 m compass_slide_offset 49 75 m compass_slide_offset 48 75 m compass_slide_offset 47 75 m compass_slide_offset 45 75 m compass_slide_offset 43 75 m compass_slide_offset 41 75 m compass_slide_offset 39 75 m compass_slide_offset 37 75 m compass_slide_offset 35 75 m compass_slide_offset 33 75 m compass_slide_offset 31 75 m compass_slide_offset 29 75 m compass_slide_offset 27 75 m compass_slide_offset 25 75 m compass_slide_offset 23 75 m compass_slide_offset 21 75 m compass_slide_offset 19 75 m compass_slide_offset 17 75 m compass_slide_offset 15 75 m compass_slide_offset 13 75 m compass_slide_offset 11 75 m compass_slide_offset 9 75 m compass_slide_offset 7 75 m compass_slide_offset 5 75 m compass_slide_offset 3 75 m compass_slide_offset 2 75 m compass_slide_offset 1 75 m compass_slide_offset 0 75 :repeat #end #define compass_slide_offset xio 46 60 100 1 200 `0` w `1` #end #define slider128_update f 24 ta CT // text align align center top t " `L128` " 52 70 #end #define slider129_update xbbs `L129` #end // demo meter 1 #define demo_meter1 m clear // clear screen f 24BC t "Gauge Meter Demo" 50 5 m next_button demo_meter2 //Display and move meter m create_meter1 m meter_move1 #end #define create_meter1 S FF0000 FFFFFF // red needle o 80 70 // md .. needle polygon points ... md 0 47 0 0 1 10 150 50 58 234 77 75 -3 36 0 75 3 36 #end #define meter_move1 mv 0 10 mv 0 11 mv 0 12 mv 0 13 mv 0 14 mv 0 15 mv 0 16 mv 0 17 mv 0 18 mv 0 19 mv 0 20 mv 0 21 mv 0 22 mv 0 23 mv 0 24 mv 0 25 mv 0 26 mv 0 27 mv 0 28 mv 0 29 mv 0 30 mv 0 31 mv 0 32 mv 0 33 mv 0 34 mv 0 35 mv 0 36 mv 0 37 mv 0 38 mv 0 39 mv 0 40 mv 0 41 mv 0 42 mv 0 43 mv 0 44 mv 0 45 mv 0 46 mv 0 47 mv 0 48 mv 0 49 mv 0 50 mv 0 51 mv 0 52 mv 0 53 mv 0 54 mv 0 55 mv 0 56 mv 0 57 mv 0 58 mv 0 59 mv 0 60 mv 0 59 mv 0 58 mv 0 57 mv 0 56 mv 0 55 mv 0 54 mv 0 53 mv 0 52 mv 0 51 mv 0 50 :repeat #end // demo meter 2 #define demo_meter2 m clear // clear screen f 24BC t "Framed Gauge Meter Demo" 20 2 m next_button splash_slcd //Display and move meter m create_meter2 m meter_move2 #end #define create_meter2 S CC0000 000000 // dark red needle o 35 25 // md .. needle polygon points ... md 1 48 0 0 1 475 515 495 270 90 126 120 -4 0 0 -78 4 0 #end #define meter_move2 mv 1 475 mv 1 476 mv 1 477 mv 1 478 mv 1 479 mv 1 480 mv 1 481 mv 1 482 mv 1 483 mv 1 484 mv 1 485 mv 1 486 mv 1 487 mv 1 488 mv 1 489 mv 1 490 mv 1 491 mv 1 492 mv 1 493 mv 1 494 mv 1 495 mv 1 496 mv 1 497 mv 1 498 mv 1 499 mv 1 500 mv 1 501 mv 1 502 mv 1 503 mv 1 504 mv 1 505 mv 1 506 mv 1 507 mv 1 508 mv 1 509 mv 1 510 mv 1 511 mv 1 512 mv 1 513 mv 1 514 mv 1 515 mv 1 514 mv 1 513 mv 1 512 mv 1 511 mv 1 510 mv 1 509 mv 1 508 mv 1 507 mv 1 506 mv 1 505 mv 1 504 mv 1 503 mv 1 502 mv 1 501 mv 1 500 mv 1 499 mv 1 498 mv 1 497 mv 1 496 mv 1 495 :repeat #end // This macro demonstrates the use macro parameters. // Refer to Software reference section, // "Macro Parameters (Arguments)". #define macro_parms m clear // clear screen f 24BC t "Macro Parameter Demo" 40 10 f 24 t "Macros can accept up to ten" 30 40 t "parameters!" 100 60 m display_parms Reach products allow you to always touch every single customer. m next_button macro_labels #end #define display_parms t "Below is the macro list:" 30 90 f 16 t "#1:`0` #2:`1` #3:`2` #4:`3` #5:`4`" 10 120 t "#6:`5` #7:`6` #8:`7` #9:`8` #10:`9`" 10 140 f 16 t "Parameters combined with text command:" 30 160 f 16 tf 0 500 "`0` `1` `2` `3` `4` `5` `6` `7`" 20 185 tf 1 500 "`8` `9`" 120 210 #end // This macro demonstrates the use of Labels. // Refer to Software reference section, // "Special macro arguments and commands". #define macro_labels //Common Code Area m clear // clear screen f 24BC t "Macro Label Demo" 50 10 f 24 t "Macros can contain control" 40 40 t "\":labels\"!" 120 60 bdc 0 110 90 2 "ON" "OFF" 30 31 //This line assigns a macro (with a pre-defined label) to a button state xm 0 execute_labels:s0_1 execute_labels:s0_0 m next_button keypad_demo #end #define execute_labels //Predefined labels are used when assigning a macro label to a button :s0_1 t "Macro label \"execute_labels:s0_1\" executed. " 20 185 :s0_0 t "Macro label \"execute_labels:s0_0\" executed. " 20 185 #end //--------------------------------------------------------------------- // STRIP CHART with 8 PENS //--------------------------------------------------------------------- #define demo_strip_chart m clear o 0 0 f 24B m center_cursor_horiz 12 ta CT t "New Chart Features:" f 13B m center_cursor_horiz 40 ta CT t "--Up to 8 pens--\n--Stripchart mode--" // define a strip chart with 8 pens, each with a pen width of 2: // -- index is 1 // -- corners are 50,90 and 270,169 // -- type is STRIP starting at RIGHT EDGE (3) // -- data width is 5 pixels // -- min/max data values are 0/160 // -- chart background color is a dark blue (RGB of 048) // -- pen colors are: // -- orange (F80) // -- red (F00) // -- green (0F0) // -- blue (00F) // -- purple (F0F) // -- yellow (FF0) // -- cyan (0FF) // -- white (FFF) cd 1 50 90 270 169 3 5 0 160 048 2 F80 2 F00 2 0F0 2 00F 2 F0F 2 FF0 2 0FF 2 FFF // put a black border around it, 2 pixels wide: S 000 FFF p2 r 48 88 271 170 // link to next screen m next_button demo_slider // loop on updating values until user presses Next button: m update_strip_chart #end #define update_strip_chart cv 1 `R00:20` `R20:40` `R40:60` `R60:80` `R80:100` `R100:120` `R120:140` `R140:160` w 100 :repeat #end //--------------------------------------------------------------------- // HORIZONTALLY CENTER CURSOR at given Y value //--------------------------------------------------------------------- #define center_cursor_horiz sc 160 `0` #end //--------------------------------------------------------------------- // STATE SAVE/RESTORE DEMO //--------------------------------------------------------------------- #define state_save_restore_demo m clear m center_cursor_horiz 12 f 24BC ta CT t "Drawing State\nSave/Restore Demo\n\n" f 24 ta CT t "Normal State\n" w 1000 m red_state w 1000 ta CT t "Normal Again" // link to next screen: m next_button window_save_restore_demo w 3000 :repeat #end #define red_state ss S FFF F00 f 24B ta CT t "\n\n White on Red State \n" sr #end //--------------------------------------------------------------------- // WINDOW SAVE/RESTORE DEMO //--------------------------------------------------------------------- #define window_save_restore_demo m clear m center_cursor_horiz 12 f 24BC ta CT t "Window Content\nSave/Restore Demo" // create "window 1" and save it to index 0: m create_window 1 F00 ws 110 70 210 170 0 w 500 // create "window 2" and save it to index 2: m create_window 2 00F ws 110 70 210 170 2 w 500 // link to next screen: m next_button dynamic_label_demo // toggle between windows: m toggle_windows #end #define create_window r 110 70 210 170 1 `1` m center_cursor_horiz 120 ta CC f 16B t " Window `0` " #end #define toggle_windows // restore "window 1" from index 0: wr 110 70 0 w 500 // restore "window 2" from index 2: wr 110 70 2 w 500 :repeat #end //--------------------------------------------------------------------- // This macro simply creates a pattern to check the pixel alignment. //--------------------------------------------------------------------- #define panel_pattern m clear f 24BC m center_cursor_horiz 20 ta CT t "Panel Alignment Pattern" f 18BC m center_cursor_horiz 60 ta CT t "Make sure that lines meet at panel corners." t "Supports: 320x240 and " 30 80 s 5 1 t "320x234" s 0 1 // setup to run new common demos, then do the "splash_info" demo last: set s8 "splash_info" m next_button start_common_new p 1 // big X l 0 0 319 239 l 319 0 0 239 // ^ l 0 120 160 0 l 160 0 319 120 // v l 0 120 160 239 l 319 120 160 239 // Alternate Pattern: 320x234 // Alternate color s 5 1 // big X l 0 0 319 233 l 319 0 0 233 // ^ l 0 117 160 0 l 160 0 319 117 // v l 0 117 160 233 l 319 117 160 233 #end //--------------------------------------------------------------------- // DEMO DYNAMIC MACRO LABELS //--------------------------------------------------------------------- #define dynamic_label_demo m clear m center_cursor_horiz 12 f 24BC ta CT t "Dynamic Labels Demo" m set_corner_points 160 100 // horiz, vert center of square m next_button text_in_box_demo m cycle_squares #end #define set_corner_points set i0 `(`0`-40)` set i1 `(`1`-40)` set i2 `(`0`+40)` set i3 `(`1`+40)` #end #define color_sqr // NOTE: use offset of 40 for QVGA, 60 for WQVGA :lbl_red r `i0` `i1` `i2` `i3` 1 F00 :lbl_yellow r `i0` `i1` `i2` `i3` 1 FF0 :lbl_green r `i0` `i1` `i2` `i3` 1 0F0 :lbl_blue r `i0` `i1` `i2` `i3` 1 00F #end #define show_cycle f 13B m center_cursor_horiz 160 // i1 + offset + 20 ta CT t " set s0 `0` \nm color_sqr:lbl_``s0``" #end #define do_cycle set s0 `0` m color_sqr:lbl_`s0` w 1000 #end #define cycle_squares m show_cycle red m do_cycle red m show_cycle yellow m do_cycle yellow m show_cycle green m do_cycle green m show_cycle blue m do_cycle blue :repeat #end //--------------------------------------------------------------------- // TEXT IN A BOX DEMO //--------------------------------------------------------------------- #define text_in_box_demo m clear m center_cursor_horiz 6 f 24BC ta CT t "Text In a Box Demo" // define corners of bounding box: m set_box_tlc:qvga_l m set_box_brc `i0` `i1` // show the bounding box using a red, filled rectangle: r `i0` `i1` `i2` `i3` 1 F00 // draw a black border around bounding box: S 000 F00 m draw_box_border `i0` `i1` `i2` `i3` // set foreground (text) to white and background to red: S FFF F00 // set font and alignment f13B ta CT // show a message centered along each edge of the box: t "Text can be aligned," `i0` `i1` `i2` `i3` w 1000 t "rotated, or wrapped" `i0` `i1` `i2` `i3` CW w 1000 t "within a bounding" `i0` `i1` `i2` `i3` I w 1000 t "rectangle (like this)." `i0` `i1` `i2` `i3` CCW w 1000 // and show a message centered in a smaller bounding box: m make_box_smaller `i0` `i1` `i2` `i3` r `i0` `i1` `i2` `i3` 1 FFF S 000 FFF m draw_box_border `i0` `i1` `i2` `i3` S F00 FFF // red foreground (text), white background ta CC t "It can also be word wrapped and centered." `i0` `i1` `i2` `i3` WW // map next button to next demo S 000 FFF // black foreground (text), white background m next_button relative_touch_demo #end #define set_box_tlc // box is 160x160 :wqvga_l // 480x272 set i0 159 // (480-160)/2 set i1 55 // (272-160)/2 :wqvga_p // 272x480 set i0 55 // (272-160)/2 set i1 159 // (480-160)/2 :qvga_l // 320x240 set i0 80 // (320-160)/2 set i1 40 // (240-160)/2 :qvga_p // 240x320 set i0 40 // (240-160)/2 set i1 80 // (320-160)/2 #end #define set_box_brc set i2 `(`0`+159)` // x1 = x0 + width - 1 set i3 `(`1`+159)` // y1 = y0 + height - 1 #end #define draw_box_border p2 r `(`0`-2)` `(`1`-2)` `(`2`+1)` `(`3`+1)` #end #define make_box_smaller set i0 `(`0`+40)` set i1 `(`1`+40)` set i2 `(`2`-40)` set i3 `(`3`-40)` #end //--------------------------------------------------------------------- // RELATIVE TOUCH DEMO //--------------------------------------------------------------------- #define relative_touch_demo m clear m center_cursor_horiz 6 f 24BC ta CT t "Relative Touch Demo" // define corners of bounding box: m set_box_tlc:qvga_l // following is a kludge; shifts box left by one pixel so the // background of the "next" button won't overwrite the last digit // of the brc label: m shift_corner_left `i0` m set_box_brc `i0` `i1` // show the map image (160x160 bmp): xi 49 `i0` `i1` // draw a red border around the image // and label the corners in red: S F00 FFF m draw_box_border `i0` `i1` `i2` `i3` m label_corners `i0` `i1` `i2` `i3` // setup the special hotspot: S 000 FFF m setup_xxy `i0` `i1` `i2` `i3` // map next button to next demo m next_button splash_charts #end // kludge: we used too big a bmp, need to move it left by one: #define shift_corner_left set i0 `(`0`-1)` #end #define label_corners f 8 sc `0` `(`1`-4)` ta CB t "0,0" sc `2` `(`1`-4)` ta CB t "159,0" sc `0` `(`3`+4)` ta CT t "0,159" sc `2` `(`3`+4)` ta CT t "159,159" #end #define show_xxy m center_cursor_horiz `(`0`+16)` ta CT t " Touched: `%3 Xr`,`%-3 Yr` " #end #define setup_xxy xxy 128 `0` `1` `2` `3` xa 128 p show_xxy `3` f 13B m center_cursor_horiz `(`3`+16)` ta CT t " Touch the map " #end //--------------------------------------------------------------------- // // Reach SLCD+/SLCD43/SLCD6 Common Macros for f/w ver 2.9.0++ new demos // 01-25-2011 // //--------------------------------------------------------------------- //--------------------------------------------------------------------- // Startup the new demos //--------------------------------------------------------------------- #define start_common_new set i9 1 m get_next_new_demo:demo_`i9` m goto_macro `s9` #end //--------------------------------------------------------------------- // Get the name of the next New Demo macro to run // -- defines a virtual list of demo macros using var i9 and labels // -- var i9 is the number of the demo in this virtual list (1 = first) // -- sets var s9 to the macro's name // -- after the last demo has been executed, the next call will cause // the :default label to execute, which sets the Next Button to run // the demo name stored in string s8 //--------------------------------------------------------------------- #define get_next_new_demo // // common section, executed on each call: set i9 `(`i9`+1)` // increment for next call // :demo_1 set s9 "inc_dec_ctl_demo" // :demo_2 set s9 "chart_data_break_demo" // :demo_3 set s9 "countdown_demo" // :demo_4 set s9 "meter_band_demo" // :demo_5 set s9 "new_keypad_demo" // :default set s9 "`s8`" #end //--------------------------------------------------------------------- // NEW INCREMENT/DECREMENT CONTROL DEMO //--------------------------------------------------------------------- #define inc_dec_ctl_demo set i8 52 // bitmap index of upArrowRelease; must // be followed by upArrowPress, then // dnArrowRelease, and dnArrowPress // touch off m n_clear m show_title "Inc/Dec Ctl Demo" // // draw control border, 1 pixel wide lines, centered on screen: // -- arrow bitmaps are 32x32 // -- num display region is 32x32 // -- arrow bitmaps and num display region are 5 pixels apart vertically from // each other and from the border; they are also 5 pixels horizontally from // the border // -- height of border: 5+32+5+32+5+32+5 = 116 // -- width of border: 5+32+5 = 42 p 1 m center_box_on_screen 42 116 r `p0` `p1` // define up arrow button: bdc 1 `(`p0.x`+5)` `(`p0.y`+5)` 30 "" `i8` `(`i8`+1)` xm 1 inc_num // define down arrow button: // -- from top border to top of bitmap is 5+32+5+32+5 = 79 bdc 2 `(`p0.x`+5)` `(`p0.y`+79)` 30 "" `(`i8`+2)` `(`i8`+3)` xm 2 dec_num // init number, increment and show it: set i7 4 m inc_num // m get_next_new_demo:demo_`i9` m n_next_button `s9` touch on #end #define inc_num xd 1 xd 2 set i7 `(`i7`+1)` m limit_num:val_`i7` m show_num xe 1 xe 2 #end #define dec_num xd 1 xd 2 set i7 `(`i7`-1)` m limit_num:val_`i7` m show_num xe 1 xe 2 #end #define limit_num // don't go below 0: :val_-1 set i7 0 // don't go above 9: :val_10 set i7 9 // otherwise, don't change i7 :default w 0 #end #define show_num f 24B sc `Xc` `Yc` ta CC t "`i7`" N #end //--------------------------------------------------------------------- // NEW CHART WITH DATA BREAK DEMO //--------------------------------------------------------------------- #define chart_data_break_demo touch off m n_clear m show_title "Data Break Demo" // // define a strip chart with 3 pens: // -- index is 1 // -- chart will be (Screen Width - 20) x 160 // -- type is OSC (1) // -- data width is 5 pixels // -- min/max data values are 0/160 // -- chart background color is a dark blue (RGB of 048) // -- pen colors and widths: // -- red (F00) 1 // -- green (0F0) 3 // -- yellow (FF0) 1 m center_box_on_screen `(`Xm`-19)` 160 // move up 7 pixels on screen, so QVGA looks better: set p0 `p0.x` `(`p0.y`-7)` set p1 `p1.x` `(`p1.y`-7)` cd 1 `p0.x` `p0.y` `p1.x` `p1.y` 1 5 0 160 048 2 F00 2 0F0 2 FF0 // put a black border around it: S 000 FFF m n_draw_box_border `p0` `p1` // m get_next_new_demo:demo_`i9` m n_next_button `s9` touch on // // loop on updating values until user presses button: set i0 0 m update_data_break #end #define update_data_break m update_pen:lbl_`i0` :repeat #end #define update_pen set i0 `(`i0`+1)` :lbl_40 set i0 0 cv 1 - - - w 25 cv 1 30 75 127 w 25 cv 1 - - - w 25 cv 1 30 75 127 w 25 cv 1 - - - w 25 cv 1 30 75 127 w 25 cv 1 - - - w 25 :default cv 1 `R10:50` `R55:95` `R100:155` w 25 #end //--------------------------------------------------------------------- // NEW COUNTDOWN AND GOTO MACRO DEMO //--------------------------------------------------------------------- #define countdown_demo touch off m n_clear m show_title "Countdown Demo" m get_next_new_demo:demo_`i9` m n_next_button `s9` touch on // set p0 `Xc` `Yc` set i0 5 f 32B m countdown_and_goto count_expired #end #define count_expired touch off m n_clear m show_title "Countdown Demo" f 24B sc `Xc` `Yc` ta CC t "Count Expired" m n_next_button `s9` touch on #end //--------------------------------------------------------------------- // NEW METER WITH BAND DEMO //--------------------------------------------------------------------- #define meter_band_demo touch off m n_clear m show_title "Meter Band Demo" // // define the meter, centered on screen, with red indicator: m center_box_on_screen `W51` `H51` // foreground color used for indicator (red) S f00 fff // // mdb // // mdb 0 51 `p0.x` `p0.y` 1 0 8000 0 60 300 0 3000 78 4 0f0 ccc 88 88 -4 0 0 64 4 0 // restore to black text on white background S 000 FFF // m get_next_new_demo:demo_`i9` m n_next_button `s9` touch on // // loop on updating values until user presses a button: m loop_on_sweeps #end #define loop_on_sweeps // // accelerate 0-3200 rpm with GREEN band 0-3400 set i0 0 set i1 3200 set i2 20 set s0 0f0 // start with bigger steps, we're not under load m show_rpm 0 m show_rpm 100 m show_rpm 200 m show_rpm 300 m show_rpm 400 m show_rpm 500 m show_rpm 600 m show_rpm 700 m show_rpm 800 m show_rpm 900 m show_rpm 1000 m show_rpm 1100 m show_rpm 1200 m show_rpm 1300 m show_rpm 1400 m show_rpm 1500 m show_rpm 1600 m show_rpm 1700 m show_rpm 1800 m show_rpm 1900 m show_rpm 2000 // smaller steps, we're under load: m show_rpm 2050 m show_rpm 2100 m show_rpm 2150 m show_rpm 2200 m show_rpm 2250 m show_rpm 2300 m show_rpm 2350 m show_rpm 2400 m show_rpm 2450 m show_rpm 2500 m show_rpm 2550 m show_rpm 2600 m show_rpm 2650 m show_rpm 2700 m show_rpm 2750 m show_rpm 2800 m show_rpm 2850 m show_rpm 2900 m show_rpm 2950 m show_rpm 3000 m show_rpm 3050 m show_rpm 3100 m show_rpm 3150 m show_rpm 3200 // // decelerate to 2450 // set i2 100 m show_rpm 2850 m show_rpm 2450 // // accelerate 2400-3400 rpm with GREEN band 2200-3400 set i0 2200 set i1 3400 set i2 20 set s0 0f0 m show_rpm 2400 m show_rpm 2450 m show_rpm 2500 m show_rpm 2550 m show_rpm 2600 m show_rpm 2650 m show_rpm 2700 m show_rpm 2750 m show_rpm 2800 m show_rpm 2850 m show_rpm 2900 m show_rpm 2950 m show_rpm 3000 m show_rpm 3050 m show_rpm 3100 m show_rpm 3150 m show_rpm 3200 m show_rpm 3250 m show_rpm 3300 m show_rpm 3350 m show_rpm 3400 // // accelerate 3450-3800 rpm with YELLOW band 3400-3800 set i0 3400 set i1 3800 set s0 ff0 m show_rpm 3450 m show_rpm 3500 m show_rpm 3550 m show_rpm 3600 m show_rpm 3650 m show_rpm 3700 m show_rpm 3750 m show_rpm 3800 // // accelerate 3850-4200 rpm with RED band 3800-8000 set i0 3800 set i1 8000 set s0 f00 m show_rpm 3850 m show_rpm 3900 m show_rpm 3950 m show_rpm 4000 m show_rpm 4050 m show_rpm 4100 m show_rpm 4150 m show_rpm 4200 // // decelerate to 2450 set i2 100 m show_rpm 3850 set i0 3400 set i1 3800 set s0 ff0 m show_rpm 3450 set i0 2200 set i1 3400 set s0 0f0 m show_rpm 2850 m show_rpm 2450 // // pause 1/2 second, then repeat: w 500 :repeat #end #define show_rpm // arg 0 ... rpm // i0 ...... band min // i1 ...... band max // i2 ...... pause in milliseconds // s0 ...... band color // // mvb // mvb 0 `0` `i0` `i1` 78 4 `s0` f00 w `i2` #end //--------------------------------------------------------------------- // NEW KEYPAD DEMO //--------------------------------------------------------------------- #define new_keypad_demo // set i8 12 // input box bitmap set p8 `W12` `H12` // box width and height set i7 39 // key bitmap, unpressed (`i7`+1 is pressed) set p7 `W39` `H39` // key width and height set p6 10 5 // border offset, input box to key offset // touch off m n_clear m show_title "Keypad Demo" // // draw keypad background and border: // -- width = (2*p6.x)+(3*p7.x) set i4 `(`p6.x`*2)` set i2 `(3*`p7.x`)` set i2 `(`i4`+`i2`)` // -- height = (2*p6.x)+p6.y+p8.y+(4*p7.y) set i3 `(4*`p7.y`)` set i3 `(`i3`+`p8.y`)` set i3 `(`i3`+`p6.y`)` set i3 `(`i3`+`i4`)` m center_box_on_screen `i2` `i3` // -- lower by 7 pixels on screen: set p0 `p0.x` `(`p0.y`+7)` set p1 `p1.x` `(`p1.y`+7)` r `p0` `p1` 1 008 m n_draw_box_border `p0` `p1` // // place the input box // -- p2.x = Xc-(p8.x/2) set i0 `(`p8.x`/2)` set i0 `(`Xc`-`i0`)` // -- p2.y = p0.y+p6.x set i1 `(`p0.y`+`p6.x`)` set p2 `i0` `i1` xi `i8` `p2` // // determine BRC of input box: // -- p3.x = p2.x+p8.x-1 set i0 `(`p2.x`+`p8.x`)` set i0 `(`i0`-1)` // -- p3.y = p2.y+p8.y-1 set i1 `(`p2.y`+`p8.y`)` set i1 `(`i1`-1)` set p3 `i0` `i1` // // clear M string: mpop -1 // // place the keys: // -- i2 = p0.x+p6.x set i2 `(`p0.x`+`p6.x`)` // -- i4 = p0.y+p6.x+p8.y+p6.y set i4 `(`p0.y`+`p6.x`)` set i4 `(`i4`+`p8.y`)` set i4 `(`i4`+`p6.y`)` // -- row 1: 1 2 3 set i3 `i2` m make_key 1 `i3` `i4` "1" set i3 `(`i3`+`p7.x`)` m make_key 2 `i3` `i4` "2" set i3 `(`i3`+`p7.x`)` m make_key 3 `i3` `i4` "3" // -- row 2: 4 5 6 set i4 `(`i4`+`p7.y`)` set i3 `i2` m make_key 4 `i3` `i4` "4" set i3 `(`i3`+`p7.x`)` m make_key 5 `i3` `i4` "5" set i3 `(`i3`+`p7.x`)` m make_key 6 `i3` `i4` "6" // -- row 3: 7 8 9 set i4 `(`i4`+`p7.y`)` set i3 `i2` m make_key 7 `i3` `i4` "7" set i3 `(`i3`+`p7.x`)` m make_key 8 `i3` `i4` "8" set i3 `(`i3`+`p7.x`)` m make_key 9 `i3` `i4` "9" // -- row 4: 0 < set i4 `(`i4`+`p7.y`)` set i3 `i2` set i3 `(`i3`+`p7.x`)` m make_key 0 `i3` `i4` "0" set i3 `(`i3`+`p7.x`)` m make_key 10 `i3` `i4` "<-" // // attach the keys xa 0 p show_keypress "0" xa 1 p show_keypress "1" xa 2 p show_keypress "2" xa 3 p show_keypress "3" xa 4 p show_keypress "4" xa 5 p show_keypress "5" xa 6 p show_keypress "6" xa 7 p show_keypress "7" xa 8 p show_keypress "8" xa 9 p show_keypress "9" xa 10 p do_backspace // m get_next_new_demo:demo_`i9` m n_next_button `s9` touch on #end #define make_key f 18BC bdc `0` `1` `2` 1 "`3`" `i7` `(`i7`+1)` #end #define show_keypress f 18BC mpush "`0`" 6 // limit to 6 digits xi `i8` `p2` ta CC t "`M`" `p2` `p3` T tm N #end #define do_backspace f 18BC mpop 1 xi `i8` `p2` ta CC t "`M`" `p2` `p3` T tm N #end /////////////////////////////////////////////////////////////////////// // SUPPORT MACROS FOR NEW DEMOS /////////////////////////////////////////////////////////////////////// //--------------------------------------------------------------------- // Clear the display (black text, white background), restore origin, // set full bright //--------------------------------------------------------------------- #define n_clear s 0 1 z o 0 0 xbbs 255 // special xbb cmd, does NOT update EEPROM tm N #end //--------------------------------------------------------------------- // Clear the display (white text, black background), restore origin, // set full bright //--------------------------------------------------------------------- #define clearWhiteOnBlack s 1 0 z o 0 0 xbbs 255 // special xbb cmd, does NOT update EEPROM tm N #end //--------------------------------------------------------------------- // Show title //--------------------------------------------------------------------- #define show_title f 24BC ta CT sc `Xc` 4 t "`0`\n" #end //--------------------------------------------------------------------- // Display the "next" button in the lower right corner and attach the // given macro // -- arg 0 is name/index of macro // -- the button's index is always 126 // -- the button's bitmaps are always #1 and #2 // -- uses Xmax and Ymax variables and simple math to place the button // 2 pixels in from the right and bottom edges // -- uses i0 i1 //--------------------------------------------------------------------- #define n_next_button // s 0 1 f 16B set i0 `(`W2`+2)` // width of bitmap2 + 2 set i1 `(`H2`+2)` // height of bitmap2 + 2 bdc 126 `(`Xm`-`i0`)` `(`Ym`-`i1`)` 1 "Next" 1 2 xm 126 `0` #end //--------------------------------------------------------------------- // Center a box of given width and height on the display screen // -- arg 0 1 ....... width and height of box // -- sets p0 p1 .... TLC and BRC of box, centered on screen //--------------------------------------------------------------------- #define center_box_on_screen m center_box_in_box `0` `1` 0 0 `Xm` `Ym` #end //--------------------------------------------------------------------- // Center a box of given width and height within a box of given // TLC point and BRC point // -- arg 0 1 ....... width and height of inner box // -- arg 2 3 4 5 ... TLC and BRC of outer box // -- sets p0 p1 .... TLC and BRC of inner box // -- uses i0 i1 //--------------------------------------------------------------------- #define center_box_in_box // calc horz diff / 2: set i0 `(`4`-`2`)` // diff of outer box X pts set i0 `(`i0`+1)` // width of outer box set i0 `(`i0`-`0`)` // diff of widths set i0 `(`i0`/2)` // half diff // calc vert diff / 2: set i1 `(`5`-`3`)` // diff of outer box Y pts set i1 `(`i1`+1)` // height of outer box set i1 `(`i1`-`1`)` // diff of heights set i1 `(`i1`/2)` // half diff // calc inner box TLC: set p0 `(`2`+`i0`)` `(`3`+`i1`)` // calc inner box BRC: set p1 `(`p0.x`+`0`)` `(`p0.y`+`1`)` set p1 `(`p1.x`-1)` `(`p1.y`-1)` #end //--------------------------------------------------------------------- // Draw a 2 pixel wide border around the given rectangle // -- arg 0 is Top Left Corner X coordinate // -- arg 1 is Top Left Corner Y coordinate // -- arg 2 is Bottom Right Corner X coordinate // -- arg 3 is Bottom Right Corner Y coordinate //--------------------------------------------------------------------- #define n_draw_box_border p1 r `(`0`-1)` `(`1`-1)` `(`2`+1)` `(`3`+1)` r `(`0`-2)` `(`1`-2)` `(`2`+2)` `(`3`+2)` #end //--------------------------------------------------------------------- // Count down `i0` seconds and then "goto" the macro given as arg 0 // -- arg 0 is index/name of macro to run if count down expires // -- var i0 is number of seconds to count down // -- var p0 is horiz and vert center point of count down display //--------------------------------------------------------------------- #define countdown_and_goto m dec_count_and_wait:sec_`i0` `0` :repeat #end #define dec_count_and_wait // // when the count expires, we execute this label :sec_0 // // TRICK: create a stateful button, quietly attach the given macro to it, // and then set it's state to 1. This will simulate the button being // pressed, the given macro will be scheduled to run, and all currently // running macros will abort. This works whether or not touch is disabled // by a "touch off" command. So the button will not disturb the screen, // we use a small non-drawing bitmap for the pressed and release states // (solid white with white as the transparent mask color). // bdc 127 0 0 20 "" "" 50 50 xmq 127 `0` ssb 127 1 // // until the count expires, we execute this label :default sc `p0` ta CC t " `i0` " w 1000 set i0 `(`i0`-1)` #end //--------------------------------------------------------------------- // Goto macro given as arg0 //--------------------------------------------------------------------- #define goto_macro // // TRICK: create a stateful button, quietly attach the given macro to it, // and then set it's state to 1. This will simulate the button being // pressed, the given macro will be scheduled to run, and all currently // running macros will abort. This works whether or not touch is disabled // by a "touch off" command. So the button will not disturb the screen, // we use a small non-drawing bitmap for the pressed and release states // (solid white with white as the transparent mask color). // bdc 127 0 0 20 "" "" 50 50 xmq 127 `0` ssb 127 1 #end