How did you end up handling the duplicate card problem?
Do tell, maybe your way was better.
Do you pre randomize the deck or loop per card until random gives something usable.
blackjack
true, false, maybe, probably_not
I am working on having the mouse click and drag the betting chips. Here is the code I am using so far.
bool quit = false;
while( quit == false )
{
while( SDL_PollEvent( &e ) )
{
if( e.type == SDL_QUIT )
quit = true;
if (e.type == SDL_MOUSEBUTTONDOWN||SDL_MOUSEMOTION)
{
if (e.button.button == SDL_BUTTON_LEFT)
{
SDL_GetMouseState(&x, &y);
if (x >= 830 && x <= 870 && y >= 600 && y <= 640)
{
SDL_Rect rect_seven;
rect_seven.x = x;
rect_seven.y = y;
SDL_BlitSurface(gHelloWorld_orange, NULL, gScreenSurface, &rect_seven);
cout << x << " " << y << endl;
SDL_UpdateWindowSurface(gWindow);
}
}
}
pbivens67 said:
if (e.type == SDL_MOUSEBUTTONDOWN||SDL_MOUSEMOTION)
Not sure what you think this is doing, but it looks quite wrong. Why do you have a constant as second condition ?
I have got the mouse to drag a betting chip around the screen but it does so by writing over the background images. I just want it to drag from the pile of chips to the center of the screen. here is the code I am working on.
SDL_Rect rect_seven = { objectX, objectY, objectWidth, objectHeight };
SDL_FillRect(gScreenSurface, &rect_seven,0x007000);
SDL_BlitSurface(gHelloWorld_orange, NULL, gScreenSurface, &rect_seven);
SDL_UpdateWindowSurface(gWindow);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement