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 / no transparent with input

Author
Message
HomerS
16
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 19th May 2010 21:34
Hi,


Can't find info here on the forum about transparentcy of the input code.

With the text it works over a picture but with input, i get a white background.

Is that a bug? Or just that it is like print, ik cant handle bold etc?

Is there an other way to use input with transparentcy?

Text background type() gives me a zero, but with the normal print and text i get the transparentcy done.

i put a picture with it, so maby i only have the problem?

(sorry for my lack of englisch)

Greetings Jeroen



Attachments

Login to view attachments
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th May 2010 22:39
Yes, it functions the same as print. There are a couple ways to handle this:


1. Do the input on another bitmap, grab the image with GET IMAGE, and pt it on the screen as a sprite (black becomes transparent).

2. Make your own input function that uses the ENTRY$()

I have not tried number 1 as I just thought of it now. 2 is a little more complex as you will have to build in checks for backspace, enter, etc etc

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
HomerS
16
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 19th May 2010 23:40
TNX bn2,

I will try to make sprites for each letter, maby to let the user click it with the mouse on a virtual keyboard (like in some games). But the standard input seems easyer to use (less programming).

Or i will make a black box in the picture, so there is no background effect on it (Only the input should not be to long)?

Greetings Jeroen
Robert The Robot
17
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 20th May 2010 10:57 Edited at: 20th May 2010 10:59
Just a quick example of how to use the keyboard entry buffer (all done from memory, as I don't have DBC with me right now, but I've used this quite extensively in my various projects):



I've tried to comment it and explain what's going on. Hope this helps!

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 20th May 2010 19:32
I was wrong about the sprite thing, I forgot that when you do INPUT the computer waits on that command. Honestly ENTRY$() is a better choice anyway. The only downside is having to program it to handle non-character keys, like shift backspace and return

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th May 2010 17:41
And some code just for variety using inkey$() - though you'd have to manage the key repeat. I use a while loop that looks to see if the same key is held down (no key repeat):



Enjoy your day.
HomerS
16
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 25th May 2010 22:25
Hi Guy's,

Thank you all verry much for the code. It helped me a lot.

I've tried you codes. Form Latch I think it is good and simple for me to use. i have moved the enterkey() up above the inkey() line. Becouse the enter was seen as an inkey en could not enter.

Now i have changed your code, so that ik can type with even a moving cuve at the background.

See the code below.



Now I am going to make an option to type your namen, with an object rotating, so that the program is not waiting for an input and will not fill the background of the input. Also the backspace key needs to be useble.

If i have finished it, i will show you.

Greetings Jeroen
HomerS
16
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 28th May 2010 01:11
Hi i am done with it. can rotate an object and input your name, all not waiting for input.

see the code with music (free download) and object (home made, free to use for everybody).

only problem is the flashing screen at the start, cant get that out. anyone a sugestion?



Greetings,

Jeroen

Attachments

Login to view attachments
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Jun 2010 02:49
After

set text font "Myriad Pro Cond",1
set text size 32

add a SYNC otherwise the text may not size properly.

As far as the flashing, from what I can tell (I haven't run the code) there doesn't seem to be anything that would be directly causing it. Try setting the display mode and the sync rate at the top before anything else and add a cls

Something like



Enjoy your day.
Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 5th Jun 2010 18:33 Edited at: 9th Jun 2010 17:19
hi,

In my archives, I found this code that I made. It supports the keys: left/right home/end delete/backspace return/enter. Simple to use.

Replaces "cls rgb(255,0,0)" by "cls 0" if you do not want the flash.

EDIT:Code changed to add the ability to center the text.


@+

AMD Athlon(tm)XP 3200+ (2.2GHz) / DDR pc3200 (1024Mo) / Nvidia 6800GT (driver 178.24 WHQL)/ XP Pro SP3 / DirectX 9.0c (February 2010)/ DBClassic v1.13 / DBPro v7.4
HomerS
16
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 5th Jun 2010 23:01
Tnx for the info guy's.

Dont know why i dit cls-red but I changed it into cls 0 and it worked perfect.

Wow, how do you get those colors in your code snippet??

That is a lot of code, I will look at it and test it.

Can it also be able to fade the text into transparance? Becouse now you see it ends/fades in black.

tnx and greetings Jeroen
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Jun 2010 06:14 Edited at: 9th Jun 2010 06:17
@HomerS
Quote: "Can it also be able to fade the text into transparance? Becouse now you see it ends/fades in black."

Fading the text to transparent can be a little tricky. You can try and slowly change the color with INK RGB(),0 and reprint the text each time, but you'd have to be sure you are changing it to the background color. If there are multiple colors on the screen or if there is a 3d scene, this won't work.

In that case, you'd have to do some alpha blending. This means getting an image of the background, and getting an image of the text, and slowly blending the colors together from the text color to the background color.

However, since 3d objects can alpha blend (ghost object on), you can texture a plain with text and fade the plain to completely disappear:



See the link below for an explanation of what is happening.

Fade Object Example

Enjoy your day.
Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 9th Jun 2010 17:24
Yes, it can be able to fade the text into transparence.I adapted the snippet in your code :



AMD Athlon(tm)XP 3200+ (2.2GHz) / DDR pc3200 (1024Mo) / Nvidia 6800GT (driver 178.24 WHQL)/ XP Pro SP3 / DirectX 9.0c (February 2010)/ DBClassic v1.13 / DBPro v7.4

Login to post a reply

Server time is: 2024-03-29 16:00:08
Your offset time is: 2024-03-29 16:00:08