Active Forums => QB64 Discussion => Topic started by: Pete on October 25, 2021, 07:06:15 pm
Title: Inspired by bplus...
Post by: Pete on October 25, 2021, 07:06:15 pm
I don't often do graphics, but when I do... I really , really hate to do the grunt work. I had a lot of that with my Wheel of Fortune spoof, and then I participated in the thread where bplus was discussing a _FONT incompatibility issue in past QB64 versions. I've seen enough of Mark's apps to know he makes use of algorithms, often, to do the grunt work. Anyway, versions aside, I decided if I want to do any more graphics applications, I want to start with some algorithms like the one I wrote for this demo. It automatically determines where to draw boxes around letters, rather than trying to estimate or map them out.
Title: Re: Inspired by bplus...
Post by: bplus on October 25, 2021, 08:35:53 pm
Nice how you handle a string that doesn't fit on one line across the screen.
Title: Re: Inspired by bplus...
Post by: Pete on October 25, 2021, 09:45:47 pm
Thanks. There are so many ways to make and apply various algorithms for text manipulation and a lot of it depends if you are using a single variable or arrays. This was made for a single variable. An array model would require more functions to wrap text. It's just something I'm kicking around and if I can get it to work to translate my SCREEN 0 WP into a graphics screen WP, I could add underlining text for hypertext usage. Of course using the overlay method could provide that display, too. It's nice to have so many options.
Pete
Title: Re: Inspired by bplus...
Post by: Pete on October 27, 2021, 05:01:14 pm
Well, maybe some more math crap needed, as I haven't tested this a whole lot. It is supposed to be a way to set top, bottom, left, and right margins, and work with various font sizes to put letters to the screen using either an overlay or direct graphics display. It wraps words and displays them in a graphics screen with a page border and boxes around each non-space letter. That means if you take this with you on your Blue Origin flight, it won't work once you leave the atmosphere. Sorry about that...
Input nothing at the first prompt to get the default text phrase. Input 1 at the two other prompts for normal text spacing or increase or decrease either, as desired. Esc to quit, or any key to run again.
@FellippeHeitor BTW - I had some weird results I noticed ONLY when I changed the code and did a recomplie/run with the IDE F5 key. Many times it would only display part of the default text! For example: I input nothing, 1 and 1 and it displayed only part of the default text. Then I pressed a key to rerun, same parameters, and it displayed the entire text, as expected. I'm using v2.0. Any thoughts? Can you reproduce it? I just did by loading the program, typing REM to line 3, and then F5 to compile and run. I then pressed Enter, 1 and Enter, 1 and Enter. It only printed to "I'd like to solve the puzzle," leaving out the please! Very impolite! You'd think I was running FB. :D Anyway, I then pressed a key, re-entered the same parameters, and on that an all other subsequent run loops, it worked fine.
Title: Re: Inspired by bplus...
Post by: Cobalt on October 27, 2021, 07:49:05 pm
Displays everything for me on the first run.
how ever the more I run it the more it begins to do weird things like this: (and of course you use _DISPLAY so as soon as anything displays over the window its destroyed! so this screen shot is not the original) missing text seems to be totally random.(and I do wonder if it has to do with _DISPLAY and a race condition)
Title: Re: Inspired by bplus...
Post by: Pete on October 27, 2021, 08:12:25 pm
@Cobalt Okay, we've now established this is something that will happen on not just my system. So I made just a couple of changes to allow it to work without the overlay feature. Removing the hardware overlay solves the issue, so the issue appears to be with PUTIMAGE and COPYIMAGE.
This non-overlay version will run correctly each time...
So the putimage and copyimage seem pretty straight forward, unless I'm somehow missing something in my (Steve's) method. Maybe this needs to be investigated as a QB64 bug?
Pete
Title: Re: Inspired by bplus...
Post by: Cobalt on October 27, 2021, 09:22:03 pm
Your also using a HARDWARE image, not just COPYIMAGE and PUTIMAGE. But I don't think there is anyway to pull off what your doing with just using plan a old image layer. since your trying to use graphics and text only at the same time.
Title: Re: Inspired by bplus...
Post by: Pete on October 27, 2021, 10:59:11 pm
Guys, you know what we haven't tried is _DELAY. @Cobalt You mentioned a "race" issue, and let's investigate that a bit...
So I put a small delay between the hardware overlay and PUTIMAGE statement. It fixed the unfinished display problem, but I still get strange timing results. The run that would fail without the delay inserted simply prints to the screen slower! When I run it again, it is printed almost all at once. So something is not consistent with the hardware rendering, and I notice it every time I change the code and do the first run after the change.
Hardware overlay activated, but with a small delay...
Title: Re: Inspired by bplus...
Post by: bplus on October 28, 2021, 12:13:51 pm
Don't know anything about Hardware images so that part wasn't inspired by me.
I think you @Pete are using it to cheat the system to get graphics effect in text mode screen, correct?
I know hardware image has some advantage either speed or permanence of image but are you @Pete using it for that advantage? probably the permanence part, probably should ask Steve as it came from him.
I am thinking a hardware image could only be background, so overlaying it is confusing to me.