Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5715 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok hears the story. Im making a war game for me and my brothers and i need some help. You enter the main window and its got a window with a menu and then the word Money. Now what i need to do is this. I need a varible called Money whitch i can add and substract to and from. Eg Money - 200 Build some tanks Money - 500 I tried using this int Money; hdc = GetDC(hwnd); //Set the colors TextOut(hdc,SCREENWIDTH/2,30,"Money - ",strlen("Money - ")); TextOut(hdc,SCREENWIDTH/2+3,30,Money,strlen(Money)); It says cannot convert int to const char or something any one help me out ? Thanks in advance

Share this post

Link to post
Share on other sites

TextOut writes TEXT to the screen, Money is an integer. You have to convert Money into a string first. atoi() works for that or you could get the whole thing done using sprintf and one call to TextOut.

char buffer[32];

sprintf( buffer, "Money - %d", Money );

1 call to TextOut without having to fiddle with making sure the words and numbers line up.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!