' Program to act as a simple Teleprompter, closely based on PROMPTER.BBC ' supplied as one of the example programs with 'BBC BASIC for 'Windows'. ' Richard Russell, 15th October 2016 Text$ = "This is a demonstration of a simple teleprompter-like display in "; _ "Liberty BASIC. It is closely based on the program PROMPTER.BBC "; _ "which is supplied as one of the example programs with 'BBC BASIC "; _ "for Windows'."; chr$(13); chr$(10); _ "The actual scrolling is carried out with the ScrollDC API function; "; _ "the scrolling is not perfectly smooth because it is "; _ "not synchronised with the display refresh rate."; chr$(13); chr$(10); _ "The program would be improved by a means to pause the scrolling, or "; _ "to control the scrolling speed to match the reader's pace." RowHeight = 80 TotalWidth = DisplayWidth TotalHeight = DisplayHeight nomainwin open "Teleprompter" for graphics_fs as #w #w "trapclose [quit]" #w "horizscrollbar off" #w "vertscrollbar off" #w "font Arial 0 "; RowHeight #w "down; fill black; backcolor black; color white" hw = hwnd(#w) calldll #user32, "GetDC", hw as ulong, hdc as ulong timer 25, [scroll] wait end [quit] close #w end [scroll] calldll #user32, "ScrollDC", hdc as ulong, 0 as long, -1 as long, _ 0 as long, 0 as long, 0 as long, 0 as long, r as void if ScrollCount = 0 then ScrollCount = RowHeight row$ = "" do row$ = row$ + wrd$ i = instr(Text$, " ") j = instr(Text$, chr$(13)) if j <> 0 and j < i then i = j if i = 0 then i = len(Text$) wrd$ = left$(Text$, i) Text$ = mid$(Text$, i+1) temp$ = row$ + wrd$ #w "stringwidth? temp$ width" loop until width > TotalWidth or Text$ = "" or right$(row$,1) = chr$(13) if Text$ = "" then row$ = temp$ : wrd$ = "" #w "place 0 "; TotalHeight - RowHeight #w "\"; trim$(row$) end if ScrollCount = ScrollCount - 1 wait
|
|
|
|
|
|
|