thebuzzards
June 14th, 2009, 05:50 AM
Hey, i was trying to create a menu using sprites, when its selected.. Changes the sprite.
Which works well.
Its just that, i dont know how to implement i into the function, because obviously it keeps repeating itsself at 1 each time the function loops.
This way of doing it may seem terribly simple, but it was all written by myself.
If you could suggest otherways of accheiving the same effect. i'd love to hear it ^_^
thanks.
void drawMenu(void){
d3dspt->Begin(D3DXSPRITE_ALPHABLEND);
int i = 1;
D3DXVECTOR3 center(0.0f,0.0f,0.0f), position(30.0f,450.0f,0.0f);
D3DXVECTOR3 center1(0.0f,0.0f,0.0f), position1(30.0f,400.0f,0.0f);
d3dspt->Draw(newgame1, NULL, ¢er1, &position1, D3DCOLOR_ARGB(255, 255, 255, 255));
d3dspt->Draw(credits1, NULL, ¢er, &position, D3DCOLOR_ARGB(255, 255, 255, 255));
if(KEY_DOWN(VK_UP)){
i--;
}
if(KEY_DOWN(VK_DOWN)){
i++;
}
if (i <0){
i = 1;
}
if (i >1){
i = 0;
}
switch (i){
case 0:
d3dspt->Draw(newgame2, NULL, ¢er1, &position1, D3DCOLOR_ARGB(255, 255, 255, 255));
break;
case 1:
d3dspt->Draw(credits2, NULL, ¢er, &position, D3DCOLOR_ARGB(255, 255, 255, 255));
break;
}
d3dspt->End();
return;
}
Which works well.
Its just that, i dont know how to implement i into the function, because obviously it keeps repeating itsself at 1 each time the function loops.
This way of doing it may seem terribly simple, but it was all written by myself.
If you could suggest otherways of accheiving the same effect. i'd love to hear it ^_^
thanks.
void drawMenu(void){
d3dspt->Begin(D3DXSPRITE_ALPHABLEND);
int i = 1;
D3DXVECTOR3 center(0.0f,0.0f,0.0f), position(30.0f,450.0f,0.0f);
D3DXVECTOR3 center1(0.0f,0.0f,0.0f), position1(30.0f,400.0f,0.0f);
d3dspt->Draw(newgame1, NULL, ¢er1, &position1, D3DCOLOR_ARGB(255, 255, 255, 255));
d3dspt->Draw(credits1, NULL, ¢er, &position, D3DCOLOR_ARGB(255, 255, 255, 255));
if(KEY_DOWN(VK_UP)){
i--;
}
if(KEY_DOWN(VK_DOWN)){
i++;
}
if (i <0){
i = 1;
}
if (i >1){
i = 0;
}
switch (i){
case 0:
d3dspt->Draw(newgame2, NULL, ¢er1, &position1, D3DCOLOR_ARGB(255, 255, 255, 255));
break;
case 1:
d3dspt->Draw(credits2, NULL, ¢er, &position, D3DCOLOR_ARGB(255, 255, 255, 255));
break;
}
d3dspt->End();
return;
}