Skip to content

Instantly share code, notes, and snippets.

@jsinai
Last active May 11, 2017 19:57
Show Gist options
  • Save jsinai/a959563a3567419ed1891f953d529944 to your computer and use it in GitHub Desktop.
Save jsinai/a959563a3567419ed1891f953d529944 to your computer and use it in GitHub Desktop.
A BrightScript subroutine that displays a message on the screen. Sample usage: Notify("my message", -1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Delay is in ms. Message will be displayed for this length of time.
' Specify 0 to return immediately, and rely on the parent message loop.
' Specify -1 for infinite display with a local message loop.
Sub Notify(message As String, delay As Integer)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
print message
gaa = GetGlobalAA()
If gaa.tw = invalid Then
videoMode = CreateObject("roVideoMode")
resX = videoMode.GetResX()
resY = videoMode.GetResY()
textParameters = CreateObject("roAssociativeArray")
textParameters.LineCount = 1
textParameters.TextMode = 2
textParameters.Rotation = 0
textParameters.Alignment = 1
End If
If gaa.tw = invalid Then
r=CreateObject("roRectangle",0,resY/2-resY/32,resX,resY/32)
gaa.tw = CreateObject("roTextWidget", r, 1, 2, textParameters)
End If
gaa.tw.Clear()
gaa.tw.PushString(message)
gaa.tw.Show()
If delay = -1 Then
While true
Sleep(1000)
End While
End If
If delay > 0 Then
Sleep(delay)
gaa.tw.Hide()
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment