Author Topic: Is there a way to print a permanent string at a specific location?  (Read 1579 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • Steve’s QB64 Archive Forum
Re: Is there a way to print a permanent string at a specific location?
« Reply #15 on: February 13, 2022, 01:46:29 pm »
@Blpus The reason why your hills aren't working is rather simple:  _PUTIMAGE is glitched and doesn't respect the VIEW SCREEN boundries!

Code: QB64: [Select]
  1. Screen _NewImage(640, 480, 32)
  2.  
  3. View Screen(0, 0)-(639, 400)
  4.  
  5.  
  6. Box = _NewImage(40, 40, 32)
  7. _Dest Box
  8. Cls , -1 'white box
  9. _Dest 0 'back to main screen
  10. Xchange = 2: Ychange = 2
  11.     x = x + Xchange
  12.     Cls 1, SkyBlue
  13.     y = y + Ychange
  14.     If x < 0 Or x > 640 Then Xchange = -Xchange
  15.     If y < 0 Or y > 480 Then Ychange = -Ychange
  16.     _PutImage (x, y), Box
  17.     _Limit 60
  18.     _Display

My demo above works with CIRCLE and the VIEW SCREEN, but putimage doesn't.  It's a new _UNDERSCORE command, and it's missing the important check for VIEW port limits and needs to be fixed. 

Until it is, you've got to manually bound _putimage coordinates to not allow them to go beyond your VIEW SCREEN limits yourself.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Is there a way to print a permanent string at a specific location?
« Reply #16 on: February 13, 2022, 01:58:02 pm »
(Didn't see 2nd post first on page 2) And not rocket science to throw a monkey wrench into that:
Code: QB64: [Select]
  1. Screen _NewImage(640, 480, 32)
  2.  
  3.  
  4. View Screen(0, 0)-(639, 460)
  5. View Print 30 To 30
  6.  
  7.  
  8. Print "This text stays at the bottom without being overwritten.";
  9.  
  10. changeX = 2: changeY = 2
  11.  
  12.     Cls 1, -1 'white background for the graphics screen
  13.     'moving red ball
  14.     x = x + changeX
  15.     y = y + changeY
  16.     For i = 1 To 25
  17.         Circle (x, y), i, &HFFFF0000 'red filled circle
  18.     Next
  19.     If x < 0 Or x > 640 Then changeX = -changeX
  20.     If y < 0 Or y > 480 Then changeY = -changeY
  21.     _PutImage , 0, 0, (0, 0)-(_Width - 1, _Height - 16)
  22.     _Limit 60
  23.     _Display
  24.  
  25.  

Kind of an interesting bug effect...

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • Steve’s QB64 Archive Forum
Re: Is there a way to print a permanent string at a specific location?
« Reply #17 on: February 13, 2022, 02:03:57 pm »
(Didn't see 2nd post first on page 2) And not rocket science to throw a monkey wrench into that:

Kind of an interesting bug effect...

Aye.  _PutImage currently doesn't respect the VIEW limits, so it can produce some rather oddish results if you don't manually adjust the limits yourself for it.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!