Equivalent to nullptr

Leonardo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 3 19:12:13 PDT 2017


I was trying to use Derelict-SDL2 library, and the tutorial do 
this code below, as C++ code has nullptr word. How I use this?


---------------------------------
struct Ball
{
   SDL_Rect bbox = {0, 0, 100, 100};
   SDL_Point vel = {1, 1};
}
---------------------------------
case SDL_MOUSEBUTTONDOWN:
{
   SDL_Point mousePos = {event.button.x, event.button.y};
   if(event.button.button == SDL_BUTTON_LEFT && 
SDL_EnclosePoints(&mousePos, 1, &ball.bbox, nullptr) )
   {
     SDL_Log("CLICK");
     if(abs(ball.vel.x) < 32)
     {
       ball.vel.x *= 2;
       ball.vel.y *= 2;
     }
   }
   break;
}


More information about the Digitalmars-d-learn mailing list