Author Topic: Simple digital clock  (Read 3873 times)

0 Members and 1 Guest are viewing this topic.

Offline SquirrelMonkey

  • Newbie
  • Posts: 29
  • Youtuber and GIPHY artist
    • View Profile
    • Joluijten.com
Simple digital clock
« on: January 25, 2022, 09:31:56 pm »
Code: QB64: [Select]
  1. _Title "Clock"
  2. Locate 25, 1: Print String$(79, 220);: Locate 2, 1: Print String$(79, 223);
  3. Locate 21, 2: Print String$(77, 176);: Locate 22, 2: Print String$(77, 177);
  4. Locate 23, 2: Print String$(77, 178);: Locate 24, 2: Print String$(77, 219);
  5. For a = 1 To 24
  6.     Locate a + 1, 1: Print Chr$(219);
  7.     Locate a + 1, 79: Print Chr$(219);
  8. Next a: Palette 0, 1: Palette 1, 15
  9. Do: Locate 1, 1: Print " "; Time$
  10.     For b = 0 To 7: For a = 1 To 73: r$ = InKey$: If r$ <> "" Then End
  11.         If Point(a, b) = 0 Then Locate b + 9, a + 1: Print Chr$(32); Else Print Chr$(Int((Rnd * 3) + 176));
  12.         Next a
  13.         teller = teller + 1
  14.         If teller > 77 Then Locate 21, 2: Print String$(77, 176);
  15.         If teller > 77 Then Locate 22, 2: Print String$(77, 177);
  16.         If teller > 77 Then Locate 23, 2: Print String$(77, 178);
  17.         If teller > 77 Then Locate 24, 2: Print String$(77, 219);
  18.         If teller > 77 Then teller = 1
  19.         Locate 21, teller + 1: Print Chr$(219);: Locate 22, teller + 1: Print Chr$(178);
  20.         Locate 23, teller + 1: Print Chr$(177);: Locate 24, teller + 1: Print Chr$(176);
  21.     Next b: _Delay 1: Sound 29948, 0.03
  22.  
  23.  
  24.  
clock.png
* clock.png (Filesize: 35.72 KB, Dimensions: 1026x586, Views: 121)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Simple digital clock
« Reply #1 on: January 25, 2022, 10:01:17 pm »
That's kinda interesting.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Simple digital clock
« Reply #2 on: January 29, 2022, 04:17:17 pm »
Here's a plasma version:
Code: QB64: [Select]
  1. _Title "Plasma Time" ' b+ 2022-01-29
  2. Screen _NewImage(720, 160, 32)
  3. Color &HFF880000, &HFF000000
  4. While _KeyDown(27) = 0
  5.     Cls
  6.     For y = 0 To 15
  7.         If y < 10 Then
  8.             Locate y + 1, 1
  9.             For i = 1 To 10
  10.                 Print Time$; " ";:
  11.             Next
  12.         End If
  13.         For x = 0 To 63
  14.             If Point(x, y) <> Point(0, 0) Then cN = cN + 1: Line (x * 10 + 40, y * 10)-Step(9, 9), _RGB(127 + 127 * Sin(1.2 * .3 * cN), 127 + 127 * Sin(.06 * .3 * cN), 127 + 127 * Sin(.82 * .3 * cN)), BF
  15.         Next
  16.     Next
  17.     _Limit 1
  18.     Sound 1500, .03
  19.     _Display
  20.  

 
Plasma Time.PNG

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Simple digital clock
« Reply #3 on: January 29, 2022, 06:53:14 pm »
Awesome guys! I just threw time$ on some 1990's code I have from the newsgroup comp.lang.basic.misc to make it 3D looking. Since it's 1990's it was Screen 13, so I am using _FULLSCREEN. Press any key to stop the program.

Code: QB64: [Select]
  1. '3d Code from an old 1990's Internet Newsgroup comp.lang.basic.misc post.
  2.     Locate 1, 32
  3.     Color 1
  4.     Print Time$
  5.     For I = 118 To 820
  6.         For j = 0 To 810
  7.             If Point(I, j) > 0 Then Line ((I - 196) * 2, j * 2 + 50)-((I - 196) * 2 + 2, j * 2 + 52), 15, BF
  8.         Next j
  9.     Next I
  10.  
  11.     For I = 100 To 820
  12.         For j = 49 To 875
  13.             If Point(I, j) = 15 Then GoTo skip2j
  14.             If Point(I + 1, j + 1) = 15 Then PSet (I, j), 50
  15.             If Point(I, j + 1) = 15 Or Point(I + 1, j) = 15 Then PSet (I, j), 49
  16.             If Point(I - 1, j + 1) = 15 Or Point(I + 1, j - 1) = 15 Then PSet (I, j), 48
  17.             If Point(I, j - 1) = 15 Or Point(I - 1, j) = 15 Then PSet (I, j), 47
  18.             If Point(I - 1, j - 1) = 15 Then PSet (I, j), 46
  19.             skip2j:
  20.         Next j
  21.     Next I
  22.     For I = 100 To 820
  23.         For j = 49 To 875
  24.             If Point(I, j) = 15 Then PSet (I, j), 32 - (j - 49)
  25.         Next j
  26.     Next I
  27.  
  28.     For I = 1 To 5
  29.         n = I * 12
  30.         c = n * 65536 + n * 256 + n
  31.         Palette I + 45, c
  32.     Next I
  33.  
  34.     Line (0, 0)-(320, 30), 0, BF
  35.     _Display
  36.     Cls
  37.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Simple digital clock
« Reply #4 on: January 29, 2022, 07:01:15 pm »
Oh that's cool! That gives me an idea :-))

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Simple digital clock
« Reply #5 on: January 29, 2022, 07:56:46 pm »
Code: QB64: [Select]
  1. _Title "Plasma Time 3D" ' b+ 2022-01-29
  2. Screen _NewImage(720, 160, 32)
  3. Color &HFF880000, &HFF000000
  4. While _KeyDown(27) = 0
  5.     Cls
  6.     For y = 0 To 15
  7.         If y < 10 Then
  8.             Locate y + 1, 1
  9.             For i = 1 To 10
  10.                 Print Time$; " ";:
  11.             Next
  12.         End If
  13.         For x = 0 To 63
  14.             For z = 0 To 10
  15.                 If z < 10 Then
  16.                     If Point(x, y) <> Point(0, 0) Then Line (x * 10 + 40 + z, y * 10 + z)-Step(9, 9), _RGB32(68), BF
  17.                 Else
  18.                     If Point(x, y) <> Point(0, 0) Then cN = cN + 1: Line (x * 10 + 40, y * 10)-Step(9, 9), _RGB(127 + 127 * Sin(1.2 * .3 * cN), 127 + 127 * Sin(.06 * .3 * cN), 127 + 127 * Sin(.82 * .3 * cN)), BF
  19.                 End If
  20.             Next
  21.         Next
  22.     Next
  23.     _Limit 1
  24.     Sound 1500, .03
  25.     _Display
  26.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Simple digital clock
« Reply #6 on: January 30, 2022, 12:15:59 am »
LOL B+ that's totally funky! I also like the sound.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Simple digital clock
« Reply #7 on: January 30, 2022, 12:21:40 am »
Squirrel Monkey, I finally ran your clock. It's like seeing an old 80's LCD clock when you are half-asleep. WAY COOL! :-)

By the way, are you the same Squirrel Monkey on FaceBook that posts totally rad 80's or 90's technology stuff? They remake videos that are supposed to be from the 80's or 90's, for example, many of them are "THE WORLD WIDE WEB". Incredible stuff. :)