Active Forums => QB64 Discussion => Topic started by: Pete on August 15, 2021, 09:15:17 pm
Title: Hey graphic gurus, top this!!!
Post by: Pete on August 15, 2021, 09:15:17 pm
Going through some age old QB4.5 stuff I made during the Jurassic Period, and I came across this little ge I used back then to get a cursor effect in SCREEN 12. So is there a better way now in QB64?
Title: Re: Hey graphic gurus, top this!!!
Post by: Pete on August 16, 2021, 03:22:43 am
Same method... just more optimistic! :D
What's funny is using SELECT CASE instead of IF/THEN/ELSE actually would have added one extra line.
Anyway, optimization aside, and that was a nice job, btw, I'm still wondering if anyone has devised, or if QB64 has a native way, of putting a working cursor into a graphics word processor, other than this???
Pete
Title: Re: Hey graphic gurus, top this!!!
Post by: Petr on August 16, 2021, 01:19:33 pm
If graphic mode cursor, so why LOCATE? Oh i see, it is program created using QB4.5!
So here is my version (modified @bplus version), it calculate graphics coordinates from text coordinates and then use _PRINTSTRING.
Title: Re: Hey graphic gurus, top this!!!
Post by: Pete on August 16, 2021, 03:12:22 pm
Cool! You got the cursor to move under the characters, without the characters swapping out with the cursor (my blinking effect for when the cursor was under a character). That's a performance improvement on top of Mark's optimization improvement.
Oh wait, the insert wasn't completed in your example, so we can't change the cursor to a block by pressing the Insert key....
So if you could add a way to show the cursor as a block instead of an underscore, when the Inert key is press once, that would be amazing, but I wonder if there is a way the block cursor could be made translucent, like it is in a SCREEN 0 app? Again, my approach in the old days was to swap out the letter characters with the block character to make an alternating blinking cursor and letter effect.
Pete
Title: Re: Hey graphic gurus, top this!!!
Post by: bplus on August 16, 2021, 03:35:00 pm
Title: Re: Hey graphic gurus, top this!!!
Post by: Pete on August 16, 2021, 04:27:55 pm
Wow, we're certainly getting somewhere with this. I do know my system is the slowest of the bunch here, and as such, the CLS in Mark's example makes the sentence jump around a bit. Also, the arrow keys are not quite as smooth. The translucent cursor appearance, however, is reMarkable! I wish the QB64 IDE switched to it.
While Petr is twice as much code, the absence of CLS makes it so there is no jittery effects on my slow-ascii system and the arrow keys create a smooth movement, better than my initial SCREEN 12 example. I'm not sure if the cursor could be made to look like the effect mark posted, or not. I tried to fiddle with a marriage between the two, but since graphics isn't my thing, I came up empty.
Now if SCREEN 0 didn't have a native cursor, I'd make a more complex version of this tiny demo:
Of course with any build we have to consider printing to the far right edge of the screen (screws with locate) or for a block cursor, especially the one I coded above, what the appearance will be over color or especially already highlighted text.
Pete
Title: Re: Hey graphic gurus, top this!!!
Post by: Richard Frost on August 16, 2021, 11:24:50 pm
Nice works fine without the font. This looks better than Pete spec'd as long as doesn't give him the jitters. ;-))
I could use this over my graphics Input fix, better cursor.
Title: Re: Hey graphic gurus, top this!!!
Post by: Pete on August 17, 2021, 03:22:46 pm
@Richard Frost : Very nice! I see it's limited to 32-color use. I'm not sure how that would effect all users. It's very smooth and looks exactly like a SCREEN 0 cursor routine.
I think it works with the block cursor like the example I showed where the background and foreground colors get swapped in a time loop. The only problem I see here is a user always needs a blank space at the end of the sentence, or the cursor disappears. You can see that by trying my stripped down version of it, below...
I did not make a way to stop the left and right cursor movement.
I replaced the "p" variable with pos(0). It works, but it would need a limitation using maxchars if a way to get the cursor showing after the last character of the sentence is figured out.