Page 4 of 6 FirstFirst ... 23456 LastLast
Results 31 to 40 of 51

Thread: DirectX GUI Controls

  1. #31

    DirectX GUI Controls

    I guess your performance loss is perfectly acceptable.. A decrease of a thousand frames per second seems a lot, but when you look at it from a mathematical point, it isn't that bad.

    I took my calculator to show you why:

    Rendering 4500 frames per second (= 1000ms), means that rendering one frame takes:

    1000/4500 = 0.22 ms

    Now.. when your FPS drops to 3500, a frame will render in:

    1000/3500 = 0.28ms
    So rendering the second label only takes 0.06 ms which is perfectly acceptable if you ask me. Rendering text is usualy slower than rendering quads because under the hood, D3D is rendering a quad for each character (If i'm not mistaking).

    Now when you want to render 200 labels, it would theoraticly take:

    0.22 + (200 * 0.06) = 12.2ms

    Which results in an FPS of

    1000/12.2 = 81 FPS.

    Which is still acceptable, if i'm concerned.
    This is all theory. If you can optimize your render code, you can get far better performance than 81 FPS. Please note that changing renderstates also takes time. You only have to do this once when rendering those 200 font's.

    Pre-rendering all your labels would give you a speed increase, but i doubt whether it's worth the effort. :?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #32

    DirectX GUI Controls

    hi, i see what u mean, thanks, but is there any faster methods of displaying text ? thanks again

  3. #33

    DirectX GUI Controls

    Yeah... pre-rendering the text (for example make your texts in photoshop and render them using a single quad).

    You can also expiriment with it by making your own font rendering methods (like i did).
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #34

    DirectX GUI Controls

    Quote Originally Posted by chronozphere
    Yeah... pre-rendering the text (for example make your texts in photoshop and render them using a single quad).

    You can also expiriment with it by making your own font rendering methods (like i did).
    so i could make each letter in photoshop, load them as a texture and render quads of letters? this will be worth the effort or do you think it will not make too much difference?

    thanks


    btw, my latest tweaks have made big difference also>




    -MM

  5. #35

    DirectX GUI Controls

    Nope.. you misunderstood me. I mean that you pre-render your TEXT, not a set of characters. It will definitly be a lot faster, but you'll loose a lot of flexibility.

    You can also render your texts to bitmaps when you start the game. Then you don't need to do it all by yourself in photoshop.

    But i think it's not the best way because you cannot display random text anymore. You better make your own font-system or be satisfied with the one you currently use.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #36

    DirectX GUI Controls

    hi again, i decided for to stick with the way i was outputting fonts for now, once i come to need for something different, i can add it it... my current progress now is >



    however, i have ran into a new problem, drawing custom textboxes, well i can draw the textbox but, i've no idea to allow user input... is there any tutorials for this sort of controls? thanks.

  7. #37

    DirectX GUI Controls

    Looking good!

    About the user-input. I think you should do this by catching windows messages. If you use DirectInput you'll loose some text-editing features (e.g when you are pressing the "a", only one "a" appears but if you hold it for one sec, a lot of them will be added).

    I'm not going to explain this because i haven't even done this yet, and i think you are able to figure this out yourself. You should look at WM_CHAR messages (also check MSDN for other types of windows messages that may become handy). I recall that delphi.about.com has some stuff about message handling. You might also want to take a look at that.

    Good luck!
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  8. #38

    DirectX GUI Controls

    hi thanks for reply, yes i understand how to capture the characters, but its allowing the user to click the textbox and have the beam pointer stay onto the editbox that i dont understand...

    thank again.

    -MM

  9. #39

    DirectX GUI Controls

    That shouldn't be too hard. You will need the following:

    > A way of retrieving the mouse coordinates (which i assume you allready have, because you allready made buttons).
    > A way to render a rectangle, and a cursor line (Take a look at rendering line-lists in Direct3D using D3DPT_LINELIST.)
    > You should have a routine to determine the width of a text, so you know where to put the cursor line. As i'm using my own font system, i cannot say what function you should use for it. maybe ID3DXFont has one.

    Can you describe your problem in a more specific way. I can write pages of info for you, but i don't want to do that. You must try first, and ask some more specific questions.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  10. #40

    DirectX GUI Controls

    hmm i have got to point of rendering text box and text inside, but i cant seem to find a way to get width of text, ie char count that fits inside the box etc.... if i decided to make a font/text lib.... is i loaded png file with characters, how could i change the colour of the font?

    thanks,

    -MM

Page 4 of 6 FirstFirst ... 23456 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
  •