Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 51

Thread: DirectX GUI Controls

  1. #11

    DirectX GUI Controls

    I think you are doing it the right way. DirectX is very low-level so it doesn't contain any mouseover functions. You can retrieve the mouse-position using DirectInput but you can also use the default Delphi-Events or WINAPI functions, it doesn't matter. I use the standard delphi events to retrieve mouse coords.

    So i guess your code is the way to go. If it works for you, it's OK
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #12

    DirectX GUI Controls

    ok great, thanks chronozphere...

    now i jus need figure out how to create a border around buttons and dialogs etc, any pointers you could give me?

    also problem finding info on rendering an image to the window, ie as the background image.. thanks again, you've been very helpful

    -MM

    *edit* here is what i have done so far > http://www.meka-meka.com/meka/Nemesis.rar

  3. #13

    DirectX GUI Controls

    I'm glad i can help.

    A border around a button and a button image can be done by rendering textured quads. For texturing i would suggest this tutorial:

    http://www.two-kings.de/tutorials/dx...raphics05.html

    The only difference is that you need a Quad (rectangle), not a pyramid. I'm sure you can figure out the coordinates for a textured quad yourself.

    This way, you can render images. You can use them as background for your window, or titlebar. You can also use them for your buttons. If you only want a border for your buttons i would suggest you use an image that is transparent in the center, and only has color at the borders.

    You can get even cooler effects when you combine Diffuse colors with textures. You can give your images colors, and blend them with the background. You have to include D3DFVF_DIFFUSE and D3DFVF_TEX1 in your texture format definition. Also make sure that your renderstates and sampler-states are correct. This can be a little tricky. Check the following tut (alpha blending only):

    http://www.two-kings.de/tutorials/dx...raphics07.html

    When i get home.. i will take a look at your work so far.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #14

    DirectX GUI Controls

    hi, great thanks, only problem is that if the virtual form size is changed, it will strentch the texture and make the border bigger ? as i'd like to try make it resemble a real form... thanks again

  5. #15

    DirectX GUI Controls

    Hmm.. that's true.

    Then i would suggest you render a quad for each side of the dialog (Textured or not)
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #16

    DirectX GUI Controls

    ok yes that is what i will do thanks, what do u think of my test app?

  7. #17

    DirectX GUI Controls

    hm im having few problems also with this line

    [pascal]NemRes.FFont.DrawTextA(nil, 'testing', -1, @NemRes.FFontPos, DT_NOCLIP, $026AFE);[/pascal]

    i have created the font object etc, nemres is a struct fontpos is a rect

    as soon as i call this the app uses 100% cpu and stops rendering.

    any sugestions ?

    thanks in advance.

  8. #18

    DirectX GUI Controls

    hi, ok i've been messing around i missed a char is why it didnt render the text, however, now as soon as i move the directx window, it uses 100% cpu.

    *edit* nm that, i have solved the problem, thanks anyways

    -MM

  9. #19

    DirectX GUI Controls

    Yummie.. draggable windows I like that.

    Your test app looks great so far. Keep it up.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  10. #20

    DirectX GUI Controls

    hi, when my app is rendering, no matter what spec of pc, it seems to sit around 60fps, and uses 0% cpu no matter what.... but if i cover the window with another, it continues its routines but runs at 50% cpu and goes at around 2300fps.. i checked your nasha engine for reference and i see it also uses around 40-50% cpu....

    so i tried running the render process on a seperate thread in a constant loop, but it stil used 0% cpu and sat at 60fps. again covering the window then moving the window out of the way, caused it to run at 2300fps for a v.short period, is there any hints or tips you could give me on this situation?

    thanks in advance.

    -MM

Page 2 of 6 FirstFirst 1234 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •