Author Topic: Time for Reflections  (Read 507 times)

Time for Reflections
« on: June 24, 2018, 06:42:26 PM »
Today is Sunday so why not a little reflection.

The included source code inside the archive includes text read and scrolled from a file.

The archive also includes all needed extra files so don't forget to get it.

The code below only shows fireworks above the reflected time.

Code: [Select]
_TITLE "Reflections"

' \/\/\/\/\/
' Fireworks
' /\/\/\/\/\
TYPE Pixel
  x AS DOUBLE
  y AS DOUBLE
END TYPE

DIM SHARED Stars(500) AS Pixel
DIM SHARED Pixels(500) AS Pixel

DIM SHARED Pi AS SINGLE
Pi = 3.141593

DIM SHARED fSize AS INTEGER
DIM SHARED fX AS SINGLE
DIM SHARED fY AS SINGLE
DIM SHARED fT AS SINGLE
DIM SHARED fG AS SINGLE
DIM SHARED fP AS SINGLE
DIM SHARED fS AS INTEGER

fG = 0.4
fP = 30
fSize = 1

DIM SHARED fRed AS INTEGER
DIM SHARED fGreen AS INTEGER
DIM SHARED fBlue AS INTEGER
fRed = 128 * RND + 128
fGreen = 128 * RND + 128
fBlue = 128 * RND + 128
' \/\/\/\/\/
' Fireworks
' /\/\/\/\/\

' \/\/\/\/\/\/\/\/\/
' Frames per Second
' /\/\/\/\/\/\/\/\/\
DIM fps AS INTEGER
DIM frames AS INTEGER
DIM oldTime AS STRING
frames = 1
oldTime = TIME$

' \/\/\/\/\/
' User Font
' /\/\/\/\/\
DIM SHARED CharFont(256) AS STRING
DIM SHARED TextChars(16) AS STRING
LoadFont 37

' \/\/\/\/\/\/\/\/
' Screen Dimesions
' /\/\/\/\/\/\/\/\
DIM SHARED sWidth AS INTEGER
DIM SHARED sHeight AS INTEGER
sWidth = 640
sHeight = 480

' \/\/\/\/\/\/\/\/
' Center Dimesions
' /\/\/\/\/\/\/\/\
DIM SHARED cWidth AS INTEGER
DIM SHARED cHeight AS INTEGER
cWidth = sWidth \ 2
cHeight = sHeight \ 2

' \/\/\/\/\/\/\/\/\/\/\/\/
' Reflective floor height
' /\/\/\/\/\/\/\/\/\/\/\/\
rY = sHeight - cHeight \ 2

' \/\/\/\/\/\/\/
' Create Screen
' /\/\/\/\/\/\/\
SCREEN _NEWIMAGE(sWidth, sHeight, 32)
_FULLSCREEN

' \/\/\/\/\/\/\/\/\/\/
' Initialize Fireworks
' /\/\/\/\/\/\/\/\/\/\
fS = 1: Fireworks

WHILE NOT Quit
  ' \/\/\/\/\/\/\/
  ' Draw Fireworks
  ' /\/\/\/\/\/\/\
  IF fT < 75 THEN
    fS = 0: Fireworks
  ELSE
    fS = 1: Fireworks
  END IF

  ' \/\/\/\/\/\/\/\/\/\/\/
  ' Draw reflective Floor
  ' /\/\/\/\/\/\/\/\/\/\/\
  LINE (0, rY)-(sWidth, sHeight), _RGB(143, 143, 143), BF

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Show FPS (Frames per Second)
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
  ' LOCATE 2, 2: PRINT fps;

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Show Current Time with reflection
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Display 8, sHeight - 48, TIME$

  ' \/\/\/\/\/
  ' Update FPS
  ' /\/\/\/\/\
  IF TIME$ = oldTime THEN
    frames = frames + 1
  ELSE
    fps = frames

    frames = 1
    oldTime = TIME$
  END IF

  IF INKEY$ = CHR$(27) THEN SYSTEM

  _DISPLAY
  _LIMIT 60
WEND

SUB Fireworks
tY = sHeight - cHeight \ 2
LINE (0, 0)-(sWidth, tY), _RGBA32(0, 0, 0, 20), BF

IF fS = 1 THEN
  fT = 0
  fX = sWidth * RND
  fY = tY * RND

  fRed = 128 * RND + 128
  fGreen = 128 * RND + 128
  fBlue = 128 * RND + 128

  Choice = 3 * RND

  FOR i = 0 TO UBOUND(Pixels)
    Pixels(i).x = RND * COS(2 * Pi * RND)
    Pixels(i).y = RND * SIN(2 * Pi * RND)
  NEXT
END IF

COLOR _RGB(fRed, fGreen, fBlue)

FOR i = 0 TO UBOUND(Pixels)
  Stars(i).x = fX + fT * fP * Pixels(i).x
  Stars(i).y = fY + fT * fP * Pixels(i).y + fT * fG * fT

  IF Stars(i).y < tY THEN
    IF Choice = 0 THEN PSET (Stars(i).x, Stars(i).y), _RGB(fRed, fGreen, fBlue)
    IF Choice = 1 THEN CIRCLE (Stars(i).x, Stars(i).y), fSize, _RGB(fRed, fGreen, fBlue)
    IF Choice = 2 THEN LINE (Stars(i).x - fSize, Stars(i).y - fSize)-(Stars(i).x + fSize, Stars(i).y + fSize), _RGB(fRed, fGreen, fBlue), BF
  END IF
NEXT

fT = fT + 0.1
END SUB

SUB LoadFont (Value AS INTEGER)
DIM Temp AS STRING

Temp = RIGHT$("0" + LTRIM$(STR$(Value)), 2)
OPEN ".\BinFonts\BINFNT" + Temp + ".DAT" FOR INPUT AS #1
FOR f = 1 TO 256: INPUT #1, CharFont(f): NEXT
CLOSE #1
END SUB

SUB Display (dx, dy, text AS STRING)
FOR x = 0 TO LEN(text) - 1
  Reflect 16 * x + dx, dy, ASC(MID$(text, x + 1, 1)) + 1
NEXT
END SUB

SUB Reflect (sx AS INTEGER, sy AS INTEGER, Char AS INTEGER)
DIM Temp AS STRING

cx = sx
cy = sy
by = cy + 47
size = 2

FOR y = 0 TO 15
  Temp = MID$(CharFont(Char), 8 * y + 1, 8)

  FOR x = 0 TO 7
    IF VAL(MID$(Temp, x + 1, 1)) = 1 THEN
      LINE (cx, cy)-(cx + size - 1, cy + size - 1), _RGB(0, 0, 0), BF

      c = 143 - 8 * y
      LINE (cx, by)-(cx + size - 1, by + size - 1), _RGB(c, c, c), BF
    END IF

    cx = cx + size
  NEXT

  cx = sx
  cy = cy + size
  by = by - size
NEXT
END SUB

Re: Time for Reflections
« Reply #1 on: June 24, 2018, 07:27:41 PM »
  • Best Answer
  • Nice reflected text. Dang, I pressed escape but it wouldn't, I had to exit by way of Task Manager.
    B = B + ...
    QB64 x 64 v1.2 2018 0228/86 git b30af92
    QB64 v1.2 20180228/86 git 6fde149
    QB64 v1.2 [dev build]_d84bb00

    Online FellippeHeitor

    • QB64 Developer
    • LET IT = BE
      • QB64.org
    Re: Time for Reflections
    « Reply #2 on: June 24, 2018, 07:31:44 PM »
  • Best Answer
  • Dang, I pressed escape but it wouldn't, I had to exit by way of Task Manager.

    You can press Alt+Enter until you leave full screen, then click the "x".

    Re: Time for Reflections
    « Reply #3 on: June 24, 2018, 07:34:06 PM »
  • Best Answer
  • Nice reflected text. Dang, I pressed escape but it wouldn't, I had to exit by way of Task Manager.

    Thank you bplus.

    You can also do 2 things to quit:
    1) Press Alt-F4
    2) Press Alt-Enter and then click on the X

    Re: Time for Reflections
    « Reply #4 on: June 24, 2018, 07:48:44 PM »
  • Best Answer
  • Thanks guys, I have written that down for future reference. I am sure it will come in handy.

    Oh, also I liked the twirly tails on fireworks.
    « Last Edit: June 24, 2018, 07:50:31 PM by bplus »
    B = B + ...
    QB64 x 64 v1.2 2018 0228/86 git b30af92
    QB64 v1.2 20180228/86 git 6fde149
    QB64 v1.2 [dev build]_d84bb00

    Re: Time for Reflections
    « Reply #5 on: June 24, 2018, 09:41:23 PM »
  • Best Answer
  • A small update just because I can.

    This one has the title scrolled in the middle of the screen (horizontal position <-->) and a starship that flies by changing height each time.

    Code: [Select]
    _TITLE "Reflections"

    RANDOMIZE TIMER

    ' \/\/\/\/\/
    ' Fireworks
    ' /\/\/\/\/\
    TYPE Pixel
      x AS DOUBLE
      y AS DOUBLE
    END TYPE

    DIM SHARED Stars(500) AS Pixel
    DIM SHARED Pixels(500) AS Pixel

    DIM SHARED Pi AS SINGLE
    Pi = 3.141593

    DIM SHARED fSize AS INTEGER
    DIM SHARED fX AS SINGLE
    DIM SHARED fY AS SINGLE
    DIM SHARED fT AS SINGLE
    DIM SHARED fG AS SINGLE
    DIM SHARED fP AS SINGLE
    DIM SHARED fS AS INTEGER

    fG = 0.4
    fP = 30
    fSize = 2

    DIM SHARED fRed AS INTEGER
    DIM SHARED fGreen AS INTEGER
    DIM SHARED fBlue AS INTEGER
    fRed = 128 * RND + 128
    fGreen = 128 * RND + 128
    fBlue = 128 * RND + 128
    ' \/\/\/\/\/
    ' Fireworks
    ' /\/\/\/\/\

    ' \/\/\/\/\/\/\/\/\/
    ' Frames per Second
    ' /\/\/\/\/\/\/\/\/\
    DIM fps AS INTEGER
    DIM frames AS INTEGER
    DIM oldTime AS STRING
    frames = 1
    oldTime = TIME$

    ' \/\/\/\/\/
    ' User Font
    ' /\/\/\/\/\
    DIM SHARED CharFont(256) AS STRING
    DIM SHARED TextChars(16) AS STRING
    LoadFont 37

    ' \/\/\/\/\/\/\/\/
    ' Screen Dimesions
    ' /\/\/\/\/\/\/\/\
    DIM SHARED sWidth AS INTEGER
    DIM SHARED sHeight AS INTEGER
    sWidth = 640
    sHeight = 480

    ' \/\/\/\/\/\/\/\/
    ' Center Dimesions
    ' /\/\/\/\/\/\/\/\
    DIM SHARED cWidth AS INTEGER
    DIM SHARED cHeight AS INTEGER
    cWidth = sWidth \ 2
    cHeight = sHeight \ 2

    ' \/\/\/\/\/\/\/\/\/\/\/\/
    ' Reflective floor height
    ' /\/\/\/\/\/\/\/\/\/\/\/\
    rY = sHeight - cHeight \ 2

    DIM text AS STRING
    text = "Reflections by Code Hunter"

    tLen = LEN(text)
    tx = cWidth - 8 * tLen

    text = SPACE$(tLen) + text + SPACE$(tLen)

    ' \/\/\/\/\/\/\/
    ' Text Position
    ' /\/\/\/\/\/\/\
    tPos = 1

    ' \/\/\/\/\/\/\/
    ' Create Screen
    ' /\/\/\/\/\/\/\
    SCREEN _NEWIMAGE(sWidth, sHeight, 32)
    '_FULLSCREEN

    DIM SHARED fImage AS LONG
    fImage = _NEWIMAGE(sWidth, rY, 32)

    Starship = _LOADIMAGE(".\images\Starship.png")
    shipWidth = _WIDTH(Starship)
    shipHeight = _HEIGHT(Starship)

    shipX = -shipWidth
    shipY = rY \ 2 - shipHeight \ 2

    ' \/\/\/\/\/\/\/\/\/\/
    ' Initialize Fireworks
    ' /\/\/\/\/\/\/\/\/\/\
    fS = 1: Fireworks

    WHILE NOT Quit
      LINE (0, 0)-(sWidth, sHeight), _RGB(0, 0, 0), BF

      ' \/\/\/\/\/\/\/
      ' Draw Fireworks
      ' /\/\/\/\/\/\/\
      IF fT < 75 THEN
        fS = 0: Fireworks
      ELSE
        fS = 1: Fireworks
      END IF

      _PUTIMAGE (shipX, shipY), Starship

      shipX = shipX + 10
      IF shipX > sWidth THEN
        shipX = -shipWidth
        shipY = INT((rY - shipHeight) * RND)
      END IF

      ' \/\/\/\/\/\/\/\/\/\/\/
      ' Draw reflective Floor
      ' /\/\/\/\/\/\/\/\/\/\/\
      LINE (0, rY)-(sWidth, sHeight), _RGB(143, 143, 143), BF

      ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
      ' Show FPS (Frames per Second)
      ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
      ' LOCATE 2, 2: PRINT fps;

      Display tx, rY + 8, MID$(text, tPos, tLen)

      IF frames MOD 5 = 0 THEN
        tPos = tPos + 1: IF tPos > 2 * tLen THEN tPos = 1
      END IF

      ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
      ' Show Current Time with reflection
      ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
      Display 8, sHeight - 48, TIME$

      ' \/\/\/\/\/
      ' Update FPS
      ' /\/\/\/\/\
      IF TIME$ = oldTime THEN
        frames = frames + 1
      ELSE
        fps = frames

        frames = 1
        oldTime = TIME$
      END IF

      IF INKEY$ = CHR$(27) THEN SYSTEM

      _DISPLAY
      _LIMIT 60
    WEND

    SUB Fireworks
    DIM image AS LONG

    tY = sHeight - cHeight \ 2

    _DEST fImage
    LINE (0, 0)-(sWidth, tY), _RGBA32(0, 0, 0, 20), BF

    IF fS = 1 THEN
      fT = 0
      fX = sWidth * RND
      fY = tY * RND

      fRed = 128 * RND + 128
      fGreen = 128 * RND + 128
      fBlue = 128 * RND + 128

      Choice = 3 * RND

      FOR i = 0 TO UBOUND(Pixels)
        Pixels(i).x = RND * COS(2 * Pi * RND)
        Pixels(i).y = RND * SIN(2 * Pi * RND)
      NEXT
    END IF

    COLOR _RGB(fRed, fGreen, fBlue)

    FOR i = 0 TO UBOUND(Pixels)
      Stars(i).x = fX + fT * fP * Pixels(i).x
      Stars(i).y = fY + fT * fP * Pixels(i).y + fT * fG * fT

      IF Stars(i).y < tY THEN
        IF Choice = 0 THEN PSET (Stars(i).x, Stars(i).y), _RGB(fRed, fGreen, fBlue)
        IF Choice = 1 THEN CIRCLE (Stars(i).x, Stars(i).y), fSize, _RGB(fRed, fGreen, fBlue)
        IF Choice = 2 THEN LINE (Stars(i).x - fSize, Stars(i).y - fSize)-(Stars(i).x + fSize, Stars(i).y + fSize), _RGB(fRed, fGreen, fBlue), BF
      END IF
    NEXT

    _CLEARCOLOR _RGB(0, 0, 0), image

    _DEST 0
    _PUTIMAGE (0, 0), fImage

    fT = fT + 0.1
    END SUB

    SUB LoadFont (Value AS INTEGER)
    DIM Temp AS STRING

    Temp = RIGHT$("0" + LTRIM$(STR$(Value)), 2)
    OPEN ".\BinFonts\BINFNT" + Temp + ".DAT" FOR INPUT AS #1
    FOR f = 1 TO 256: INPUT #1, CharFont(f): NEXT
    CLOSE #1
    END SUB

    SUB Display (dx, dy, text AS STRING)
    FOR x = 0 TO LEN(text) - 1
      Reflect 16 * x + dx, dy, ASC(MID$(text, x + 1, 1)) + 1
    NEXT
    END SUB

    SUB Reflect (sx AS INTEGER, sy AS INTEGER, Char AS INTEGER)
    DIM Temp AS STRING

    cx = sx
    cy = sy
    by = cy + 47
    size = 2

    FOR y = 0 TO 15
      Temp = MID$(CharFont(Char), 8 * y + 1, 8)

      FOR x = 0 TO 7
        IF VAL(MID$(Temp, x + 1, 1)) = 1 THEN
          LINE (cx, cy)-(cx + size - 1, cy + size - 1), _RGB(0, 0, 0), BF

          c = 143 - 8 * y
          LINE (cx, by)-(cx + size - 1, by + size - 1), _RGB(c, c, c), BF
        END IF

        cx = cx + size
      NEXT

      cx = sx
      cy = cy + size
      by = by - size
    NEXT
    END SUB

    If you don't have the archive from the original post, please get it.

    Offline Ashish

    • The joy of coding is endless.
    Re: Time for Reflections
    « Reply #6 on: June 25, 2018, 11:28:01 AM »
  • Best Answer
  • Nice one, CodeHunter! :D
    if (Me.success) {Me.improve()} else {Me.tryAgain()}


    aKFrameWork - http://bit.ly/aKFrameWork
    Menu System - http://bit.ly/guiMenuBar
    p5.js in QB64 - http://bit.ly/p5jsbas

    @KingOfCoders

    Offline Petr

    • I am instructed.
    Re: Time for Reflections
    « Reply #7 on: June 25, 2018, 12:07:52 PM »
  • Best Answer
  • Very nice, CodeHunter! Try add _CLEARCOLOR _RGB32(0, 0, 0), Starship to line 101 :-D

    Re: Time for Reflections
    « Reply #8 on: June 25, 2018, 12:34:43 PM »
  • Best Answer
  • Very nice, CodeHunter! Try add _CLEARCOLOR _RGB32(0, 0, 0), Starship to line 101 :-D

    Thank you Petr.

    Adding _ClearColor won't do anything (in this situation) because the default transparency color is black and the starship image uses black as the background.


    Re: Time for Reflections
    « Reply #9 on: June 25, 2018, 12:38:37 PM »
  • Best Answer
  • Very nice, CodeHunter! Try add _CLEARCOLOR _RGB32(0, 0, 0), Starship to line 101 :-D

    Thank you Petr.

    Adding _ClearColor won't do anything (in this situation) because the default transparency color is black and the starship image uses black as the background.

    Small Edit.  In line 212 I also used a _ClearColor which can also be removed for the same reason.

    Re: Time for Reflections
    « Reply #10 on: June 25, 2018, 12:56:23 PM »
  • Best Answer
  • Here is a code example:

    Code: [Select]
    _TITLE "Reflections"

    RANDOMIZE TIMER

    ' \/\/\/\/\/
    ' Fireworks
    ' /\/\/\/\/\
    TYPE Pixel
      x AS DOUBLE
      y AS DOUBLE
    END TYPE

    DIM SHARED Stars(500) AS Pixel
    DIM SHARED Pixels(500) AS Pixel

    DIM SHARED Pi AS SINGLE
    Pi = 3.141593

    DIM SHARED fSize AS INTEGER
    DIM SHARED fX AS SINGLE
    DIM SHARED fY AS SINGLE
    DIM SHARED fT AS SINGLE
    DIM SHARED fG AS SINGLE
    DIM SHARED fP AS SINGLE
    DIM SHARED fS AS INTEGER

    fG = 0.4
    fP = 30
    fSize = 2

    DIM SHARED fRed AS INTEGER
    DIM SHARED fGreen AS INTEGER
    DIM SHARED fBlue AS INTEGER
    fRed = 128 * RND + 128
    fGreen = 128 * RND + 128
    fBlue = 128 * RND + 128
    ' \/\/\/\/\/
    ' Fireworks
    ' /\/\/\/\/\

    ' \/\/\/\/\/\/\/\/\/
    ' Frames per Second
    ' /\/\/\/\/\/\/\/\/\
    DIM fps AS INTEGER
    DIM frames AS INTEGER
    DIM oldTime AS STRING
    frames = 1
    oldTime = TIME$

    ' \/\/\/\/\/
    ' User Font
    ' /\/\/\/\/\
    DIM SHARED CharFont(256) AS STRING
    DIM SHARED TextChars(16) AS STRING
    LoadFont 20

    ' \/\/\/\/\/\/\/\/
    ' Screen Dimesions
    ' /\/\/\/\/\/\/\/\
    DIM SHARED sWidth AS INTEGER
    DIM SHARED sHeight AS INTEGER
    sWidth = 640
    sHeight = 480

    ' \/\/\/\/\/\/\/\/
    ' Center Dimesions
    ' /\/\/\/\/\/\/\/\
    DIM SHARED cWidth AS INTEGER
    DIM SHARED cHeight AS INTEGER
    cWidth = sWidth \ 2
    cHeight = sHeight \ 2

    ' \/\/\/\/\/\/\/\/\/\/\/\/
    ' Reflective floor height
    ' /\/\/\/\/\/\/\/\/\/\/\/\
    rY = sHeight - cHeight \ 2

    DIM text AS STRING
    text = "Reflections by Code Hunter"

    tLen = LEN(text)
    tx = cWidth - 8 * tLen

    text = SPACE$(tLen) + text + SPACE$(tLen)

    ' \/\/\/\/\/\/\/
    ' Text Position
    ' /\/\/\/\/\/\/\
    tPos = 1

    ' \/\/\/\/\/\/\/
    ' Create Screen
    ' /\/\/\/\/\/\/\
    SCREEN _NEWIMAGE(sWidth, sHeight, 32)
    '_FULLSCREEN

    ' \/\/\/\/\/\/\/\/
    ' Background Color
    ' /\/\/\/\/\/\/\/\
    DIM SHARED backRed AS INTEGER
    DIM SHARED backGreen AS INTEGER
    DIM SHARED backBlue AS INTEGER
    backRed = 0
    backGreen = 0
    backBlue = 127

    DIM SHARED fImage AS LONG
    fImage = _NEWIMAGE(sWidth, rY, 32)

    Starship = _LOADIMAGE(".\images\Starship.png")

    shipWidth = _WIDTH(Starship)
    shipHeight = _HEIGHT(Starship)

    shipX = -shipWidth
    shipY = rY \ 2 - shipHeight \ 2

    ' \/\/\/\/\/\/\/\/\/\/
    ' Initialize Fireworks
    ' /\/\/\/\/\/\/\/\/\/\
    fS = 1: Fireworks

    WHILE NOT Quit
      LINE (0, 0)-(sWidth, sHeight), _RGB(backRed, backGreen, backBlue), BF

      ' \/\/\/\/\/\/\/
      ' Draw Fireworks
      ' /\/\/\/\/\/\/\
      IF fT < 75 THEN
        fS = 0: Fireworks
      ELSE
        fS = 1: Fireworks
      END IF

      _PUTIMAGE (shipX, shipY), Starship

      shipX = shipX + 10
      IF shipX > sWidth THEN
        shipX = -shipWidth
        shipY = INT((rY - shipHeight) * RND)
      END IF

      ' \/\/\/\/\/\/\/\/\/\/\/
      ' Draw reflective Floor
      ' /\/\/\/\/\/\/\/\/\/\/\
      'LINE (0, rY)-(sWidth, sHeight), _RGB(143, 143, 143), BF
      LINE (0, rY)-(sWidth, sHeight), _RGB(192, 192, 192), BF

      ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
      ' Show FPS (Frames per Second)
      ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
      ' LOCATE 2, 2: PRINT fps;

      Display tx, rY + 8, MID$(text, tPos, tLen)

      IF frames MOD 5 = 0 THEN
        tPos = tPos + 1: IF tPos > 2 * tLen THEN tPos = 1
      END IF

      ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
      ' Show Current Time with reflection
      ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
      Display 8, sHeight - 48, LEFT$(TIME$, 2) + MID$(TIME$, 4, 2)

      ' \/\/\/\/\/
      ' Update FPS
      ' /\/\/\/\/\
      IF TIME$ = oldTime THEN
        frames = frames + 1
      ELSE
        fps = frames

        frames = 1
        oldTime = TIME$
      END IF

      IF INKEY$ = CHR$(27) THEN SYSTEM

      _DISPLAY
      _LIMIT 60
    WEND

    SUB Fireworks
    DIM image AS LONG

    tY = sHeight - cHeight \ 2

    _DEST fImage
    LINE (0, 0)-(sWidth, tY), _RGBA32(backRed, backGreen, backBlue, 20), BF

    IF fS = 1 THEN
      fT = 0
      fX = sWidth * RND
      fY = tY * RND

      fRed = 128 * RND + 128
      fGreen = 128 * RND + 128
      fBlue = 128 * RND + 128

      Choice = 3 * RND

      FOR i = 0 TO UBOUND(Pixels)
        Pixels(i).x = RND * COS(2 * Pi * RND)
        Pixels(i).y = RND * SIN(2 * Pi * RND)
      NEXT
    END IF

    COLOR _RGB(fRed, fGreen, fBlue)

    FOR i = 0 TO UBOUND(Pixels)
      Stars(i).x = fX + fT * fP * Pixels(i).x
      Stars(i).y = fY + fT * fP * Pixels(i).y + fT * fG * fT

      IF Stars(i).y < tY THEN
        IF Choice = 0 THEN PSET (Stars(i).x, Stars(i).y), _RGB(fRed, fGreen, fBlue)
        IF Choice = 1 THEN CIRCLE (Stars(i).x, Stars(i).y), fSize, _RGB(fRed, fGreen, fBlue)
        IF Choice = 2 THEN LINE (Stars(i).x - fSize, Stars(i).y - fSize)-(Stars(i).x + fSize, Stars(i).y + fSize), _RGB(fRed, fGreen, fBlue), BF
      END IF
    NEXT

    _DEST 0
    _PUTIMAGE (0, 0), fImage

    fT = fT + 0.1
    END SUB

    SUB LoadFont (Value AS INTEGER)
    DIM Temp AS STRING

    Temp = RIGHT$("0" + LTRIM$(STR$(Value)), 2)
    OPEN ".\BinFonts\BINFNT" + Temp + ".DAT" FOR INPUT AS #1
    FOR f = 1 TO 256: INPUT #1, CharFont(f): NEXT
    CLOSE #1
    END SUB

    SUB Display (dx, dy, text AS STRING)
    FOR x = 0 TO LEN(text) - 1
      Reflect 16 * x + dx, dy, ASC(MID$(text, x + 1, 1)) + 1
    NEXT
    END SUB

    SUB Reflect (sx AS INTEGER, sy AS INTEGER, Char AS INTEGER)
    DIM Temp AS STRING

    cx = sx
    cy = sy
    by = cy + 47
    size = 2

    FOR y = 0 TO 15
      Temp = MID$(CharFont(Char), 8 * y + 1, 8)

      FOR x = 0 TO 7
        IF VAL(MID$(Temp, x + 1, 1)) = 1 THEN
          LINE (cx, cy)-(cx + size - 1, cy + size - 1), _RGB(0, 0, 0), BF

          c = 192 - 8 * y
          LINE (cx, by)-(cx + size - 1, by + size - 1), _RGB(c, c, c), BF
        END IF

        cx = cx + size
      NEXT

      cx = sx
      cy = cy + size
      by = by - size
    NEXT
    END SUB

    Note that on line 100 I created variables to hold the background color and you can change the black background without the need of _ClearColor.

    Offline Petr

    • I am instructed.
    Re: Time for Reflections
    « Reply #11 on: June 25, 2018, 01:04:55 PM »
  • Best Answer
  • While ship fly, a fireworks hid behind ship image background and you can see a rectangular background. The ship does not have a transparent background set.

    Offline Petr

    • I am instructed.
    Re: Time for Reflections
    « Reply #12 on: June 25, 2018, 01:23:02 PM »
  • Best Answer
  • Look:

    Re: Time for Reflections
    « Reply #13 on: June 25, 2018, 05:32:49 PM »
  • Best Answer
  • Interesting.  I don't get that when I run the program.

    I don't know why you get the background and I don't.  Maybe someone can give clues to solving the mystery.

    Offline johnno56

    • Live long and prosper.
    Re: Time for Reflections
    « Reply #14 on: June 25, 2018, 06:53:09 PM »
  • Best Answer
  • Petr,

    I'm going out on a limb here and guess, mainly by the 4meg file, that you have setup your program to scroll through the entire King James Version of the Bible? Although I like your choice in Version, may I suggest something a 'little' shorter, say Psalm 23 or Psalm 119? I'm not sure that most users will want read through the entire Bible in one sitting... lol

    By the way. Excellent job with the reflection.... Very cool.

    J
    Logic is the beginning of wisdom.