Search found 6 matches

by Zervox
Sat Apr 17, 2010 5:16 pm
Forum: Project Announcements
Topic: TrollBrad [Free][RPG+RTS][WIP][TECHDEMO]
Replies: 35
Views: 16143

Had about 130 fps 127 minimum on a fairly high end pc
Q6600@2.9Ghz, HD5850 8GB mem windows 7 64bit

Good job by the way, I like the units :lol:
by Zervox
Sun Apr 04, 2010 10:33 am
Forum: Beginners Help
Topic: Newbie std::string problem, printing wrong info:S
Replies: 9
Views: 2045

Ok, so I partially solved my old way with a workaround



std::string units = itoa(numUnits, num, 10) + std::string(" | ");
// + itoa(unitLimit, num, 10);
fontMoney->DrawText(NULL, units.c_str(), -1, &rc[1], DT_LEFT| DT_TOP | DT_NOCLIP, 0xff000000);

std::string unitsmax = itoa(unitLimit, num, 10 ...
by Zervox
Sun Apr 04, 2010 10:06 am
Forum: Beginners Help
Topic: Newbie std::string problem, printing wrong info:S
Replies: 9
Views: 2045

I'd recommend using string streams for things like this.

#include <sstream>

int numUnits = 0;
int unitLimit = 15;

std::stringstream ss;
ss << numUnits;
ss << " | ";
ss << numLimit;

std::cout << ss.str() << std::endl;


edit: made the example more clear, I would not recommend Mel's example ...
by Zervox
Sun Apr 04, 2010 6:25 am
Forum: Beginners Help
Topic: Newbie std::string problem, printing wrong info:S
Replies: 9
Views: 2045

yeah, fixed iostream straight after I posted now it doesnt complain but it doesnt show anything either
by Zervox
Sun Apr 04, 2010 5:38 am
Forum: Beginners Help
Topic: Newbie std::string problem, printing wrong info:S
Replies: 9
Views: 2045

I am not so experienced in programming but the unitLimit is defined as
unitLimit = 15;
and the numUnits is updated for every single unit on my map.
added the rest of code affecting looks.


char num[10];
itoa((int)(money * 10), num, 10);
RECT rc[] = {{80, 2, 0, 0}, {162, 2, 0, 0}};
fontMoney ...
by Zervox
Sat Apr 03, 2010 4:37 pm
Forum: Beginners Help
Topic: Newbie std::string problem, printing wrong info:S
Replies: 9
Views: 2045

Newbie std::string problem, printing wrong info:S

:oops: basically I am trying to print to different numbers together, where numUnits is having my current amount of object/units, and unitLimit is the max

std::string u = itoa(numUnits, num, 10) + std::string(" | ") + itoa(unitLimit, num, 10);

Problem is that, it gets the current amount correct and ...