problem with double
for some reason, my drawtext function isnt wanting to display a double...or maybe it has something to do with sprintf. here is an example of my code:
============================================================
void drawtext(char* dtstr, int dtx, int dty);
double mydouble = 0;
if(KEY_DOWN(VK_DOWN))
{
mydouble = mydouble + 0.25;
}
sprintf(buf, "mydouble: %d", mydouble);
drawtext(buf, 0, 0);
void drawtext(char* dtstr, int dtx, int dty)
{
HDC hdc;
if (lpddsback->GetDC(&hdc) == DD_OK)
{
SetBkColor(hdc, RGB(0, 0, 0));
SetTextColor(hdc, RGB(255, 255, 255));
TextOut(hdc, dtx, dty, dtstr, strlen(dtstr));
lpddsback->ReleaseDC(hdc);
}
}
===========================================================
ok, this all compiles and runs fine, but it just displays "mydouble: 0" all the time, even when you press the down arrow key. this works fine with ints, but not with double for some reason. anyone have any ideas?
==============================
whats a signature?
htm[s]l[/s]
whats a signature?
htm[s]l[/s]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement