loops, exiting and freeing images ?
Blitz3D Forums/Blitz3D Beginners Area/loops, exiting and freeing images ?
| ||
Ok I have set up a few loops in my game, one which controls the intro and exits when a value is set. Immediatley after that loop end I free the intro image - then the program goes on to the next loop. 1) The image is not freed after the loop, even when I put freeimage. 2) The second loop should be the only thing running, ie when the first loop is exited and the programs starts going through the other loop, that should just loop and loop until a value is set for exit. Yes or No? 3)I dont know if 2 was explained correctly :confused: example loop1 for intro [CODE] ;lop1 for intro repeat ;code here for intro exityn = 1 ;< to exit the loop until exityn=1 freeimage intro cls ; loop2 for Mode Select repeat mode select code here exitm = 1 until exitm = 1 [/CODE] Now Once the program is in loop 2, loop one should not be running. Yes or No? Also where I free the image after the first loop, If I unmask the modelect screen, which is in the second loop, I can still see the intro image in the background. Why? [EDIT] Im using B+ [/EDIT] |
| ||
Try posting the entire code unless its the size of HL2 ;-) |
| ||
Maybe its this from the docs Note that the variable to the Image is not reset to 0 upon using FreeImage, nor will any other variables pointing to the same Image. Checking the handle returns a non zero might make it look like the image is still loaded. Do you flip after the cls? If not then you aren't clearing the backbuffer. |
| ||
The intro image is only called to be drawn within the first loop. Its just an intro image. There is a 4 second wait then the loop is instructed to end. immediatley after the first loop, like in my fist post, i free the image and then clear the screen. Then the second loop begins. The second loop is for the mode select. It doesnt have anything in it yet, only the loading of the mode select screen. Now when I unmask the modeselect image I can see through it and it shows the intro screen in the background when it should be freed. There really isnt any code to show, what i posted in my first post is not to far off from what i actually have. Why doesnt the image get freed? The first loop wich calls it ends yet it still draws the image. If one loop ends when a condition is met, it no longer runs Yes or No? If then a second loop begins, only that loop and the code in it is processed Yes or No? meaning the first loop is not processed. |
| ||
Thx shambler. I did not flip after cls, but I have now added flip after cls and the intro image still shows. Its as if the first loop is still being processed even though the condittion for it to end has been met. |
| ||
I have managed to make it stop shambler. In each loop Im implementing a 2d version of Mark Siblys render tweening code. I changed the updateworld() function to an updategame() function. Inside this function I did not have cls as the first line. Since adding cls its all working fine. |
| ||
I think I have it, you needed 2 cls. One to clear the backbuffer. Then flip Then another to clear the backbuffer again. Graphics3D 800,600,32 SetBuffer BackBuffer() image=LoadImage("space08.png") exit1=False exit2=False DrawImage image,0,0 Flip Repeat If KeyHit(57) Then exit1=True Until exit1=True FreeImage image Cls Flip Cls Repeat If KeyHit(57) Then exit2=True Until exit2=True |
| ||
lol, thx shambler |