QB64.org Forum

Active Forums => Programs => Topic started by: SierraKen on December 03, 2020, 06:52:38 pm

Title: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 03, 2020, 06:52:38 pm
I'm sure many of you have made this already, but I never have until today. It's a LCD display of the clock and date in large 72 size Lcd.ttf font. I also made it AM/PM because I'm sure most of you don't use the 24 hour clock. lol I made it a green LCD display like one of the clocks I have. I added the Lcd.ttf file to the zip file. Just put it in the same directory as the clock. You also can use it as a Windows font in your Windows/Fonts directory but most likely this comes with Windows anyways and you already have it.

Edit: I just added code to make it an alarm clock too! :) The zip file below has been updated.
Edit: Added "8" LCD shadows, a minor Esc key fix by making fonts small again when closing program, and stopped AM/PM from moving.
Edit: Lined up 8's a bit better. minor fixes, etc. See the code's remarks for more details.
Edit: Changed font and everything lines up perfectly now.
Edit: Fixed the hour line-up using _TRIM$.
Edit: Fixed one line.
Edit: Fixed Again
Edit: Fixed 0 hour from 24 hour clock to 12. (December 5, 2020).
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 03, 2020, 08:18:12 pm
I just added code to make it an alarm clock as well. You can set it for the year, month, day, hour, minute, and second. The updated zip file is above on the first post. Here is also a photo of it. Tell me what you think, thanks.

Edit: This is a very old version of the clock, the newer version is updated on the first post of this forum thread.
Title: Re: LCD Time and Date Using Windows Font
Post by: bplus on December 03, 2020, 09:32:26 pm
Ha! I am looking all over to see how you drew the segments to the digits... Oh, it's a Font! :0
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 03, 2020, 09:45:58 pm
Yep. :D And I learned a lot about fonts with this. I made it the highest size of 72 for that certain one.
Title: Re: LCD Time and Date Using Windows Font
Post by: Dav on December 03, 2020, 10:01:01 pm
Looks good to me.  Nice font choice for it.

- Dav
Title: Re: LCD Time and Date Using Windows Font
Post by: SMcNeill on December 03, 2020, 10:02:11 pm
Yep. :D And I learned a lot about fonts with this. I made it the highest size of 72 for that certain one.

Fonts have a highest size?  Since when?  Have you tried it at a higher point value?
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 03, 2020, 11:20:51 pm
Dang I had no idea Steve! I said "highest" because that's the highest number it uses on Microsoft Wordpad. I just threw in a size 120 on a test and it's HUGE! Thank you!!!
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 03, 2020, 11:23:05 pm
I'll keep this clock as size 72 though because it's a nice size that doesn't get in the way.
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 03, 2020, 11:24:39 pm
Thanks Dav. :) I hope people will use the alarm function. You can even set it to 10 seconds later or whatever. It continues to beep until you press any key.
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 04, 2020, 01:53:41 am
I just updated this clock to look better mostly and a minor fix (when you click Esc it goes to smaller fonts now to end the program). I also made it so the AM/PM doesn't move anymore. Here is the new look to it. I will update the zip file on the first post above as well. Adding background LCD "8" shadows were a bit tricky and they aren't an exact match, but they are as good as I can get it. Enjoy!

Title: Re: LCD Time and Date Using Windows Font
Post by: Richard Frost on December 04, 2020, 02:16:59 am
Very nice, but the digits don't always line up and the "blank" can be seen underneath.
Noticed it with the minutes and the last 2 digits of the year.  I should use that font for
the clocks in my chess - it'd be faster than plotting segments.
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 04, 2020, 02:41:13 am
Yep Richard, because the LCD fonts aren't exactly all lined up with the number 8, it won't come out perfectly. For example, the 7 is off the most from the 8 on the font. I might look at this more but I worked on just the shadows for over an hour. Not sure if I can make it better or not. I even had to add extra spaces on strings to line up just the 10's, because of the 1. It's a puzzle for sure, because like I said, not everything lines up with 8. As for the date, I just left it that way because to me it gives off a 3D effect. :)
Title: Re: LCD Time and Date Using Windows Font
Post by: SMcNeill on December 04, 2020, 07:38:56 am
Dang I had no idea Steve! I said "highest" because that's the highest number it uses on Microsoft Wordpad. I just threw in a size 120 on a test and it's HUGE! Thank you!!!

Here's a few tips when it comes to using fonts:

1) Fonts are really nothing more than a set of graphics that scale to whatever scale you set them.  This property of them is what had me so shocked when you said 72 was the upper limit of the font you're using.  Generally speaking, whatever size you set for the font, determines the HEIGHT, in pixels, of each character of the font.   A quick example is below:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32)
  2. FOR i = 10 TO 24
  3.     f = _LOADFONT("LCD.TTF", i)
  4.     _FONT f
  5.     LOCATE i - 9

As you can see, I'm using one font, from size 10 to size 24, and my _FONTHEIGHT matches the size I set for the font.  These aren't arbitrary numbers, like the dial on a radio where 1 to 10 is something different on different speakers; it's a set size of pixel height.  Width, of course, depends on the characters inside the font.  With many fonts, unless they're monospaced, "W" is a much wider character than "i".

Also, as you can see from running the above, the _FONTWIDTH is currently 0.  This is the basic response we get when we're using a font which isn't monospaced, as there's no set standard size for each character in the font.  If you get a _FONTWIDTH of 0, you'll need to use _PRINTWIDTH with each character/string to see how many pixels wide they are, when printing them to the screen.

2) QB64 has the capability to make any font monospaced.  To do so, simply add the "MONOSPACE" style tag to your _LOADFONT, as below:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32)
  2. FOR i = 10 TO 24
  3.     f = _LOADFONT("LCD.TTF", i, "monospace")
  4.     _FONT f
  5.     LOCATE i - 9
  6.  

Now with the above, our _FONTWIDTH is now 1/2 our _FONTHEIGHT (rounded down), but this ratio doesn't always hold true, so don't get a false perception of that in your head.  (Think of  _FONT 8 which comes with QB64 which is 8x8 pixels in size.)  All characters are going to be a set width, and the ratio will always be the same as the font scales in size, but that ratio between width and height varies from font to font.

3) Another "Generally speaking" rule:  Unless you're doing something odd as heck with them, your best practice is just to load the font you want at the start of a program, and then keep it in memory to use.  They only use a few MB of memory to keep them loaded and ready to use, and with today's computers which allow us GB of RAM for each program, it's just not worth the hassle (and wear on the drive) to have to open a font and then close it repeatedly.  Load it once and forget it.

4) If you can't practice the "load it once and forget it" rule, then don't forget to make use of _FREEFONT.  If you load a font and never free it, your program's memory usage will simply go up, up, and up, until it eventually uses all the resources on your machine and crashes.  These types of memory leaks become readily apparent when applied inside a loop, SUB, or FUNCTION.

5) Last tidbit of knowledge which I can think to share with you:  Each time you load a font, QB64 resets your print location to the top left corner of the screen.  For a quick example, run the following code:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32)
  2. DIM f(10 TO 128)
  3. FOR i = 10 TO 128
  4.     f(i) = _LOADFONT("LCD.TTF", i, "monospace")
  5.  
  6. PRINT "Hello World (in default text)"
  7.  
  8. _FONT f(16)
  9. PRINT "Hello World (in LCD-16 text)"
  10.  
  11. _FONT f(32)
  12. PRINT "Hello World (in LCD-32 text)"
  13.  

Notice how every time you break the SLEEP, the text prints in the top left corner?  Every font change will produce this affect to your print location.  If you want to preserve your print location, add my little SafeLoadFont routine into your code and use it, as below:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32)
  2. DIM f(10 TO 128)
  3. FOR i = 10 TO 128
  4.     f(i) = _LOADFONT("LCD.TTF", i, "monospace")
  5.  
  6. PRINT "Hello World (in default text)"
  7.  
  8. SafeLoadFont f(16)
  9. PRINT "Hello World (in LCD-16 text)"
  10.  
  11. SafeLoadFont f(32)
  12. PRINT "Hello World (in LCD-32 text)"
  13.  
  14.  
  15. SUB SafeLoadFont (font#)
  16.     'Safely loads a font without destroying our current print location and making it revert to the top left corner.
  17.  
  18.     down = CSRLIN: right = POS(0)
  19.     down = (down - 1) * _FONTHEIGHT
  20.     IF _FONTWIDTH <> 0 THEN 'we start with a monospace font
  21.         right = (right - 1) * _PRINTWIDTH(" ") 'convert the monospace LOC to a graphic X coordinate
  22.     END IF
  23.     _FONT font#
  24.     IF _FONTWIDTH <> 0 THEN 'we swapped to a monospace font
  25.         right = (right / _PRINTWIDTH(" ")) + 1 'convert the graphic X coordinate back to a monospace LOC column
  26.     END IF
  27.     down = (down / _FONTHEIGHT) + 1
  28.     IF right < 1 THEN right = 1
  29.     LOCATE down, right
  30.  




And that's about all the pointers/tips that I think I know to share with you, concerning the use of fonts in your programs.  if you have any questions, feel free to ask, and I'll do what I can to help answer them for you.  Honestly, there's nothing too complex about adding them into a program, and making them work. 

Usually the biggest problem comes with folks saying, "Font not found", and the best way to get around that is to make the font available for download with the program just like you would any other resource.  Just don't assume that it comes with someone's OS by default, cause every OS seems to have a different set that they package with it.   Old English font (OLDENGL.ttf) is one I like the looks of, and use a lot, and it  comes with WIN XP, but not Vista, but it's in WIN 7, but not WIN 8, but it's in WIN 10....  The web has every font imaginable to mankind on it, yet nobody will ever google "Download OLDENGL.ttf" when they need it and don't have it.  You have to provide that font for them, or else expect them to complain about it.  :P

Title: Re: LCD Time and Date Using Windows Font
Post by: david_uwi on December 04, 2020, 10:19:44 am
Good effort, but it looks more like a VFD* display.

* Vacuum fluorescent display
Title: Re: LCD Time and Date Using Windows Font
Post by: FellippeHeitor on December 04, 2020, 10:33:32 am
Dang I had no idea Steve! I said "highest" because that's the highest number it uses on Microsoft Wordpad. I just threw in a size 120 on a test and it's HUGE! Thank you!!!

Word processors show fonts measured in points. In QB64 you specify a size in pixels (height).
Title: Re: LCD Time and Date Using Windows Font
Post by: bplus on December 04, 2020, 12:15:45 pm
@SierraKen

Have you tried Alpha shadowing for the numbers?

Assuming you have all numbers printing in precise locations ie no shifting of digits because 1 o'clock uses 1 digit 11 two... you must have that to keep AM and PM from bouncing...

Anyway on a separate _Image or use screen first to build a clock of shadows by running all the numbers probably with _DONTBLEND so you have a shadow of all the numbers at same alpha level. Get a snapshot and use that 'face' as background for "lighted up" digits for the current  time. You could do it for 1 digit space and _PUTIMAGE to all the other places.

Just an idea / experiment (might not work with the font locating) and assuming by shadow we mean the line segment bars of a LED? clock.

Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 04, 2020, 01:05:27 pm
Thank you Steve for telling me those things. I will put it in a Notepad to remember by when I need it sometime.
B+, I'm not sure what you mean, but did you try the latest update with all the shadows? I do use alpha on the COLOR commands. But I also had to use COPYIMAGE and PUTIMAGE in order to put both the shadows and numbers in the same place at the same time. It works pretty spiffy actually, I've never used printed text and PUTIMAGE together like this before.
I'll work on this a little more today and see if I can line things up a little better.
Thanks also to Felippe and David. Yeah it does look more like VFD  LOL :).
Title: Re: LCD Time and Date Using Windows Font
Post by: bplus on December 04, 2020, 01:29:23 pm
Thank you Steve for telling me those things. I will put it in a Notepad to remember by when I need it sometime.
B+, I'm not sure what you mean, but did you try the latest update with all the shadows? I do use alpha on the COLOR commands. But I also had to use COPYIMAGE and PUTIMAGE in order to put both the shadows and numbers in the same place at the same time. It works pretty spiffy actually, I've never used printed text and PUTIMAGE together like this before.
I'll work on this a little more today and see if I can line things up a little better.
Thanks also to Felippe and David. Yeah it does look more like VFD  LOL :).

Yep you caught me, I didn't try out latest, sorry, I also missed the Thread Title unless you changed it because before I swear it just said Digital Clock, no Font nor LCD (what the heck is difference LED, LCD and now VFD? god I'm getting old it looks like random selections from a Word Search Puzzle).

Sounds like you have the idea I had in mind, guess I will have to checkout the execution of our idea ;)

BTW it's not a Windows Font in my system because I tried the first post without the Font file and no workie ;-)) they usually will work with just font name as if in same folder, unless Windows changed something again on me.
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 04, 2020, 02:26:22 pm
Thanks B+, but I'll give you another headache, I just did some more fixes to it, so one more update. I'll add it on this post and the first post. This most likely will be the last update. I can't really get it any better than this. But I think it's cool. :) Try out the alarm too.

These are the changes I did:
'Added: Lined up background 8's and a little better.
'Added: Deleted unneeded _LOADFONT command line and went with default font for alarm settings.
'Added: Set : as permenant locations.
'Added: Minor fixes.

Scroll down for the best version, this zip has been removed.
Title: Re: LCD Time and Date Using Windows Font
Post by: bplus on December 04, 2020, 02:51:51 pm
Yeah thanks because the 2nd zip I downloaded worked same as first, BTW recommend version number or dates for zips with modified contents, very few things remain permanent.
Title: Re: LCD Time and Date Using Windows Font
Post by: bplus on December 04, 2020, 03:11:59 pm
Dang it! I keep getting the same dang file! No shadows put plenty of bouncing AM and PM.

I do have a headache :(Bleep this!)

@SierraKen  are attaching the correct file, it doesn't even look like the snap in reply#9
Title: Re: LCD Time and Date Using Windows Font
Post by: SierraKen on December 04, 2020, 03:57:14 pm
I don't know what to say B+, I just tested both of the update zip files, the first post on this forum thread, and the last one, and I pasted the code to QB64 from the zip files and they are the current ones. I'll paste the code below, but thanks for the heads up about renaming the zip files, I'll rename the current one and also post it below too.  I also just updated the other zip files above with this one, with the same name as  below: Alarm Clock LCD - 12-4-2020 update.zip

Edit: This zip has been removed, so please scroll down to the next one. Thank you.

Code: QB64: [Select]
  1. 'Digital Time and Date by SierraKen on Dec. 3, 2020.
  2. 'This is my first clock using the Lcd.ttf font.
  3. 'Added: Alarm Clock.
  4. 'Added: Minor Esc Key font fix when ending program.
  5. 'Added: Made AM/PM to stop moving.
  6. 'Added: "8" background LCD shadows.
  7. 'Added: Lined up background 8's and a little better.
  8. 'Added: Deleted unneeded _LOADFONT command line and went with default font for alarm settings.
  9. 'Added: Set : as permenant locations.
  10. 'Added: Minor fixes.
  11. DIM background AS LONG
  12. _TITLE "Time and Date - (S)et Alarm"
  13. clock& = _NEWIMAGE(400, 200, 32)
  14. SCREEN clock&
  15. start:
  16. fontfile$ = "Lcd.ttf"
  17. style$ = "bold"
  18. f& = _LOADFONT(fontfile$, 72, style$)
  19. COLOR _RGB32(32, 64, 32), _RGB32(0, 0, 0, 10)
  20. _PRINTSTRING (10, 10), "88"
  21. _PRINTSTRING (95, 10), "88"
  22. _PRINTSTRING (180, 10), "88"
  23. _PRINTSTRING (320, 10), "88"
  24. _PRINTSTRING (10, 100), "88-88-8888"
  25. background& = _COPYIMAGE(0)
  26.     _LIMIT 50
  27.     _PUTIMAGE , background&
  28.     a$ = INKEY$
  29.     IF a$ = " " OR a$ = "s" OR a$ = "S" OR a$ = "a" OR a$ = "A" THEN GOSUB alarm:
  30.     t$ = TIME$
  31.     hour$ = LEFT$(t$, 2)
  32.     h = VAL(hour$)
  33.     IF h > 11 THEN pmam$ = " PM": ampm4 = 2
  34.     IF h < 12 THEN pmam$ = " AM": ampm4 = 1
  35.     IF h > 12 THEN h = h - 12: hour$ = STR$(h)
  36.     minute$ = MID$(t$, 4, 2)
  37.     m = VAL(minute$)
  38.     second$ = RIGHT$(t$, 2)
  39.     s = VAL(second$)
  40.     COLOR _RGB32(127, 255, 127), _RGB32(0, 0, 0, 10)
  41.     IF h > 9 THEN
  42.         sp5$ = " "
  43.     ELSE
  44.         sp5$ = ""
  45.     END IF
  46.     IF m > 9 AND m < 20 THEN
  47.         sp$ = " "
  48.     ELSE
  49.         sp$ = ""
  50.     END IF
  51.     IF s > 9 AND s < 20 THEN
  52.         sp2$ = " "
  53.     ELSE
  54.         sp2$ = ""
  55.     END IF
  56.     _PRINTSTRING (10, 10), sp5$ + hour$
  57.     _PRINTSTRING (80, 10), ":"
  58.     _PRINTSTRING (95, 10), sp$ + minute$
  59.     _PRINTSTRING (165, 10), ":"
  60.     _PRINTSTRING (180, 10), sp2$ + second$
  61.     _PRINTSTRING (300, 10), pmam$
  62.     d$ = DATE$
  63.     d = VAL(LEFT$(DATE$, 2))
  64.     IF d > 9 AND d < 20 THEN
  65.         sp3$ = " "
  66.     ELSE
  67.         sp3$ = ""
  68.     END IF
  69.     _PRINTSTRING (10, 100), sp3$ + d$
  70.     IF alarm = 1 THEN
  71.         month2$ = LEFT$(DATE$, 2)
  72.         month2 = VAL(month2$)
  73.         day2$ = MID$(DATE$, 4, 2)
  74.         day2 = VAL(day2$)
  75.         year2$ = RIGHT$(DATE$, 4)
  76.         year2 = VAL(year2$)
  77.         IF year = year2 AND month = month2 AND day = day2 AND h = hour2 AND m = minute2 AND s = second2 AND ampm3 = ampm4 THEN
  78.             DO
  79.                 FOR snd = 500 TO 600 STEP 20
  80.                     SOUND snd, .5
  81.                 NEXT snd
  82.                 _DELAY .25
  83.                 _TITLE "** Alarm ** Press Any Key To Stop"
  84.             LOOP UNTIL INKEY$ <> ""
  85.             alarm = 0
  86.             _TITLE "Time and Date - (S)et Alarm"
  87.             GOTO noalarm:
  88.         END IF
  89.     END IF
  90.     noalarm:
  91.     _DISPLAY
  92.     CLS
  93. LOOP UNTIL a$ = CHR$(27)
  94. alarm:
  95. _TITLE "Set Alarm Here"
  96. year:
  97. _FREEIMAGE background&
  98. INPUT "Year (example: 2020): ", year
  99. IF year < 2020 OR year <> INT(year) THEN GOTO year:
  100. month:
  101. INPUT "Month (1-12):", month
  102. IF month < 1 OR month > 12 OR month <> INT(month) THEN GOTO month:
  103. day:
  104. INPUT "Day (1-31): ", day
  105. IF day < 1 OR day > 31 OR day <> INT(day) THEN GOTO day:
  106. hour:
  107. INPUT "Hour (1-12): ", hour2
  108. IF hour2 < 1 OR hour2 > 12 OR hour2 <> INT(hour2) THEN GOTO hour:
  109. timeofday:
  110. INPUT "AM or PM: ", ampm2$
  111. IF LEFT$(ampm2$, 1) = "a" OR LEFT$(ampm2$, 1) = "A" THEN ampm3 = 1: GOTO minute:
  112. IF LEFT$(ampm2$, 1) = "p" OR LEFT$(ampm2$, 1) = "P" THEN ampm3 = 2: GOTO minute:
  113. GOTO timeofday:
  114. minute:
  115. INPUT "Minute (0-59): ", minute2
  116. IF minute2 < 0 OR minute2 > 59 OR minute2 <> INT(minute2) THEN GOTO minute:
  117. second:
  118. INPUT "Second (0-59): ", second2
  119. IF second2 < 0 OR second2 > 59 OR second2 <> INT(second2) THEN GOTO second:
  120. alarm = 1
  121. _TITLE "Time and Date - Alarm Set"
  122. GOTO start:
  123.  
Title: Re: LCD Time and Date Using Windows Font
Post by: bplus on December 04, 2020, 05:12:14 pm
OK that did the trick versioning the mods really helps ID the zip. It could be my screw up I've been quite blunderful lately and I noticed two zips of same name in downloads I thought I deleted them before downloading next.

Anyway, the shadows do show up and almost work except its 5 something PM here and the 5 is placed between the shadows for the 2 eights. So if I were you, I wouldn't quit now...

The alignment is a little off when the double digits are fitting over the Eight Shadows. I will dig into code to see if I can help with alignment. For single digits times add 0's before the digit like this:

Hours = Right$("00" + _trim$(str$(hoursNumber)), 2)  'I hope that's right

It should put a zero before the 5 at 5 something PM.

Steve probably wrote up how to get things aligned above.
Title: Re: Vacuum Fluorescent Display (VCD) Alarm Clock Using LCD Font
Post by: SierraKen on December 04, 2020, 06:27:01 pm
B+, I made up the word "shadows" without explaining it in detail, and I apologize for that. I don't want the "shadows" to be the same as the numbers. What I did was make it look just like the old VFD (Vacuum Fluorescent Display) digits in old radios and digital clocks. It's where in daylight or light, you can see 8's underneath every digit. It's because it's how the numbers are brightened up. All they have are 8's to begin with, but not brightened until the certain lines of the 8's are brightened to form a different number. Here is a real life example of what I'm attempting with this program, in the picture below. I'm sorry for saying LCD in the posts above, someone corrected me saying they are VFD's instead.

Edit: I just uploaded the zip files again with the right VFD name. I'm not doing good today. lol I also renamed the forum thread.

Edit Again: You can tell my age now, this is the kind of stuff I grew up with.
 

Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 04, 2020, 06:53:42 pm
Ha! you can tell my age, I knew what you meant by shadow and kinda prefer that term or pre-image of every digit potential ;-) (as opposed to after image.) I looked up all those terms and said yeah, he's simulating VFD with a LCD font.

Did you try adding the 0 before single digits? That and using "Monospace" when load font might fix it all. Testing that next just in case you really do want to quit.

Maybe time to introduce Plasma Laser Appended Y Shadowing, PLAYS for short ;-))
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 04, 2020, 07:24:42 pm
Thanks for pointing that out. I thought it was lined up better than it was. So I just fixed the hour and I added a zero on the month, because most likely it will need it when January comes around. If not, I'll repair it someday probably. I can't test it without changing my computer time and last time I did that I messed up Windows big time, so please don't test it like that. Hopefully it works. :)
Here is the updated zip, I added a 2 on the name at the end. I also deleted the other zips except for the first post on this thread, which I updated.

Edit: This zip has been removed, please keep scrolling for the best one. Thank you.

Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 04, 2020, 07:33:12 pm
Oh and I left the zero out of the hour display just so it looks better, in my point of view anyway. :) Instead I added a space.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SMcNeill on December 04, 2020, 07:33:25 pm
Thanks for pointing that out. I thought it was lined up better than it was. So I just fixed the hour and I added a zero on the month, because most likely it will need it when January comes around. If not, I'll repair it someday probably. I can't test it without changing my computer time and last time I did that I messed up Windows big time, so please don't test it like that. Hopefully it works. :)
Here is the updated zip, I added a 2 on the name at the end. I also deleted the other zips except for the first post on this thread, which I updated.

Why would you need to mess with Windows time for testing?  You’re just testing a string value; make it anything you want.

Instead of d$ = DATE$, make d$ = “01/01/2021”, or whatever you want.  ;)
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 04, 2020, 07:46:28 pm
Thanks Steve. Does DATE$ add a zero automatically to a month before 10, like 09? This is becoming harder than I thought. but I'll figure it out soon. I'll be busy tonight though. I will have to break up date$ to months, days, and years like I did with the time, and place each one in the right spot.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 04, 2020, 07:52:45 pm
The alignment problem is due to the font.

Code: QB64: [Select]
  1. DEFLNG A-Z
  2. _TITLE "Test Font load and width."
  3. SCREEN _NEWIMAGE(400, 200, 32)
  4.  
  5. f = _LOADFONT("Lcd.ttf", 60, "monospace")
  6.  
  7. 'PRINT _FONTWIDTH ' 15 for 30  and 165 for each of two 11 char strings, good!
  8.  
  9. COLOR &HFF252530, &H00000000
  10. _PRINTSTRING (10, 10), "88:88:88 PM"
  11. _PRINTSTRING (10, 10), "17:17:17 AM"
  12.  
  13.  

Ken coulda just used DATE$ and TIME$

Code: QB64: [Select]
  1. DEFLNG A-Z
  2. _TITLE "Test Font load and width."
  3. SCREEN _NEWIMAGE(400, 200, 32)
  4.  
  5. f = _LOADFONT("Lcd.ttf", 60, "monospace")
  6.  
  7. COLOR &HFF001530, &HFF000000
  8. _PRINTSTRING (10, 10), "88:88:88"
  9. _PRINTSTRING (10, 100), "88-88-8888"
  10. f = _NEWIMAGE(400, 200, 32)
  11. _PUTIMAGE , 0, f
  12. COLOR &HFFFF3300, &H00000000
  13.     _PUTIMAGE , f, 0
  14.     _PRINTSTRING (10, 10), TIME$
  15.     _PRINTSTRING (10, 100), DATE$
  16.     _DISPLAY
  17.     _LIMIT 10
  18.  
  19.  
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SMcNeill on December 04, 2020, 07:57:29 pm
Thanks Steve. Does DATE$ add a zero automatically to a month before 10, like 09? This is becoming harder than I thought. but I'll figure it out soon. I'll be busy tonight though. I will have to break up date$ to months, days, and years like I did with the time, and place each one in the right spot.

https://www.qb64.org/wiki/DATE$

Returns the current computer date in the format "mm-dd-yyyy" (e.g., "12-25-2009").

Leading 0’s are included, so you see dates like 06-02-2020.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 04, 2020, 08:08:37 pm
Now it is like a shadow!
Code: QB64: [Select]
  1. DEFLNG A-Z
  2. _TITLE "Test Font load and width."
  3. SCREEN _NEWIMAGE(400, 200, 32)
  4.  
  5. f = _LOADFONT("Lcd.ttf", 60, "monospace")
  6.  
  7. COLOR &HFF001530, &HFF000000
  8. _PRINTSTRING (10, 10), "88:88:88"
  9. _PRINTSTRING (10, 100), "88-88-8888"
  10. f = _NEWIMAGE(400, 200, 32)
  11. _PUTIMAGE , 0, f
  12. COLOR &HFFFF3300, &H00000000
  13.     _PUTIMAGE , f, 0
  14.     _PRINTSTRING (6, 6), TIME$
  15.     _PRINTSTRING (6, 96), DATE$
  16.     _DISPLAY
  17.     _LIMIT 10
  18.  
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 04, 2020, 08:24:25 pm
Awesome, thanks again Steve, that will help me tons.
LOLOL B+, somehow I had a feeling you would jump in, well especially being Friday. :D
I'll work on this more this weekend and see what I can come up with.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 04, 2020, 08:29:30 pm
@SierraKen

I don't know if you saw my last post on page 2 but the alignment problem is with the font and how it was made, no fixing that but Richard Frost has a great segment code for digits I could dig it up, oh yeah I saw his and made my own.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SMcNeill on December 04, 2020, 08:32:57 pm
@SierraKen

I don't know if you saw my last post on page 2 but the alignment problem is with the font and how it was made, no fixing that but Richard Frost has a great segment code for digits I could dig it up, oh yeah I saw his and made my own.

Easy solution: swap to a monospaced font: https://www.1001fonts.com/monospaced+lcd-fonts.html

Digital-7 +3 looks promising.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 04, 2020, 08:38:26 pm
Yeah -7 +3 should do it, or grow your own:
Code: QB64: [Select]
  1. _TITLE "Plasmatic Digital Clock 3" ' b+ 2020-01-21 modified:
  2. ' Digital Plasmatic Clock b+ 2020-01-20 translated and modified from SmallBASIC
  3. ' Plasma Magnifico - updated 2015-11-26 for Android
  4. ' This program creates a plasma surface, which looks oily or silky.
  5.  
  6. '=====================================================================================================
  7. '
  8. '       Use spacebar to change color set, + to increase clock size and - to decrease clock size
  9. '
  10. '=====================================================================================================
  11.  
  12. CONST dat = "1110111000001101111100011111100101110111011111101001001111111111011011"
  13. TYPE xy
  14.     x AS SINGLE
  15.     y AS SINGLE
  16.     dx AS SINGLE
  17.     dy AS SINGLE
  18. DIM SHARED sq, xmax, ymax
  19. sq = 15: xmax = 34 * sq: ymax = 8 * sq
  20. SCREEN _NEWIMAGE(xmax, ymax, 32)
  21. DIM c(360) AS _UNSIGNED LONG, p(6) AS xy, f(6), clr AS _UNSIGNED LONG
  22. restart:
  23. r = RND: g = RND: b = RND: i = 0
  24. FOR n = 1 TO 5
  25.     r1 = r: g1 = g: b1 = b
  26.     DO: r = RND: LOOP UNTIL ABS(r - r1) > .2
  27.     DO: g = RND: LOOP UNTIL ABS(g - g1) > .2
  28.     DO: b = RND: LOOP UNTIL ABS(g - g1) > .2
  29.     FOR m = 0 TO 17: m1 = 17 - m
  30.         f1 = (m * r) / 18: f2 = (m * g) / 18: f3 = (m * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  31.     NEXT
  32.     FOR m = 0 TO 17: m1 = 17 - m
  33.         f1 = (m + m1 * r) / 18: f2 = (m + m1 * g) / 18: f3 = (m + m1 * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  34.     NEXT
  35.     FOR m = 0 TO 17: m1 = 17 - m
  36.         f1 = (m1 + m * r) / 18: f2 = (m1 + m * g) / 18: f3 = (m1 + m * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  37.     NEXT
  38.     FOR m = 0 TO 17: m1 = 17 - m
  39.         f1 = (m1 * r) / 18: f2 = (m1 * g) / 18: f3 = (m1 * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
  40.     NEXT
  41.  
  42. FOR n = 0 TO 5
  43.     p(n).x = RND * xmax: p(n).y = RND * ymax: p(n).dx = RND * 2 - 1: p(n).dy = RND * 2 - 1
  44.     f(n) = RND * .1
  45.  
  46. WHILE _KEYDOWN(27) = 0
  47.     k$ = INKEY$
  48.     IF k$ = " " THEN GOTO restart
  49.     IF k$ = "+" AND sq < 40 THEN sq = sq + 1: xmax = 34 * sq: ymax = 8 * sq: SCREEN _NEWIMAGE(xmax, ymax, 32): GOTO restart
  50.     IF k$ = "-" AND sq > 3 THEN sq = sq - 1: xmax = 34 * sq: ymax = 8 * sq: SCREEN _NEWIMAGE(xmax, ymax, 32): GOTO restart
  51.     FOR i = 0 TO 5
  52.         p(i).x = p(i).x + p(i).dx
  53.         IF p(i).x > xmax OR p(i).x < 0 THEN p(i).dx = -p(i).dx
  54.         p(i).y = p(i).y + p(i).dy
  55.         IF p(i).y > ymax OR p(i).y < 0 THEN p(i).dy = -p(i).dy
  56.     NEXT
  57.     FOR y = 0 TO ymax - 1 STEP 2
  58.         FOR x = 0 TO xmax - 1 STEP 2
  59.             d = 0
  60.             FOR n = 0 TO 5
  61.                 dx = x - p(n).x: dy = y - p(n).y
  62.                 k = SQR(dx * dx + dy * dy)
  63.                 d = d + (SIN(k * f(n)) + 1) / 2
  64.             NEXT n: d = d * 60
  65.             LINE (x, y)-STEP(2, 2), c(d), BF
  66.         NEXT
  67.     NEXT
  68.     FOR n = 1 TO 8 'clock digits over background
  69.         IF MID$(TIME$, n, 1) = ":" THEN
  70.             FOR i = .5 * sq TO 0 STEP -.25
  71.                 clr = _RGBA32(255 - i * (255 / sq), (.5 * sq - i) * 255 / sq, 0, 380 / sq)
  72.                 LINE ((n - 1) * 4 * sq + 2 * sq + .5 * sq - i, sq + sq + .5 * sq - i)-STEP(2 * i, 2 * i), clr, BF
  73.                 LINE ((n - 1) * 4 * sq + 2 * sq + .5 * sq - i, 5 * sq + .5 * sq - i)-STEP(2 * i, 2 * i), clr, BF
  74.             NEXT
  75.         ELSE
  76.             drawC (n - 1) * 4 * sq + sq + offset, sq + offset, MID$(dat$, VAL(MID$(TIME$, n, 1)) * 7 + 1, 7)
  77.         END IF
  78.     NEXT
  79.     _LIMIT 60
  80.     _DISPLAY
  81.  
  82. FUNCTION rgbf~& (n1, n2, n3)
  83.     rgbf~& = _RGB32(n1 * 80, n2 * 80, n3 * 80)
  84.  
  85. SUB drawC (x, y, c$)
  86.     FOR m = 1 TO 7
  87.         IF VAL(MID$(c$, m, 1)) THEN
  88.             FOR i = .5 * sq TO 0 STEP -.25
  89.                 c = _RGBA32(255 - i * (255 / sq), (.5 * sq - i) * 255 / sq, 0, 380 / sq)
  90.                 SELECT CASE m
  91.                     CASE 1: LINE (x + .5 * sq - i, y + .5 * sq + i)-(x + .5 * sq + i, y + 2.5 * sq - i), c, BF
  92.                     CASE 2: LINE (x + .5 * sq - i, y + 2.5 * sq + i)-(x + .5 * sq + i, y + 5.5 * sq - i), c, BF
  93.                     CASE 3: LINE (x + .5 * sq + i, y + .5 * sq + i)-(x + 2.5 * sq - 2 - i, y + .5 * sq - i), c, BF
  94.                     CASE 4: LINE (x + .5 * sq + i, y + 2.5 * sq + i)-(x + 2.5 * sq - 2 - i, y + 2.5 * sq - i), c, BF
  95.                     CASE 5: LINE (x + .5 * sq + i, y + 5.5 * sq + i)-(x + 2.5 * sq - 2 - i, y + 5.5 * sq - i), c, BF
  96.                     CASE 6: LINE (x + 2.5 * sq - i, y + .5 * sq + i)-(x + 2.5 * sq + i, y + 2.5 * sq - i), c, BF
  97.                     CASE 7: LINE (x + 2.5 * sq - i, y + 2.5 * sq + i)-(x + 2.5 * sq + i, y + 5.5 * sq - i), c, BF
  98.                 END SELECT
  99.             NEXT
  100.         END IF
  101.     NEXT
  102.  
  103.  
  104.  
  105.  

EDIT: update just darkened the background

I know you probably don't want to do this but it's cool!
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 04, 2020, 11:31:01 pm
I tried that font that Steve found but it would only show the top half of the fonts for some reason. I even tried it on a test program which only loaded the font and some words. So I looked online and found another website of LCD-type fonts and after trying a few of them, I found the perfect one. :)) I am 100% finished now I believe. I'll update the zip file on the first post and post it on this one. It has a 3 at the end of the zip filename. It includes the new font. I also lined up the date better so it's more in the middle. Please check it out, I'm really happy about this one. :) I'll put a picture of it below too. Thanks for your help everyone, tell me what you think of this one. I added thank-you's to the code on top.

Edit: Zip file removed, please keep scrolling down to the next one.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 04, 2020, 11:48:32 pm
What I did was just use the MONOSPACE font and that meant I could delete all the unnecessary spaces, etc. In fact, I didn't have to take apart the DATE$ after all (well besides the alarm of course)! And the only reason I had to take apart the TIME$ was to convert it to a 12 hour clock and alarm. :)) I also made the alarm sound a little bit better. Lots to learn in this project. I hope many people can do the same. :)
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 05, 2020, 12:06:28 am
Hi @SierraKen

Looks like you found a font that works for your purposes, I just tried code and you need to _TRIM$(STR$(h))
Code: QB64: [Select]
  1. IF h > 12 THEN h = h - 12: hour$ = STR$(h)    

because I am trying code at 11+PM and the time on top line is one space over to right.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 12:16:25 am
B+, you might be seeing that the "1" is in the middle of the 8 instead of on either side, and that is how it's supposed to be. Here is a picture of what I see when I set the hour$ = "11". Tell me if I'm wrong and I will try to fix it. Sorry for not mentioning the difference in where the "1"'s are located. The fonts just put them directly in the center. And to me that is fine. In fact I remember clocks from back then that were like this.

Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 01:13:51 am
Oh gee, now I see what you meant B+, sorry again. :(
I'll try to do what you said and use that command to try and fix it. Thank you.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 01:24:58 am
Here is the Hour fix using _TRIM$. It seems to work now fine. It's still under "beta" and will be tested more soon.
But here is (hopefully) the last version. Thanks again B+.

Edit: Deleted zip again, I put the code on the wrong line. LOLOL Today is like "impossible day" for programming for me, but I worked through it all. I'll post the newest update on the next post.


Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 01:37:35 am
Here, hopefully, is the very last update. It's still under beta, so I will keep testing it tomorrow, etc. But it should work fine now, hopefully.

Edit: Zip file deleted, please go to the next forum page for the fixed version. I apologize for all these versions.

Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 05, 2020, 09:33:22 am
Confirmed the Digit 7 font was only printing the top half of numbers, the site at Steve's link also had a font called Crashed Score and was exactly the shadow and digit effect you want but:
1. The shadow was same brightness level and color as the printed digit which makes me think why bother?
2. You'd have to skip colons because they were awful! but  you could paint the clock face with colons or 2 dots (filled circle)  but that does NOT fix problem 1.

Meanwhile I started on a digit font that you can control height and color mod from the plasma clock demo, maybe you could use that instead of font or I could use for something later or someone maybe Richard Frost might like. I figured finally where the numbers 7 and 3 applied, 7 segments 3 or which are horizontal. Drawing font instead of printing allows changing colors in the image allowing the effect of being lit up or neon effect among other things
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 12:52:11 pm
LOL I almost freaked out again. I ran it first thing this morning and it did the same thing as last night before it was fixed. So I opened it with QB64 and tried it and it worked fine LOL. My Windows Shortcut was looking at an older .exe because last night QB64 made a <name> (2).exe on accident LOL. So everything works right on lining up with both AM and PM numbers, etc. I believe. Thanks again for your help B+. As for your new fonts you are making, I might try them out, they sound interesting. Oh also, I don't think it matters what kind of font you use (as long as they work) to change the color brightness on them since I did that on a few different fonts using the COLOR command. To make a darker shade of green, I just had to divide each of the RGB colors by 4 (or so) and it just made a darker green. Of course I could have also just used the color slider (why am I always doing things the hard way? LOL) But yeah, if you could draw the font straight to the program, you could use neon. I actually thought of that a few days ago but remembered that it wouldn't work with a regular font file.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 04:36:43 pm
Of course I found another problem LOL. Now when it is earlier than 10am or 10pm, the 1 digit moves over to the left and everything else moves over to the left too. So I did a very quick one-line fix on it, hopefully this does the trick. I just said this:
Code: QB64: [Select]
  1.  IF h < 10 THEN hour$ = "0" + hour$
  2.  

It seems to work fine so far.

Zip file has been deleted. Keep scrolling down.

Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 05, 2020, 05:25:51 pm
Here is what I managed to work up for drawing 7 Segment characters, mostly digits:
Code: QB64: [Select]
  1. _TITLE "7 Segments Digital Date and Time Clock" ' b+ 2020-12-05
  2. DIM SHARED xmax, ymax
  3. xmax = 1074: ymax = 105
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. DIM ampm$, testHeight, offset, testColr AS _UNSIGNED LONG, shadow AS _UNSIGNED LONG, face AS LONG, t$, d$
  6. testHeight = 100
  7. offset = 15
  8. shadow = &H17FFFFFF
  9. testColr = &HFFEEEEFF
  10. face = _NEWIMAGE(xmax, ymax, 32)
  11. print7 "8888-88-88 A 88:88:88", offset, offset, testHeight, shadow
  12. _PUTIMAGE , 0, face
  13. WHILE _KEYDOWN(27) = 0
  14.     _PUTIMAGE , face, 0
  15.     t$ = TIME$
  16.     d$ = RIGHT$(DATE$, 4) + "-" + LEFT$(DATE$, 2) + MID$(DATE$, 3, 3)
  17.     IF VAL(MID$(t$, 1, 2)) > 12 THEN
  18.         ampm$ = " P ": MID$(t$, 1, 2) = RIGHT$("00" + _TRIM$(STR$(VAL(MID$(t$, 1, 2)) - 12)), 2)
  19.     ELSE
  20.         ampm$ = " A "
  21.     END IF
  22.     print7 d$ + ampm$ + t$, offset, offset, testHeight, testColr
  23.     _LIMIT 10
  24.     _DISPLAY
  25.  
  26. SUB print7 (text$, x, y, height, c AS _UNSIGNED LONG)
  27.     ' char cells will be like 8 x 16 scaled st 16 pixel height would fit into default char cell
  28.  
  29.     DIM f AS SINGLE, i AS LONG
  30.     f = height / 16 ' proportion of height to standard height
  31.  
  32.     FOR i = 1 TO LEN(text$)
  33.         draw7Segmented MID$(text$, i, 1), x + (i - 1) * f * 8, y, height, c
  34.     NEXT
  35.  
  36. SUB draw7Segmented (char$, x AS LONG, y AS LONG, height AS SINGLE, colr AS _UNSIGNED LONG) ' digit = 0, 1, 2... 9
  37.     DIM f AS SINGLE, sr AS SINGLE, c AS _UNSIGNED LONG, digit AS LONG, c$, m AS LONG, i AS SINGLE
  38.     f = height / 16
  39.     sr = 11 / 5.5 * f
  40.     IF INSTR("0123456789", char$) THEN
  41.         digit = VAL(char$)
  42.         c$ = MID$("1110111000001101111100011111100101110111011111101001001111111111011011", digit * 7 + 1, 7)
  43.     ELSEIF INSTR(":-PA", char$) THEN
  44.         c$ = MID$("0010100000100011110101111011", INSTR(":-PA", char$) * 7 - 6, 7)
  45.     ELSE
  46.         c$ = "0000000" 'draw a space
  47.     END IF
  48.     FOR m = 1 TO 7
  49.         IF VAL(MID$(c$, m, 1)) THEN
  50.             FOR i = .5 * sr TO 0 STEP -.25
  51.                 c = Ink~&(colr, &H00000088, (i / (.5 * sr)) ^ .65)
  52.                 SELECT CASE m
  53.                     CASE 1: LINE (x + .5 * sr - i, y + .5 * sr + i)-(x + .5 * sr + i, y + 2.5 * sr - i), c, BF 'LT
  54.                     CASE 2: LINE (x + .5 * sr - i, y + 2.5 * sr + i)-(x + .5 * sr + i, y + 5.0 * sr - i), c, BF 'LB
  55.                     CASE 3: LINE (x + .5 * sr + i, y + .5 * sr + i)-(x + 2.5 * sr - 2 - i, y + .5 * sr - i), c, BF 'MT
  56.                     CASE 4: LINE (x + .5 * sr + i, y + 2.5 * sr + i)-(x + 2.5 * sr - 2 - i, y + 2.5 * sr - i), c, BF 'MM
  57.                     CASE 5: LINE (x + .5 * sr + i, y + 5.0 * sr + i)-(x + 2.5 * sr - 2 - i, y + 5.0 * sr - i), c, BF 'MB
  58.                     CASE 6: LINE (x + 2.5 * sr - i, y + .5 * sr + i)-(x + 2.5 * sr + i, y + 2.5 * sr - i), c, BF 'RT
  59.                     CASE 7: LINE (x + 2.5 * sr - i, y + 2.5 * sr + i)-(x + 2.5 * sr + i, y + 5.0 * sr - i), c, BF 'RB
  60.                 END SELECT
  61.             NEXT
  62.         END IF
  63.     NEXT
  64.  
  65. SUB cAnalysis (c AS _UNSIGNED LONG, outRed, outGrn, outBlu, outAlp)
  66.     outRed = _RED32(c): outGrn = _GREEN32(c): outBlu = _BLUE32(c): outAlp = _ALPHA32(c)
  67.  
  68. FUNCTION Ink~& (c1 AS _UNSIGNED LONG, c2 AS _UNSIGNED LONG, fr##)
  69.     DIM R1, G1, B1, A1, R2, G2, B2, A2
  70.     cAnalysis c1, R1, G1, B1, A1
  71.     cAnalysis c2, R2, G2, B2, A2
  72.     Ink~& = _RGB32(R1 + (R2 - R1) * fr##, G1 + (G2 - G1) * fr##, B1 + (B2 - B1) * fr##, A1 + (A2 - A1) * fr##)
  73.  

Tried for Neon Coloring:
  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 06:14:15 pm
Here is another fix. I just realized that TIME$ starts with hour 0, not hour 12. So I believe I fixed that.

There is another attachment below.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 06:16:02 pm
Yours is incredible B+. I like the neon glow look you added to it.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: Dav on December 05, 2020, 06:32:08 pm
Woah...nice one, bplus.  That neon glowing effect looks just like a liquid crystal display clock. 

- Dav
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 05, 2020, 06:44:07 pm
Thanks guys, if you copy the 4 procedures you can port to your app and just:

Code: QB64: [Select]
  1. print7 text$, x, y, height (pixels), color (for center line)

unless you are using Screen 0 ;-))
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 05, 2020, 07:05:18 pm
I just attempted a way around making new fonts and used a double loop with POINT to match every pixel for the neon SUB we used. It just freezes up the computer. LOL For me anyway. hehe The funny thing is that it tried to do it, showing the time and date in neon, but then everything just stopped and the computer froze. lol

But thanks for making that B+. I saved it and will experiment with it I think soon.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: Dav on December 06, 2020, 12:28:45 pm
Thanks guys, if you copy the 4 procedures you can port to your app and just:

Code: QB64: [Select]
  1. print7 text$, x, y, height (pixels), color (for center line)

unless you are using Screen 0 ;-))

Cool. I think I would like to borrow this for a metronome I'm working on, if that would be okay...

- Dav
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 06, 2020, 01:12:46 pm
Cool. I think I would like to borrow this for a metronome I'm working on, if that would be okay...

- Dav

You don't have to ask but I like it :) definitely OK! BTW the segment font idea was borrowed and modified from Richard Frost, or possibly [banned user] or Petr, I suspect Richard Frost when we were doing clocks he picked up on plasma I the segmented digits.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SMcNeill on December 06, 2020, 01:37:04 pm
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32)
  2. f = _LOADFONT("LCD.ttf", 72, "monospace")
  3.     CLS
  4.     COLOR &H77AAAA00, 0
  5.     PRINT " 88:88:88"
  6.     PRINT "88-88-8888"
  7.     COLOR -1, 0
  8.     LOCATE 1, 1
  9.     PRINT " "; TIME$
  10.     PRINT DATE$
  11.     _DISPLAY
  12.     _LIMIT 1

Use font below.  All lines up and displays easily, as illustrated above.

I finally got home from watching mom, so this is the first chance I had to grab and test a decent LCD font.  ;)
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: bplus on December 06, 2020, 02:50:59 pm
Ah! I see they made same decision for colon as I.

I started to consider this for other text but 7 segments aren't enough. They do do digits really well though.
Title: Re: Vacuum Fluorescent Display (VFD) Alarm Clock Using LCD Font
Post by: SierraKen on December 06, 2020, 02:53:53 pm
I should have used Lcd.ttf as monospace, but never tried it on that particular one. lol