1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
int n = 0;
int s = 0;
int smenu = 0;
menubuffer = create_bitmap (WIDTH, HEIGHT);
while (!key[KEY_ESC])
{
//navigation through main menu
if (key[KEY_DOWN] && smenu == 0)
{
n++;
if(n>3)
n=1;
rest(100);
}
else if (key[KEY_UP] && smenu == 0)
{
n--;
if(n<1)
n=3;
rest(100);
}
if (key[KEY_ENTER] && n == 3)
{
smenu = 1;
}
clear(menubuffer);
draw_sprite(menubuffer,pause[n],50,50);
//navigation through sub menu
if( smenu == 1)
{
if (key[KEY_DOWN] )
{
s++;
if(s>4)
s=0;
rest(100);
}
else if (key[KEY_UP] )
{
s--;
if(s<0)
s=4;
rest(100);
}
rest(100);
}
int accu = 10 - int(player->accuracy);
draw_sprite(menubuffer,skillmenu[s],WIDTH/2-200,50);
//draw meters for players stats
textprintf(menubuffer, font, WIDTH/2-50, 100, makecol(255,0,0), "Skill Points Remaining: %d",player->skillpoints);
rectfill(menubuffer, WIDTH/2-40, 225, WIDTH/2 - 40 + 25*(player->speedskill-3),250, makecol(255,0,0));
textprintf(menubuffer, font, WIDTH/2-50, 228, makecol(255,0,0), "%d",player->speedskill);
rectfill(menubuffer, WIDTH/2-40, 325, WIDTH/2 - 40 + 25*(player->enduranceskill - 10),350, makecol(255,0,0));
textprintf(menubuffer, font, WIDTH/2-50, 328, makecol(255,0,0), "%d",player->enduranceskill);
rectfill(menubuffer, WIDTH/2-40, 425, WIDTH/2 - 40 + 25*(accu),450, makecol(255,0,0));
textprintf(menubuffer, font, WIDTH/2-50, 428, makecol(255,0,0), "%d",accu);
rectfill(menubuffer, WIDTH/2-40, 525, WIDTH/2 - 40 + 25*(player->sprint - 10),550, makecol(255,0,0));
textprintf(menubuffer, font, WIDTH/2-50, 528, makecol(255,0,0), "%d",player->sprint);
}
stretch_sprite(menubuffer, player_image[0], 100, 125, 150, 192);
vsync();
acquire_screen();
blit(menubuffer, screen, 0, 0, 0, 0, WIDTH-1, HEIGHT-1);
release_screen();
}
destroy_bitmap(menubuffer);
rest(100);
|