Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Text manipulation that seems to have a bug...

Author
Message
=C=
22
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 20th Sep 2003 03:37
I need a second more educated opinion on this.

First here is the code:



Now there are 2 funtions there, both working fine on their own, but when I call one from the other it seems to freeze in the second - in the while statement - and it gets stuck.

What the code does is.

1. Gets a long string
2. loop and break it in sections
3. check if the section ends in space or reduce it until it does.
4. write the text in a bitmap
5. crop the bitmap so the text is "boxed" as an image
6. return the image
7. main loop just pastes the image on the screen (bitmap 0)

Step three is the second function call. And I can't make go through it at all.

I tried it by doing all the work on Bitmap 0 and not on a bitmap I created; well that works fine...
I also tried it by puting the code of the cleantext() function as part of the main function box_text() and it doesnt work.

Now you can appreciate the benefit of a function like this. Faster and multy line text boxes instead of writting big text in the main loop...

Any Ideas??? You are more than welcome to use or change the code but please if you have a breakthrough, comments, suggestions or tips do let me know...

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
=C=
22
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 20th Sep 2003 06:31
I copied the code in Darkbasic Pro from DBC and I used the debugger because I couldn't believe that something as foundamendal as a nested loop would not work due to a bug.

And I was right. I found the bug and I am happy to say I fixed and Updated the code in codebase.

3:30 in the morning and almost time to hit the hay!

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy

Login to post a reply

Server time is: 2025-05-20 14:37:40
Your offset time is: 2025-05-20 14:37:40