Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The VeryTime,Stay informed and read the latest news today from The VeryTime, the definitive source.

How to Create Text for Direct3d C++

13
    • 1). Copy and paste the following code into the utility functions file of your Direct3d C++ project:
      void DisplaySomeText(string text)
      {
      D3DCOLOR fontColor = D3DCOLOR_ARGB(0,0,0,255);

      RECT rct;
      rct.left=2;
      rct.right=780;
      rct.top=10;
      rct.bottom=rct.top+20;

      // Draw some text
      m_font->DrawText(NULL, text, -1, &rct, 0, fontColor );
      }

    • 2). Change the "0,0,0" in the first line of the function to whatever RGB color you want the text to be displayed in. The first number stands for red, the second stands for green, and the third stands for blue. 0,0,0 is black, 255,255,255 is white, and any values in between those are valid. For example, you might choose red text which is 255,0,0 (maximum red, no green, and no blue).

    • 3). Execute the code in the function by writing its name with the text string you want to display as an argument:
      DisplaySomeText("This is the text you want to show!");

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.