Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Why does it go behind?


turbocookie
 Share

Recommended Posts

i just got a code and it is suppose to make my chatbox transperent, it works but, the text is behind the game for some reason, when you type it flashs then looks like it goes behind

here are the scripts i used

```
Private Sub Form_Load()
    AlphaBlendControl (txtChat.hwnd)
    txtChat.ZOrder 0

    Dim I As Long
    Dim Ending As String

    For I = 1 To 3
        If I = 1 Then Ending = ".gif"
        If I = 2 Then Ending = ".jpg"
        If I = 3 Then Ending = ".bmp"

        If FileExists("GUI\800X600" & Ending) Then
            frmStable.Picture = LoadPicture(App.Path & "\GUI\800X600" & Ending)
        End If
    Next I

    MapChat.Text = "Map"

End Sub
```
and

```
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_TRANSPARENT = &H20&

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Sub AlphaBlendControl(hwnd As Long)
Dim Result As Long

Result = SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)
End Sub

```
screenshot ingame (cant see much)

![](http://www.freemmorpgmaker.com/files/imagehost/pics/b57e8fd404c4e64f44e1f7b3d4125c81.JPG)
Link to comment
Share on other sites

no it didnt, it said to put this script anywhere, so i made a new module, he said it works like that

```
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_TRANSPARENT = &H20&

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Sub AlphaBlendControl(hwnd As Long)
Dim Result As Long

Result = SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)
End Sub

```

and he said to put this into load_form in frmMirage, mine is frmStable (frmMirage)

```
Private Sub Form_Load()
    AlphaBlendControl (txtChat.hwnd)
    txtChat.ZOrder 0

    Dim I As Long
    Dim Ending As String

    For I = 1 To 3
        If I = 1 Then Ending = ".gif"
        If I = 2 Then Ending = ".jpg"
        If I = 3 Then Ending = ".bmp"

        If FileExists("GUI\800X600" & Ending) Then
            frmStable.Picture = LoadPicture(App.Path & "\GUI\800X600" & Ending)
        End If
    Next I

    MapChat.Text = "Map"

End Sub
```
Link to comment
Share on other sites

Take out the txtChat.zOrder. Z-Order is which order the individual controls are displayed in. In this case, you've set the Z-Order to the absolute lowest, so the chat box is behind everything. I have no idea how that will affect your transparency, but it should at least correct the chat box being behind the main screen.
Link to comment
Share on other sites

it looks like a bad way to go about it, generally when it comes to this sorta thing…
didn't we already address this issue?

http://www.touchofdeathforums.com/smf/index.php/topic,59096.msg625217.html#msg625217
Link to comment
Share on other sites

it isnt the order bit, i told the person the problem i have atm and he said to use that. it didnt change anything.

DFA sorry if you did adress it but, use all confused me with technical stuff back there.

please i just need the writing on the screen without the box there has to be a way :(
Link to comment
Share on other sites

Ahah! :D Turbocookie, you gained +100 points of esteem.
I will follow this thread with a lot of attention.

Searching online I found a few of tutorials, but they didn't explain really how to get that effect. It's a bit frustrating indeed.
I tried with the component "Image". You know, if you use that you can load *.gif\*.png image with an alpha channel. But when I go to compile and execute the Client.. bah.. disaster. "Image(s)" go(es) under [ picScreen ].
Link to comment
Share on other sites

It goes behind because you're declaring functions and constant variables as private in another module. You need to put them in **frmMirage** or declare them as public. I'll show you how I did it:

In **frmMirage** (**frmStable**) at the very top, add this:

```
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const TextThing = (-20)
Private Const TransparentChatBox = &H20&
```
Add this to **Private Sub Form_Load()**:

```
SetWindowLong txtChat.hWnd, TextThing, TransparentChatBox
```
That should be all. Now, under your chatbox, use the Image tool on VB6 to place an image under the chatbox. Then, on the properties toolbar, select the picture you want for the image. It should work after that.
Link to comment
Share on other sites

@turbocookie:

> no easy way? then give me a complex way, ill give it a try, i need it though so…

learn D3D

sample code - http://www.vbforums.com/attachment.php?s=e7482c0e6fad6775b6f123796c5397aa&attachmentid=44517&d=1137559433

demonstrates…

```
  1\. First Windowed DirectX8 Application
  2\. First Fullscreen DirectX8 Application
  3\. Windowed & Fullscreen Initialization Together
  4\. 2D Polygon Drawing
  5\. Vertex Colors
  6\. Vertex Buffers
  7\. Drawing Text
  8\. Triangle Rendering Formats
  9\. Scaling Compensation
  10\. Texture Mapping
  11\. Texture Mapping With Colored Vertices
  12\. Transparency
  13\. Alphablending
  14\. Gamma Correction
  15\. Rotation
  16\. Animation
  17\. Advanced Animation
  18\. Time Based Animation
  19\. Tile Engine

```
Link to comment
Share on other sites

@Kimimaru:

> It goes behind because you're declaring functions and constant variables as private in another module. You need to put them in **frmMirage** or declare them as public. I'll show you how I did it:
>
> In **frmMirage** (**frmStable**) at the very top, add this:
>
> ```
> Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
> Private Const TextThing = (-20)
> Private Const TransparentChatBox = &H20&
> ```
> Add this to **Private Sub Form_Load()**:
>
> ```
> SetWindowLong txtChat.hWnd, TextThing, TransparentChatBox
> ```
> That should be all. Now, under your chatbox, use the Image tool on VB6 to place an image under the chatbox. Then, on the properties toolbar, select the picture you want for the image. It should work after that.

This doesn't allow you to show text in front of the game.

It seems no one understands how DirectX works. >_>

To have something transparent, you need to render it.
Link to comment
Share on other sites

@turbocookie:

> i dont really have time to learn anymore coding stuff, i have a busy lifestyle and im not on much really. so if anyone can just PLEASE make me a script that shows the TEXT from the chatbox WITHOUT the BACKGROUND, please do.

I'm sorry to say, but game development requires dedication and a good amount of time. If you don't have that, then game development isn't really suited for you. It's not like you think of what your game should look like and that it just drops out of the blue (sky). If you don't want to bother, then we shouldn't either.

Regards,
  Godlord.
Link to comment
Share on other sites

@Sir:

> @turbocookie:
>
> > i dont really have time to learn anymore coding stuff, i have a busy lifestyle and im not on much really. so if anyone can just PLEASE make me a script that shows the TEXT from the chatbox WITHOUT the BACKGROUND, please do.
>
> I'm sorry to say, but game development requires dedication and a good amount of time. If you don't have that, then game development isn't really suited for you. It's not like you think of what your game should look like and that it just drops out of the blue (sky). If you don't want to bother, then we shouldn't either.
>
> Regards,
>   Godlord.

Well, I'd love to point out that the actualy game developper doesn't know how to program. He puts up the desing document and such things, it helps alot if he can program, thought.

Unless you want to go solo..
Link to comment
Share on other sites

@Ddunit:

> @Sir:
>
> > @turbocookie:
> >
> > > i dont really have time to learn anymore coding stuff, i have a busy lifestyle and im not on much really. so if anyone can just PLEASE make me a script that shows the TEXT from the chatbox WITHOUT the BACKGROUND, please do.
> >
> > I'm sorry to say, but game development requires dedication and a good amount of time. If you don't have that, then game development isn't really suited for you. It's not like you think of what your game should look like and that it just drops out of the blue (sky). If you don't want to bother, then we shouldn't either.
> >
> > Regards,
> >   Godlord.
>
> Well, I'd love to point out that the actualy game developper doesn't know how to program. He puts up the desing document and such things, it helps alot if he can program, thought.
>
> Unless you want to go solo..

We aren't talking about companies here and even if we were then he should have hired someone to program it for him. Besides this is a question board, not a request board.

Regards,
  Godlord.
Link to comment
Share on other sites

@Robin:

> If you don't have the time to learn some basics in your 'hectic schedule' then why in God's name should we try and help you?

because its your job as head developer and technical support
Link to comment
Share on other sites

@DFA:

> @Robin:
>
> > If you don't have the time to learn some basics in your 'hectic schedule' then why in God's name should we try and help you?
>
> because its your job as head developer and technical support

Go look about your kid. xD
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...