Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 51

Thread: DirectX GUI Controls

  1. #41

    DirectX GUI Controls

    that's very easy. When your image with the chars is grayscale (background black and chars white), you can use the diffuse color of your vertices to give the characters a color.

    I advice you to study clooties font code. If you don't understand things, use google to find out what they are about. I'm sure it will give you a good idea on how font rendering works.

    If you happen to use ID3DXFont, i can tell you that there is a way to determine the text size. You have to call ID3DXFont:rawText with the DT_CALCRECT flag. It will not render anything, but instead it gives you the rectangle that will be occupied when rendering the text. Look at the following link for more info:


    http://msdn2.microsoft.com/en-us/library/bb173962.aspx
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #42

    DirectX GUI Controls

    hi, i came to thank you again for help etc, i have now come a far way with my gui system and it works superb, few improvements i can still make in the future, now i have written my gui engine, i'd like to start on some platform engine to get the hang of this next...

    i didnt think there was no point to open a new thread for this 1 question:

    is there any examples of 2d platform games, using sprites etc, ie, screen follows the player on a map.

    *edit* or v.good tutorial that you can recommend

    thanks in advance

    -MM

  3. #43

    DirectX GUI Controls

    I'm glad to hear that everything's running smooth.

    As for the tutorials, i would suggest these:

    http://www.gameprogrammer.net/index....tutorials.list
    http://www.cerebral-bicycle.co.uk/li...?cat=24&subj=5

    I think you should take a look at DelphiX (and maybe some other populair game libraries). There are a lot of delphix tutorials available who show how to deal with sprites. I learned a great deal by studying those sources.

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

  4. #44

    DirectX GUI Controls

    hi, thanks for reply, they seemed a bit odd tbh lol, more based on tile based games, however what im thinking of doing is....

    lets say i do same as drawing a a 2d virtual window again... but only it will be a quad textured with some stone or something, and many other shapes.... a question i have is.... is there some specific api i can use for camera on a 2d platformer, or do i move the quads and draw them in place..

    so its not really the character moving on screen, its the rest of the 2d world ?

    thanks in advance.

  5. #45

    DirectX GUI Controls

    is there some specific api i can use for camera on a 2d platformer
    nope.. but it's not that hard.

    I would setup my camera at a fixed point and move the whole scene when the character is walking. But it doens't really matter.. i think both ways would work. If you have some knowledge about vectors you will be able to fix this.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #46

    DirectX GUI Controls

    yes thanks, i have idea of where to start, i jus didnt want to go ahead in case i was wasting my time, thanks again

    -MM

  7. #47

    DirectX GUI Controls

    i seem to find this alot in samples

    Code:
        D3DXMATRIX matProj;
        D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ), SCREEN_WIDTH / SCREEN_HEIGHT, 0.1f, 100.0f );
        g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
    but i dont understand what this is for, is there any straight forward explanations for this and what its use is for, from what i see, it is some help for moving the scene? seems most calls to move change maxtrix perspectives, but still dont get it tbh,

    thanks,

  8. #48

    DirectX GUI Controls

    Did you look on MSDN?? Documentation on this can be found there.

    What i remember about D3DXMatrixPerspectiveFovLH:

    First parameter is the destenation matrix (result of the routine).
    Second parameter is the field of view in radians (i would use 90 degrees or 0.5 * Pi radians).
    Third parameter is the aspect ratio, and the fourth and fifth are the z value's for the near and far plane (minimum and maximum visible Z coords).

    If you want to make a 2d game, i would advice you to use D3DXMatrixOrthoLH instead. Your sprites will look the same, regardless of their z-values, so you have perfect control over the position, dimentions and depth of your sprites.

    About your question about moving the scene. You are looking at the wrong piece of code. Take a look at this routine. It allows you to setup a camera and point it somewhere. The resulting matrix should be set using SetTransform(D3DTS_VIEW, myViewMatrix).

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

  9. #49

    DirectX GUI Controls

    hi thanks, ok i've read up a bit on that, atm my map is made up of sprites, such as walls, land surface etc, before drawing the sprites they all have an offset like so:

    Code:
      iLeft := F_Left - F_Res.Player.MapPosX;
      iTop := F_Top - F_Res.Player.MapPosY;
    then ileft, itop is used as the position, f_left is actual position... would it be better to use current method or to get into using the different procedures?

    baring in mind, my plan was to calculate the offscreen distance, if offset then skip rendering that specific sprite etc, would i still be able todo that with the matrix procs?

  10. #50

    DirectX GUI Controls

    would it be better to use current method or to get into using the different procedures?
    I'm not sure what you mean. I think you should try it, and find out what works for you instead of just asking it. Please only ask something when you are really stuck, without any clue how to fix the problem. Looking at sources will give you a lot of answers and when you are somewhat more experienced, you will be able to make your own choices based on your experience. That's way better then just asking and nitpicking about every issue you stumble upon (no offence though).

    baring in mind, my plan was to calculate the offscreen distance, if offset then skip rendering that specific sprite etc, would i still be able todo that with the matrix procs?
    I'm not sure what you mean here, but AFAIK it's all possible with matrices. You can draw your sprite everywhere on the screen with every scale and angle you want.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Page 5 of 6 FirstFirst ... 3456 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
  •