Code:
SDL_Event mouseEvent;
if (SDL_PollEvent(&mouseEvent))
if (mouseEvent.type == SDL_MOUSEBUTTONDOWN)
if(mouseEvent.button.button == SDL_BUTTON_LEFT)
{
int xMousePosTemp = mouseEvent.button.x;
int yMousePosTemp = mouseEvent.button.y;std::stringstream sstr; sstr << xMousePosTemp; std::string xMousePosStringTemp = sstr.str(); sstr << yMousePosTemp; std::string yMousePosStringTemp = sstr.str(); const char* xMousePos = xMousePosStringTemp.c_str(); const char* yMousePos = yMousePosStringTemp.c_str(); fprintf(stderr, "(%x,%y)\n", xMousePos, yMousePos);
This is part of a larger program. The basics, is that I should click on the
screen, and the coordinates of where I clicked will be posted. Problem is,
the coordinates I’m given are completly wrong. Eg. (3e27ac,y)