本文整理汇总了C++中Shader::Apply方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::Apply方法的具体用法?C++ Shader::Apply怎么用?C++ Shader::Apply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::Apply方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
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;
}
}
示例2: Render
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;
}