void Menu::Render() { ALLEGRO_COLOR itemCol = al_map_rgb(255, 255, 255); ALLEGRO_COLOR selCol = al_map_rgb(255, 255, 0); al_clear_to_color( al_map_rgb( 64, 80, 128 ) ); for( int i = 0; i < 10; i++ ) { int a = ((i+1) / 14.0f) * 255; al_draw_filled_rectangle( ballHistory[i]->X - BALL_RADIUS, ballHistory[i]->Y - BALL_RADIUS, ballHistory[i]->X + BALL_RADIUS, ballHistory[i]->Y + BALL_RADIUS, al_map_rgba( 255, 255, 255, a ) ); } al_draw_filled_rectangle( ballPos->X - BALL_RADIUS, ballPos->Y - BALL_RADIUS, ballPos->X + BALL_RADIUS, ballPos->Y + BALL_RADIUS, al_map_rgb( 255, 255, 255 ) ); al_draw_text( titleFont, al_map_rgb( 255, 255, 255 ), FRAMEWORK->Display_GetWidth() / 2, 40, ALLEGRO_ALIGN_CENTRE, "Battle Pong" ); int yPos = FRAMEWORK->Display_GetHeight() - (itemFontHeight * 6); al_draw_text( itemFont, (selectedItem == 0 ? selCol : itemCol), 40 + (selectedItem == 0 ? itemSwayOffsets[itemSwayIndex] : 0), yPos, ALLEGRO_ALIGN_LEFT, "Battle (Local PvP)" ); yPos += itemFontHeight; al_draw_text( itemFont, (selectedItem == 1 ? selCol : itemCol), 40 + (selectedItem == 1 ? itemSwayOffsets[itemSwayIndex] : 0), yPos, ALLEGRO_ALIGN_LEFT, "Battle (Network)" ); yPos += itemFontHeight; al_draw_text( itemFont, (selectedItem == 2 ? selCol : itemCol), 40 + (selectedItem == 2 ? itemSwayOffsets[itemSwayIndex] : 0), yPos, ALLEGRO_ALIGN_LEFT, "Classic (Local PvP)" ); yPos += itemFontHeight; al_draw_text( itemFont, (selectedItem == 3 ? selCol : itemCol), 40 + (selectedItem == 3 ? itemSwayOffsets[itemSwayIndex] : 0), yPos, ALLEGRO_ALIGN_LEFT, "Settings" ); yPos += itemFontHeight; al_draw_text( itemFont, (selectedItem == 4 ? selCol : itemCol), 40 + (selectedItem == 4 ? itemSwayOffsets[itemSwayIndex] : 0), yPos, ALLEGRO_ALIGN_LEFT, "Quit" ); yPos += itemFontHeight; if( scanlinesOn ) { Shader* s = new ShaderScanlines(); s->Apply( FRAMEWORK->Display_GetCurrentTarget() ); delete s; } if( greyscaleOn ) { Shader* s = new ShaderGreyscale(); s->Apply( FRAMEWORK->Display_GetCurrentTarget() ); delete s; } }
void SettingsStage::Render() { ALLEGRO_COLOR itemColour = al_map_rgb(255, 255, 255); ALLEGRO_COLOR selectedColour = al_map_rgb(255, 255, 0); ALLEGRO_COLOR disabledColour = al_map_rgb(96, 96, 96); al_clear_to_color( al_map_rgb( 48, 64, 96 ) ); int yPos = 40 - scrollPosition; int curItem = 0; al_draw_text( titleFont, al_map_rgb( 255, 192, 96 ), FRAMEWORK->Display_GetWidth() / 2, yPos, ALLEGRO_ALIGN_CENTRE, "Video" ); yPos += titleFontHeight; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Fullscreen : Yes" ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Shader : Scanlines" ); yPos += itemFontHeight; curItem++; yPos += 20; al_draw_text( titleFont, al_map_rgb( 255, 192, 96 ), FRAMEWORK->Display_GetWidth() / 2, yPos, ALLEGRO_ALIGN_CENTRE, "Audio" ); yPos += titleFontHeight; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Music: %s", (FRAMEWORK->Settings->GetQuickBooleanValue( "Audio.Music", true ) ? "Yes" : "No") ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "SoundFX : %s", (FRAMEWORK->Settings->GetQuickBooleanValue( "Audio.SFX", true ) ? "Yes" : "No") ); yPos += itemFontHeight; curItem++; yPos += 20; al_draw_text( titleFont, al_map_rgb( 255, 192, 96 ), FRAMEWORK->Display_GetWidth() / 2, yPos, ALLEGRO_ALIGN_CENTRE, "Left Player Controls" ); yPos += titleFontHeight; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Up Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Left.Up", ALLEGRO_KEY_UP ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Down Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Left.Down", ALLEGRO_KEY_DOWN ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Send Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Left.Send", ALLEGRO_KEY_RIGHT ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 1 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Left.Inv1", ALLEGRO_KEY_Q ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 2 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Left.Inv2", ALLEGRO_KEY_A ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 3 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Left.Inv3", ALLEGRO_KEY_Z ) ) ); yPos += itemFontHeight; curItem++; yPos += 20; al_draw_text( titleFont, al_map_rgb( 255, 192, 96 ), FRAMEWORK->Display_GetWidth() / 2, yPos, ALLEGRO_ALIGN_CENTRE, "Right Player Controls" ); yPos += titleFontHeight; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Up Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Right.Up", ALLEGRO_KEY_PGUP ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Down Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Right.Down", ALLEGRO_KEY_PGDN ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Send Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Right.Send", ALLEGRO_KEY_HOME ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 1 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Right.Inv1", ALLEGRO_KEY_O ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 2 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Right.Inv2", ALLEGRO_KEY_K ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 3 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Right.Inv3", ALLEGRO_KEY_M ) ) ); yPos += itemFontHeight; curItem++; yPos += 20; al_draw_text( titleFont, al_map_rgb( 255, 192, 96 ), FRAMEWORK->Display_GetWidth() / 2, yPos, ALLEGRO_ALIGN_CENTRE, "Network Game Controls" ); yPos += titleFontHeight; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Up Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Network.Up", ALLEGRO_KEY_PGUP ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Down Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Network.Down", ALLEGRO_KEY_PGDN ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Send Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Network.Send", ALLEGRO_KEY_HOME ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 1 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Network.Inv1", ALLEGRO_KEY_O ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 2 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Network.Inv2", ALLEGRO_KEY_K ) ) ); yPos += itemFontHeight; curItem++; al_draw_textf( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Inventory 3 Key : %s", al_keycode_to_name( FRAMEWORK->Settings->GetQuickIntegerValue( "Network.Inv3", ALLEGRO_KEY_M ) ) ); yPos += itemFontHeight; curItem++; yPos += 20; al_draw_text( titleFont, al_map_rgb( 255, 192, 96 ), FRAMEWORK->Display_GetWidth() / 2, yPos, ALLEGRO_ALIGN_CENTRE, "Other" ); yPos += titleFontHeight; al_draw_text( itemFont, (selectedItem == curItem ? selectedColour : itemColour), 40, yPos, ALLEGRO_ALIGN_LEFT, "Return" ); yPos += itemFontHeight; curItem++; Shader* s = new ShaderScanlines(); s->Apply( FRAMEWORK->Display_GetCurrentTarget() ); delete s; }