Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

breakout collision detection

This topic is 2505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

well I am trying to fihish up my breakout game using dx9 and c++.well my collision detection between the ball and brick works fine except for the first brick where the ball glides across the bottom of the brick.this is a subtle error that I need help on.here is my code for collision detection.
[source lang = "c++"]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]int[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] index=0;[/font][/font]
[font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]//-------------------------[/font][/font][/font]
[font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]// Render the sprite[/font][/font][/font]
[font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]//[/font][/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]SPRITE sprite1;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]SPRITE sprite2;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite1.x=posX;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite1.y=posY;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite1.width = 10.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite1.height = 10.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.x=0.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.y=200.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.width = 160.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.height = 40.0f;[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](Sprite_Collide(&sprite1,&sprite2)==1)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]index=1;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]} [/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.x=160.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.y=200.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.width = 160.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.height = 40.0f;[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](Sprite_Collide(&sprite1,&sprite2)==1)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]index=2;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]} [/font][/font]

[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.x=320.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.y=200.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.width = 160.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.height = 40.0f;[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](Sprite_Collide(&sprite1,&sprite2)==1)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]index=3;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]} [/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.x=480.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.y=200.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.width = 160.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.height = 40.0f;[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](Sprite_Collide(&sprite1,&sprite2)==1)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]index=4;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]} [/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.x=640.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.y=200.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.width = 160.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]sprite2.height = 40.0f;[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](Sprite_Collide(&sprite1,&sprite2)==1)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]index=5;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]} [/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"][/source][/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]?[/font][/font]

Share this post


Link to post
Share on other sites
Advertisement
The content of your code has nothing to cause the error. It must be somewhere else.

Have you tried debugging the code when it happens to check the runtime values of index, yVel and sprite1 positions ? Also you haven't mentioned how yVel and index are used in your code.

Since the ball is sliding along the bottom of the brick, the problem seems to lie where you are adjusting the y velocity and y position of sprite1. The value is probably becoming 0 for some reason. I will need more code to be more specific.

Share this post


Link to post
Share on other sites
here is some more code
[source lang = "c++"]
[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_ball = D3DXVECTOR3(posX,posY,0);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]posX += xVel;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]posY += yVel;[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](posX <= 10.0f)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]posX=10.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]xVel = 0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]else[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](posX >= 790.0f)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]posX=790.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]xVel =-0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](posY <= 10.0f)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]posY=10.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]else[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](posY >= 590.0f)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]posY=590.0f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=-0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_upper = D3DXVECTOR3(j,0,0);[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](bAdd)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]j+=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]else[/font][/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]j-=0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](j>=640) [/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]bAdd = [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]false[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"];[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]

[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]else[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](j<=0)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]bAdd = [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]true[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"];[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]for[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"]([/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]float[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] i=0; i<=640; i+=160)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]

[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_brickone = D3DXVECTOR3(i,120,0);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_bricktwo = D3DXVECTOR3(i,160,0);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_brickthree = D3DXVECTOR3(i,200,0);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_lower = D3DXVECTOR3(320,560,0);[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] (g_pD3DXSprite && g_pTexture)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](index==1)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]yVel=-0.25f;[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_brickfour = D3DXVECTOR3(0,200,0);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Begin( D3DXSPRITE_ALPHABLEND );[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Draw(g_pTexture, NULL, NULL, &vecPos_upper, 0xffffffff);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Draw(g_pTexture, NULL, NULL, &vecPos_lower, 0xffffffff);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Draw(g_pTexture_two, NULL, NULL, &vecPos_brickone, 0xffffffff);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Draw(g_pTexture_three, NULL, NULL, &vecPos_bricktwo, 0xffffffff);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Draw(g_pTexture_four, NULL, NULL, &vecPos_brickthree, 0xffffffff);[/font][/font]
[font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]// g_pD3DXSprite->Draw(g_pTexture_five, NULL, NULL, &vecPos_brickfour, 0xffffffff);[/font][/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Draw(g_pTexture_ball, NULL, NULL, &vecPos_ball, 0xffffffff);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->End();[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]

[font="Consolas"][size="2"][font="Consolas"][size="2"]} [/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DDevice->EndScene();[/font][/font]

[font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]// Frame buffer to Front buffer[/font][/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DDevice->Present( NULL, NULL, NULL, NULL );[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"][/source][/font][/font]

Share this post


Link to post
Share on other sites
well after minor tweak I fixed the problem,now I need to work on having the brick disappear when it is hit with the ball, I also need to move the bottom paddle with the keyboard.

Share this post


Link to post
Share on other sites
her is the code I am working on
[source lang = "c++"]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]case[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] VK_RIGHT:[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0 );[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DDevice->BeginScene();[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]D3DXVECTOR3 vecPos_lower = D3DXVECTOR3(320+m,560,0);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]m++;[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] (g_pD3DXSprite && g_pTexture)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Begin( D3DXSPRITE_ALPHABLEND );[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->Draw(g_pTexture, NULL, NULL, &vecPos_lower, 0xffffffff);[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DXSprite->End();[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DDevice->EndScene();[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]g_pD3DDevice->Present( NULL, NULL, NULL, NULL );[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]break[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"];[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"][/source][/font][/font]

Share this post


Link to post
Share on other sites
Hidden

well after minor tweak I fixed the problem,now I need to work on having the brick disappear when it is hit with the ball, I also need to move the bottom paddle with the keyboard.


her is the code I am working on
case VK_RIGHT:
g_pD3DDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0 );
g_pD3DDevice->BeginScene();
D3DXVECTOR3 vecPos_lower = D3DXVECTOR3(320+m,560,0);
m++;
if (g_pD3DXSprite && g_pTexture)
{
g_pD3DXSprite->Begin( D3DXSPRITE_ALPHABLEND );
g_pD3DXSprite->Draw(g_pTexture, NULL, NULL, &vecPos_lower, 0xffffffff);
g_pD3DXSprite->End();
}
g_pD3DDevice->EndScene();
g_pD3DDevice->Present( NULL, NULL, NULL, NULL );
break;



http://www.gamedev.net/topic/618400-rendering-bullets-in-asteroids-game/page__p__490186:

Swap buffers only once after you have drawn everything. Don't do it for every bullet, makes no sense.


Assisnator's code should hint that for each frame, you should clear the buffer before drawing, and present the buffer after drawing. Your code and the problems you're describing suggest you are mixing quite a few of these within drawing a scene.


Not sure if trolling or ...

Share this post


Link to post
What exactly are you trying to achieve here ?

Also why do you have a BeginScene() / EndScene() / Present() block inside a switch case ? It should have been abstracted in the display portion of the code. The processing part of the game should be kept separate from the render part and having a mish-mash of those stuff will lead to messy, buggy and slow code.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!