Author Topic: Hi Mark, need a little help with this...  (Read 3449 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Hi Mark, need a little help with this...
« on: March 30, 2019, 03:27:30 pm »
I tried your awesome text in space scrolling program, but when I made necessary corrections, it leaves out the last period of the final paragraph. My guess is it is over some limit, but I can't seem to figure out how to adjust for it.

Code: QB64: [Select]
  1. ' Star Trek
  2. SCREEN _NEWIMAGE(800, 700, 32)
  3. _SCREENMOVE 300, 20
  4. swt& = _NEWIMAGE(360, 512, 32)
  5. _DEST swt&
  6. COLOR _RGB32(0, 180, 0)
  7. nl$ = CHR$(10)
  8. sw$ = "Space, the final frontier. These are the" + nl$
  9. sw$ = sw$ + "Voyages of the Starship, Enterprise" + nl$
  10. sw$ = sw$ + "Its five year mission, to seek out new" + nl$
  11. sw$ = sw$ + "life; to explore new worlds; To boldly" + nl$
  12. sw$ = sw$ + "go where no man has gone before..." + nl$
  13. sw$ = sw$ + nl$ + nl$
  14. sw$ = sw$ + "Well that sure beats the other sci-fi," + nl$
  15. sw$ = sw$ + "franchise, which pales by comparison to" + nl$
  16. sw$ = sw$ + "the awesomeness of the Star Trek legacy." + nl$
  17. sw$ = sw$ + "Stay tuned for other Star Trek moments." + nl$
  18. sw$ = sw$ + nl$ + nl$
  19. sw$ = sw$ + "This has been a public service message" + nl$
  20. sw$ = sw$ + "for the United Federation of Planets." + nl$
  21. sw$ = sw$ + "Any rebroadcast of this message, without" + nl$
  22. sw$ = sw$ + "the explicit permission of the UFP, is" + nl$
  23. sw$ = sw$ + "strictly prohibited. Live long & prosper." + nl$
  24. LOCATE 25, 1
  25. PRINT sw$
  26.  
  27. yy = _HEIGHT / 3
  28. FOR i = 11 TO 60 STEP .5
  29.     CLS
  30.     yy = yy - 60 / i
  31.     cText _WIDTH / 2, yy + yy, yy, _RGB32(230, 220, 50), "Star Trek"
  32.     cText _WIDTH / 2, yy + yy, yy * .96, _RGB32(0, 0, 0), "Star Trek"
  33.     _DISPLAY
  34.     _LIMIT 15
  35.  
  36. cx = _WIDTH / 2
  37. power = 1024 'TO 1 STEP -1
  38. x = (_HEIGHT - 20) ^ (1 / power)
  39. dy = 1 '256 pixel height / 50 blocks across
  40. FOR y = -840 TO -270
  41.     CLS
  42.     FOR i = 0 TO power - 1
  43.         '_PUTIMAGE [STEP] [(dx1, dy1)-[STEP][(dx2, dy2)]][, sourceHandle&][, destHandle&][, ][STEP][(sx1, sy1)[-STEP][(sx2, sy2)]]
  44.         _PUTIMAGE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), swt&, 0, (0, y + dy * i)-(319, y + dy * (i + 1))
  45.  
  46.         'LINE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), , B
  47.     NEXT
  48.     _DISPLAY
  49.     _LIMIT 15
  50. yy = 80
  51. FOR i = 60 TO 0 STEP -.5
  52.     CLS
  53.     yy = yy + 60 / i
  54.     cText _WIDTH / 2, yy + yy, yy, _RGB32(230, 220, 50), "Star Trek"
  55.     cText _WIDTH / 2, yy + yy, yy * .96, _RGB32(0, 0, 0), "Star Trek"
  56.     _DISPLAY
  57.     _LIMIT 75
  58.  
  59. SUB cText (x, y, textHeight, K AS _UNSIGNED LONG, txt$)
  60. 'screen snapshot
  61. cur& = _DEST
  62. I& = _NEWIMAGE(8 * LEN(txt$), 16, 32)
  63. COLOR K, _RGBA32(0, 0, 0, 0)
  64. _PRINTSTRING (0, 0), txt$
  65. mult = textHeight / 16
  66. xlen = LEN(txt$) * 8 * mult
  67. _PUTIMAGE (x - .5 * xlen, y - .5 * textHeight)-STEP(xlen, textHeight), I&, cur&
  68.  
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Hi Mark, need a little help with this...
« Reply #1 on: March 30, 2019, 04:15:21 pm »
EDIT: Nope that wasn't the problem. The problem was some freaky thing with certain key combinations. Reminds me of Walter's forum!?

EDIT 2: Forgot to check tail end and start first line at bottom of screen, fixed:

Anyway here is my fix:
Code: QB64: [Select]
  1. ' Star Trek
  2. SCREEN _NEWIMAGE(800, 700, 32)
  3. _SCREENMOVE 300, 20
  4. swt& = _NEWIMAGE(344, 544, 32)
  5. _DEST swt&
  6. COLOR _RGB32(0, 180, 0)
  7. nl$ = CHR$(10)
  8. sw$ = "Space, the final frontier. These are the" + nl$
  9. sw$ = sw$ + "Voyages of the Starship, Enterprise" + nl$
  10. sw$ = sw$ + "Its five year mission, to seek out new" + nl$
  11. sw$ = sw$ + "life; to explore new worlds; To boldly" + nl$
  12. sw$ = sw$ + "go where no man has gone before..." + nl$
  13. sw$ = sw$ + nl$ + nl$
  14. sw$ = sw$ + "Well that sure beats the other sci-fi," + nl$
  15. sw$ = sw$ + "franchise, which pales by comparison to" + nl$
  16. sw$ = sw$ + "the awesomeness of the Star Trek legacy." + nl$
  17. sw$ = sw$ + "Stay tuned for other Star Trek moments." + nl$
  18. sw$ = sw$ + nl$ + nl$
  19. sw$ = sw$ + "This has been a public service message" + nl$
  20. sw$ = sw$ + "for the United Federation of Planets." + nl$
  21. sw$ = sw$ + "Any rebroadcast of this message, without" + nl$
  22. sw$ = sw$ + "the explicit permission of the UFP, is" + nl$
  23. sw$ = sw$ + "strictly prohibited." + nl$ + nl$
  24. sw$ = sw$ + "          Live long and code." + nl$ + nl$
  25.  
  26. LOCATE 24, 1
  27. PRINT sw$
  28.  
  29. yy = _HEIGHT / 3
  30. FOR i = 11 TO 60 STEP .5
  31.     CLS
  32.     yy = yy - 60 / i
  33.     cText _WIDTH / 2, yy + yy, yy, _RGB32(230, 220, 50), "Star Trek"
  34.     cText _WIDTH / 2, yy + yy, yy * .96, _RGB32(0, 0, 0), "Star Trek"
  35.     _DISPLAY
  36.     _LIMIT 15
  37.  
  38. cx = _WIDTH / 2
  39. power = 1000 'TO 1 STEP -1
  40. x = (_HEIGHT - 20) ^ (1 / power)
  41. dy = 1 '256 pixel height / 50 blocks across
  42. FOR y = -840 TO -250
  43.     CLS
  44.     FOR i = 0 TO power - 1
  45.         '_PUTIMAGE [STEP] [(dx1, dy1)-[STEP][(dx2, dy2)]][, sourceHandle&][, destHandle&][, ][STEP][(sx1, sy1)[-STEP][(sx2, sy2)]]
  46.         _PUTIMAGE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), swt&, 0, (0, y + dy * i)-(319, y + dy * (i + 1))
  47.  
  48.         'LINE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), , B
  49.     NEXT
  50.     _DISPLAY
  51.     _LIMIT 15
  52. yy = 80
  53. FOR i = 60 TO 0 STEP -.5
  54.     CLS
  55.     yy = yy + 60 / i
  56.     cText _WIDTH / 2, yy + yy, yy, _RGB32(230, 220, 50), "Star Trek"
  57.     cText _WIDTH / 2, yy + yy, yy * .96, _RGB32(0, 0, 0), "Star Trek"
  58.     _DISPLAY
  59.     _LIMIT 75
  60.  
  61. SUB cText (x, y, textHeight, K AS _UNSIGNED LONG, txt$)
  62.     fg = _DEFAULTCOLOR
  63.     'screen snapshot
  64.     cur& = _DEST
  65.     I& = _NEWIMAGE(8 * LEN(txt$), 16, 32)
  66.     _DEST I&
  67.     COLOR K, _RGBA32(0, 0, 0, 0)
  68.     _PRINTSTRING (0, 0), txt$
  69.     mult = textHeight / 16
  70.     xlen = LEN(txt$) * 8 * mult
  71.     _PUTIMAGE (x - .5 * xlen, y - .5 * textHeight)-STEP(xlen, textHeight), I&, cur&
  72.     COLOR fg
  73.     _FREEIMAGE I&
  74.  
  75.  
« Last Edit: March 30, 2019, 04:46:47 pm by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Hi Mark, need a little help with this...
« Reply #2 on: March 30, 2019, 04:54:38 pm »
Nope, that didn't fix it. If I put the line back as:

strictly prohibited. Live long & prosper.

The period still gets cut off. I can't seem to extend that text lines past 40 characters. The period, at the end, would be character 41.

Anyway, thanks for trying. I might be able to get a handle on it in the future. For some weird reason, I really like this as a text reader. It seems to hold my attention better than a ... oh, what's that over... I think steak for dinner would be... Anyway, great effect!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Hi Mark, need a little help with this...
« Reply #3 on: March 30, 2019, 04:57:47 pm »
I think I just found the problem, hold on...

It was this line:
_PUTIMAGE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), swt&, 0, (0, y + dy * i)-(319, y + dy * (i + 1))

change to:
_PUTIMAGE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), swt&, 0, (0, y + dy * i)-(359, y + dy * (i + 1))

319 was the old image width.
« Last Edit: March 30, 2019, 05:02:39 pm by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Hi Mark, need a little help with this...
« Reply #4 on: March 30, 2019, 06:06:45 pm »
Cool! So now that you pointed out where the sizing part is, presto, I squeaked a few other character spaces out of it, and was able to change the & sign to "and."

Thanks!!!!

Code: QB64: [Select]
  1. ' Star Trek
  2. SCREEN _NEWIMAGE(800, 700, 32)
  3. _SCREENMOVE 300, 20
  4. swt& = _NEWIMAGE(344, 512, 32)
  5. _DEST swt&
  6. COLOR _RGB32(0, 180, 0)
  7. nl$ = CHR$(10)
  8. sw$ = "Space, the final frontier. These are the" + nl$
  9. sw$ = sw$ + "voyages of the Starship, Enterprise." + nl$
  10. sw$ = sw$ + "Its five year mission, to seek out new" + nl$
  11. sw$ = sw$ + "life; to explore new worlds; To boldly" + nl$
  12. sw$ = sw$ + "go where no man has gone before..." + nl$
  13. sw$ = sw$ + nl$ + nl$
  14. sw$ = sw$ + "Well that sure beats the other sci-fi," + nl$
  15. sw$ = sw$ + "franchise, which pales by comparison to" + nl$
  16. sw$ = sw$ + "the awesomeness of the Star Trek legacy." + nl$
  17. sw$ = sw$ + "Stay tuned for other Star Trek moments." + nl$
  18. sw$ = sw$ + nl$ + nl$
  19. sw$ = sw$ + "This has been a public service message" + nl$
  20. sw$ = sw$ + "for the United Federation of Planets." + nl$
  21. sw$ = sw$ + "Any rebroadcast of this message, without" + nl$
  22. sw$ = sw$ + "the explicit permission of the U.F.P., is" + nl$
  23. sw$ = sw$ + "strictly prohibited. Live long and prosper." + nl$
  24. LOCATE 25, 1
  25. PRINT sw$
  26.  
  27. yy = _HEIGHT / 3
  28. FOR i = 11 TO 60 STEP .5
  29.     CLS
  30.     yy = yy - 60 / i
  31.     cText _WIDTH / 2, yy + yy, yy, _RGB32(230, 220, 50), "Star Trek"
  32.     cText _WIDTH / 2, yy + yy, yy * .96, _RGB32(0, 0, 0), "Star Trek"
  33.     _DISPLAY
  34.     _LIMIT 15
  35.  
  36. cx = _WIDTH / 2
  37. power = 1024 'TO 1 STEP -1
  38. x = (_HEIGHT - 20) ^ (1 / power)
  39. dy = 1 '256 pixel height / 50 blocks across
  40. FOR y = -840 TO -270
  41.     CLS
  42.     FOR i = 0 TO power - 1
  43.         '_PUTIMAGE [STEP] [(dx1, dy1)-[STEP][(dx2, dy2)]][, sourceHandle&][, destHandle&][, ][STEP][(sx1, sy1)[-STEP][(sx2, sy2)]]
  44.         _PUTIMAGE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), swt&, 0, (0, y + dy * i)-(343, y + dy * (i + 1))
  45.  
  46.         'LINE (cx - .75 * x ^ i, 10 + x ^ i)-(cx + .75 * x ^ i, 10 + x ^ (i + 1)), , B
  47.     NEXT
  48.     _DISPLAY
  49.     _LIMIT 15
  50. yy = 80
  51. FOR i = 60 TO 0 STEP -.5
  52.     CLS
  53.     yy = yy + 60 / i
  54.     cText _WIDTH / 2, yy + yy, yy, _RGB32(230, 220, 50), "Star Trek"
  55.     cText _WIDTH / 2, yy + yy, yy * .96, _RGB32(0, 0, 0), "Star Trek"
  56.     _DISPLAY
  57.     _LIMIT 75
  58.  
  59. SUB cText (x, y, textHeight, K AS _UNSIGNED LONG, txt$)
  60. 'screen snapshot
  61. cur& = _DEST
  62. I& = _NEWIMAGE(8 * LEN(txt$), 16, 32)
  63. COLOR K, _RGBA32(0, 0, 0, 0)
  64. _PRINTSTRING (0, 0), txt$
  65. mult = textHeight / 16
  66. xlen = LEN(txt$) * 8 * mult
  67. _PUTIMAGE (x - .5 * xlen, y - .5 * textHeight)-STEP(xlen, textHeight), I&, cur&
  68.  
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Hi Mark, need a little help with this...
« Reply #5 on: April 02, 2019, 10:32:29 pm »
Well, I think THIS is pretty cool.... I like it !!

Well done!
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Hi Mark, need a little help with this...
« Reply #6 on: April 03, 2019, 09:34:25 am »
Hey johnno56!

Can't imagine why you like it? ;-))