Advertisement

win 32 pong

Started by July 01, 2019 09:49 PM
40 comments, last by phil67rpg 5 years, 5 months ago

code or it didn't happen. 

Dev careful. Pixel on board.

here is my code


comp_move += 0.1f * comp_velocity;	

if(comp_move <= (0.0f)) 
{ 
  comp_velocity = 1.0f; 
}
if(comp_move >= (730.0f)) 
{ 
  comp_velocity = -1.0f; 
}

 

Advertisement

I'm a little insulted, but that's fine. What I was hoping for was your current over all source to see where you really are with this so far. 

Dev careful. Pixel on board.

23 minutes ago, GoliathForge said:

What I was hoping for was your current over all source to see where you really are with this so far. 

He said he solved his problem. What's with this 'where you really are with this so far' business?

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

Sure, why not...you're right. Let it be what it is. Thank you. 

 

"Usually somewhere in the bottom of main" <-- LOL

Dev careful. Pixel on board.

I am trying to draw two different sprites. it is only drawing one type of sprite. sorry but I solved my problem.


void DrawBitmap(char *filename, int x, int y)
{
    //load the bitmap image
    HBITMAP image = (HBITMAP)LoadImage(0,"paddle.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
    HBITMAP image_one = (HBITMAP)LoadImage(0,"red.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

    //read the bitmap's properties
    BITMAP bm;
    BITMAP bm_one;
    GetObject(image, sizeof(BITMAP), &bm);
    GetObject(image_one, sizeof(BITMAP), &bm_one);

    //create a device context for the bitmap
    HDC hdcImage = CreateCompatibleDC(device);
    HDC hdcImage_one = CreateCompatibleDC(device);
    SelectObject(hdcImage, image);
    SelectObject(hdcImage_one, image_one);

    //draw the bitmap to the window (bit block transfer)
    BitBlt( 
        device,                  //destination device context
        x, y,                    //x,y location on destination
        bm.bmWidth, bm.bmHeight, //width,height of source bitmap
        hdcImage,                  //source bitmap device context
        0, 0,                    //start x,y on source bitmap
        SRCCOPY);                //blit method
    BitBlt( 
        device,                  //destination device context
        x, y,                    //x,y location on destination
        bm_one.bmWidth, bm_one.bmHeight, //width,height of source bitmap
        hdcImage_one,                  //source bitmap device context
        0, 0,                    //start x,y on source bitmap
        SRCCOPY);                //blit method

    //delete the device context and bitmap
    DeleteDC(hdcImage);
    DeleteDC(hdcImage_one);
    DeleteObject((HBITMAP)image);
    DeleteObject((HBITMAP)image_one);
}

 

Advertisement
55 minutes ago, GoliathForge said:

"Usually somewhere in the bottom of main" <-- LOL

I have to ask what is so laugh out loud about that?

And if you're quoting me, I said...

On 7/2/2019 at 6:24 PM, fleabay said:

For simple games in C++ it is near the bottom of main()

 

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

here is a screen shot for my breakout game 

https://imgur.com/RLGjWdS

 

 

2 hours ago, fleabay said:

He said he solved his problem. What's with this 'where you really are with this so far' business?

As an aside, in his entire 10+ year history of trolling this site, Phil has never once actually really solved his problem when he says he has.

This topic is closed to new replies.

Advertisement