Author Topic: Unstable Image Creation  (Read 2584 times)

0 Members and 1 Guest are viewing this topic.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Unstable Image Creation
« on: June 25, 2019, 07:35:22 am »
The sub-routine here is one I'm using to create a Hardware Image - (,33) type -
Code: QB64: [Select]
  1. SUB InitParams (X00Step!, Y00Step!, O00Step!, O10Step!, Mega!, X00!, Omega00!, Y00!, Omega10!)
  2.     _FREEIMAGE Quacker&
  3.     Targ& = _NEWIMAGE(101, 101, 32)
  4.     _DEST Targ&
  5.     COLOR _RGB32(255, 0, 0), _RGBA32(100, 100, 100, 0)
  6.     CLS
  7.     CIRCLE (50, 50), 50
  8.     CIRCLE (50, 50), 45
  9.     PAINT (50, 3)
  10.     DuckTemp& = _LOADIMAGE("pigeon.png", 32)
  11.     Temp& = _NEWIMAGE(2 * HalfWidth% + 1, 2 * HalfHeight% + 1, 32)
  12.     _DEST Temp&
  13.     _PUTIMAGE , DuckTemp&
  14.     _PUTIMAGE (BoltX% - Parameters!(GameLevel%%, 1), BoltY% - Parameters!(GameLevel%%, 1))-(BoltX% + Parameters!(GameLevel%%, 1), BoltY% + Parameters!(GameLevel%%, 1)), Targ&
  15.     _FREEIMAGE Targ&
  16.     Quacker& = HardwareImage&(Temp&)
  17.     _FREEIMAGE DuckTemp&
  18.     X00Step! = (Parameters!(GameLevel%%, 7) - Parameters!(GameLevel%%, 8)) / (15 * FrameRate%)
  19.     Y00Step! = (Parameters!(GameLevel%%, 11) - Parameters!(GameLevel%%, 12)) / (15 * FrameRate%)
  20.     O00Step! = (Parameters!(GameLevel%%, 9) - Parameters!(GameLevel%%, 10)) / (30 * FrameRate%)
  21.     O10Step! = (Parameters!(GameLevel%%, 13) - Parameters!(GameLevel%%, 14)) / (30 * FrameRate%)
  22.     Mega! = Parameters!(GameLevel%%, 0) / (DuckRad% + HalfHeight%)
  23.     X00! = (Parameters!(GameLevel%%, 7) - Parameters!(GameLevel%%, 8)) * RND + Parameters!(GameLevel%%, 8)
  24.     Omega00! = (Parameters!(GameLevel%%, 9) - Parameters!(GameLevel%%, 10)) * RND + Parameters!(GameLevel%%, 10)
  25.     Y00! = (Parameters!(GameLevel%%, 11) - Parameters!(GameLevel%%, 12)) * RND + Parameters!(GameLevel%%, 12)
  26.     Omega10! = (Parameters!(GameLevel%%, 13) - Parameters!(GameLevel%%, 14)) * RND + Parameters!(GameLevel%%, 14)
  27.  

The image used in the program is "Quacker&" and is formed by placing a loaded image "pigeon.png", and then placing on top of it the image "Targ&".  The subroutine (not given here) "HardwareImage&()" converts the image into (,33) type.

Amazingly, sometimes the image is missing the "Targ&" overlay, and sometimes the image is correctly shown with the "pigeon.png" image and the "Targ&" image on top.

This instability occurred when I copied the program into an InForm .bas file and did not (I'm fairly certain) have any problems previously.  To my inspection, there seems nothing wrong with the code (but what do I know???).

Any suggestions?  I haven't supplied the image "pigeon.png", and I hope that you may be able to do this by inspection.