Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flickering of the screen due to images and text in a loop
#1
Photo 
Hello team!

As advised on the Discord, I'm posting my whole code here.

My screen is flickering when displaying images and text.

It is a _DISPLAY placing issue.
At the beginning of the loop,  I actually have 24 cases.
Code: (Select All)
While casenumber <> 25
Case 1
...
Case 2
...
Etc.
Then images and more strings
Then INPUT with a number to select a case
_display
WEND



In those cases are strings as well.
This flickering is surely due to a wrong order of commands and a lack of _display somewhere, however, I don't know where it should be placed for my program to work.
There are several DO...LOOP inside this big WHILE...WEND, and I would like to know where to put the _DISPLAY commands in order to stop the flickering.

Thank you in advance for your help!


Attached Files
.zip   Tropic Stranded A Text Adventure Survival Game.zip (Size: 7.29 MB / Downloads: 18)
Reply
#2
Without seeing the whole code, from what you've shared, it seems to me like this would be the proper solution:

Code: (Select All)
While casenumber <> 25
Case 1
...
Case 2
...
Etc.
Then images and more strings

_AUTODISPLAY

Then INPUT with a number to select a case
_display
WEND

You're going to have to have an _AUTODISPLAY in effect before the use of that INPUT. The _DISPLAY after that input will stop the screen from refreshing, so you shouldn't see any flicker, as the display would be paused until that _AUTODISPLAY triggered it right before the INPUT.

Without the entire source, however, it's hard to say for certain exactly what you need. As I mentioned on discord -- is there any way you can zip up the source and resource files and share them? It's much easier to give advice when you can post the code in and compile it and see the problem in action for yourself.
Reply
#3
Without images in ZIP archive is not possible test it.


Reply
#4
I have now posted an archive with all the assets.
I tried some things informed on the Discord, but I am sadly still experiencing flickering.
Reply
#5
   
this fixes the error line I immediately encounter in IDE after extraction from zip
$ExeIcon:'./main.ico'

'very first impression after OK with above fix
This is very poor organization of code, (a sample with 24 duplications)
Code: (Select All)
Case 9 'fire, needs 1 wood, faster with a lighter
            case9:
            lastcaseused = 9
the flow through cases is not same as goto's to same cases, must be a nightmare to keep everything straight!

I suggest a seperate sub to call for each of those cases and get all that crap out of the main loop, so it is easier to read and fix. Give those subs names for what they do instead of goto case #num.

my 30 sec first impression of code, for what it's worth...


As stated already fickering is solved by _Display but using _Display and you have to _Display every single time you Print if you want user to see the stuff just printed.
And _Display is toggled back off with _Autodisplay so things printed or drawn are shown without need to explicity state _Display but then you get flickering specailly with big screen CLS.'s. So depending on code needs you work under assumed _Display conditions and rules or toggle back to _Autodisplay.

Yikes who wants to debug 16000 lines cold?
b = b + ...
Reply
#6
The source code is horribly confusing, but:

Somewhere around line 14109 (I poked around, so the number may not agree with the original) you call ResetScreenCLS and then on the next line you call showbg. What's going on: According to my research, ResetScreenCLS is supposed to insert an image with handle BG&. You know about BG& being ZERO? BG& is (probably) not a global shared variable, but a local variable used by showbg itself. It's just that showbg loads the background image, places it, and immediately deletes it from memory. I assume that the exact same problem will be in ResetScreenNoCLS, there it is exactly the same, you insert an image with an invalid handle.

So I would strongly recommend loading at least this specific image (bg.jpeg) into memory when the program starts and leave it there with the globally shared descriptor BG&.

Look, I spent more than an hour on this, like sorry, but normally my beer warmed up between testing your code. Do you understand the sacrifice I made? Smile


Reply
#7
+1 @Petr what a sacrifice! LOL

But you got farther along than I for sure!
b = b + ...
Reply
#8
Well, luckily I have some more beer in the fridge so can something to do with my appetite  Cool


Reply
#9
Thank you for your help, everyone! I was able to fix it now Cool
Reply




Users browsing this thread: 3 Guest(s)