本文整理汇总了C++中Fade函数的典型用法代码示例。如果您正苦于以下问题:C++ Fade函数的具体用法?C++ Fade怎么用?C++ Fade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fade函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: noise
double noise(double x, double y, double z) const
{
const std::int32_t X = static_cast<std::int32_t>(std::floor(x)) & 255;
const std::int32_t Y = static_cast<std::int32_t>(std::floor(y)) & 255;
const std::int32_t Z = static_cast<std::int32_t>(std::floor(z)) & 255;
x -= std::floor(x);
y -= std::floor(y);
z -= std::floor(z);
const double u = Fade(x);
const double v = Fade(y);
const double w = Fade(z);
const std::int32_t A = p[X] + Y, AA = p[A] + Z, AB = p[A + 1] + Z;
const std::int32_t B = p[X + 1] + Y, BA = p[B] + Z, BB = p[B + 1] + Z;
return Lerp(w, Lerp(v, Lerp(u, Grad(p[AA], x, y, z),
Grad(p[BA], x - 1, y, z)),
Lerp(u, Grad(p[AB], x, y - 1, z),
Grad(p[BB], x - 1, y - 1, z))),
Lerp(v, Lerp(u, Grad(p[AA + 1], x, y, z - 1),
Grad(p[BA + 1], x - 1, y, z - 1)),
Lerp(u, Grad(p[AB + 1], x, y - 1, z - 1),
Grad(p[BB + 1], x - 1, y - 1, z - 1))));
}
示例2: floor
float CPerlinNoise::Noise3( float x, float y, float z )
{
vector<int32_t>& p = m_PermutationTbl;
int X = (int)floor(x) & 255, /* FIND UNIT CUBE THAT */
Y = (int)floor(y) & 255, /* CONTAINS POINT. */
Z = (int)floor(z) & 255;
x -= floor(x); /* FIND RELATIVE X,Y,Z */
y -= floor(y); /* OF POINT IN CUBE. */
z -= floor(z);
float u = Fade(x), /* COMPUTE FADE CURVES */
v = Fade(y), /* FOR EACH OF X,Y,Z. */
w = Fade(z);
int A = p[X]+Y,
AA = p[A]+Z,
AB = p[A+1]+Z, /* HASH COORDINATES OF */
B = p[X+1]+Y,
BA = p[B]+Z,
BB = p[B+1]+Z; /* THE 8 CUBE CORNERS, */
return BasicMath::Lerp(w,BasicMath::Lerp(v,BasicMath::Lerp(u, Grad(p[AA ], x, y, z), /* AND ADD */
Grad(p[BA ], x-1, y, z)), /* BLENDED */
BasicMath::Lerp(u, Grad(p[AB ], x, y-1, z), /* RESULTS */
Grad(p[BB ], x-1, y-1, z))), /* FROM 8 */
BasicMath::Lerp(v, BasicMath::Lerp(u, Grad(p[AA+1], x, y, z-1 ),/* CORNERS */
Grad(p[BA+1], x-1, y, z-1)), /* OF CUBE */
BasicMath::Lerp(u, Grad(p[AB+1], x, y-1, z-1),
Grad(p[BB+1], x-1, y-1, z-1))));
}
示例3: switch
BOOL CDrawGraphics::DelChar(int Position,int FadeOr)
{
//キャラ非表示
switch(Position){
case PosL:
if(FadeOr==0)Fade(CharL,FadeOut);
//CharL->SetChar(g_lpD3DDevice,IDR_INV);
CharL->Destroy(g_lpD3DDevice,PosL);
break;
case PosC:
if(FadeOr==0)Fade(CharC,FadeOut);
//CharC->SetChar(g_lpD3DDevice,IDR_INV);
CharC->Destroy(g_lpD3DDevice,PosC);
break;
case PosR:
if(FadeOr==0)Fade(CharR,FadeOut);
//CharR->SetChar(g_lpD3DDevice,IDR_INV);
CharR->Destroy(g_lpD3DDevice,PosR);
break;
case PosBG:
if(FadeOr==0)Fade(Haikei,FadeOut);
Haikei->Destroy(g_lpD3DDevice,PosBG);
break;
default:
return FALSE;
}
return 0;
}
示例4: DrawTitleScreen
// Title Screen Draw logic
void DrawTitleScreen(void)
{
// TODO: Draw TITLE screen here!
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);
//DrawTextureEx(titleTexture, (Vector2){GetScreenWidth()/2-titleTexture.width/2, GetScreenHeight()/2-titleTexture.height/2}, 0, 1, Fade(WHITE, titleAlpha));
DrawRectangle(GetScreenWidth()/2-200, GetScreenHeight()/2-100, 400, 150, Fade(YELLOW, titleAlpha));
DrawText("PRESS <ENTER> to START the GAME", 208, GetScreenHeight()-75, 20, Fade(BLACK, startTextAlpha));
}
示例5: DrawEndingScreen
// Ending Screen Draw logic
void DrawEndingScreen(void)
{
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), DARKGRAY);
DrawTextEx(font, "CONGRATULATIONS!", (Vector2){ 50, 160 }, font.baseSize*3, 2, Fade(WHITE, alpha));
DrawTextEx(font, "SKULLY ESCAPED!", (Vector2){ 100, 300 }, font.baseSize*3, 2, Fade(WHITE, alpha));
if ((framesCounter > 180) && ((framesCounter/40)%2)) DrawText("PRESS ENTER or CLICK", 380, 545, 40, BLACK);
}
示例6: DrawAisle01Screen
// Gameplay Screen Draw logic
void DrawAisle01Screen(void)
{
DrawTexture(background, -scroll, 0, WHITE);
// Draw monsters
DrawMonster(lamp, scroll);
DrawMonster(picture, scroll);
// Draw door
Vector2 doorScrollPos = { doorCenter.position.x - scroll, doorCenter.position.y };
if (doorCenter.selected) DrawTextureRec(doors, doorCenter.frameRec, doorScrollPos, GREEN);
else DrawTextureRec(doors, doorCenter.frameRec, doorScrollPos, WHITE);
doorScrollPos = (Vector2){ doorLeft.position.x - scroll, doorLeft.position.y };
if (doorLeft.selected) DrawTextureRec(doors, doorLeft.frameRec, doorScrollPos, GREEN);
else DrawTextureRec(doors, doorLeft.frameRec, doorScrollPos, WHITE);
doorScrollPos = (Vector2){ doorRight.position.x - scroll, doorRight.position.y };
if (doorRight.selected) DrawTextureRec(doors, doorRight.frameRec, doorScrollPos, GREEN);
else DrawTextureRec(doors, doorRight.frameRec, doorScrollPos, WHITE);
// Draw messsages
if (msgState < 2) DrawRectangle(0, 40, GetScreenWidth(), 200, Fade(LIGHTGRAY, 0.5f));
else if (msgState == 2) DrawRectangle(0, 80, GetScreenWidth(), 100, Fade(LIGHTGRAY, 0.5f));
if (msgState == 0)
{
DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
else if (msgState == 2)
{
if ((msgCounter/30)%2)
{
DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(lamp.bounds, Fade(RED, 0.6f));
DrawRectangleRec(picture.bounds, Fade(RED, 0.6f));
}
}
else
{
if ((monsterHover) && ((msgCounter/30)%2))
{
DrawRectangle(0, 0, GetScreenWidth(), 50, Fade(LIGHTGRAY, 0.5f));
DrawText("PRESS SPACE or CLICK to INTERACT", 420, 15, 20, BLACK);
}
}
DrawPlayer(); // NOTE: Also draws mouse pointer!
}
示例7: Animate
void GameEntityWhiteScreen::Animate(float delay) {
GameEntity::Animate(delay);
float fade=Fade();
sprite.setColor(sf::Color(255, 255, 255, 255 * fade));
}
示例8: Sound_Fade
void WrapperDLL::Sound_Fade(void* self,int32_t id,float second,float targetedVolume){
auto self_ = (Sound*)self;
auto arg0 = id;
auto arg1 = second;
auto arg2 = targetedVolume;
self_->Fade(arg0,arg1,arg2);
};
示例9: Fade
void CPartSnowFlake::Think( float flTime )
{
if( m_flBrightness < 130.0 && !m_bTouched )
m_flBrightness += 4.5;
Fade( flTime );
Spin( flTime );
if( m_flSpiralTime <= gEngfuncs.GetClientTime() )
{
m_bSpiral = !m_bSpiral;
m_flSpiralTime = gEngfuncs.GetClientTime() + UTIL_RandomLong( 2, 4 );
}
else
{
}
if( m_bSpiral && !m_bTouched )
{
const float flDelta = flTime - g_Environment.GetOldTime();
const float flSpin = sin( flTime * 5.0 + reinterpret_cast<int>( this ) );
m_vOrigin = m_vOrigin + m_vVelocity * flDelta;
m_vOrigin.x += ( flSpin * flSpin ) * 0.3;
}
else
{
CalculateVelocity( flTime );
}
CheckCollision( flTime );
}
示例10: Fade
/*
================
idLight::FadeIn
================
*/
void idLight::FadeIn( float time ) {
idVec3 color;
idVec4 color4;
currentLevel = levels;
spawnArgs.GetVector( "_color", "1 1 1", color );
color4.Set( color.x, color.y, color.z, 1.0f );
Fade( color4, time );
}
示例11: Fade
void UIPicButton::NotifyTimer (unsigned int wParam)
{
if (g_bUsefade == true) {
if (wParam == TMR_FADE+g_controlID) {
Fade ();
}
}
}
示例12: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");
const char textLine1[] = "Lena image is a standard test image which has been in use since 1973.";
const char textLine2[] = "It comprises 512x512 pixels, and it is probably the most widely used";
const char textLine3[] = "test image for all sorts of image processing algorithms.";
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/lena.png"); // Texture loading
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
Vector2 position = { 369, 241 };
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("LENA", 220, 100, 20, PINK);
DrawTexture(texture, screenWidth/2 - 256, 0, Fade(WHITE, 0.1f)); // Draw background image
DrawTextureRec(texture, eyesRec, position, WHITE); // Draw eyes part of image
DrawText(textLine1, 220, 140, 10, DARKGRAY);
DrawText(textLine2, 220, 160, 10, DARKGRAY);
DrawText(textLine3, 220, 180, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
示例13: main
void main(void) {
byte pattern=0;
initSquareWear();
initBlink();
// open button interrupt
openOnBoardButtonInterrupt(button_callback);
while(1) {
switch(pattern) {
case 0:
Blink(500); // blink at 500ms interval
break;
case 1:
Blink(250); // blink at 250ms interval
break;
case 2:
Blink(1000); // blink at 100ms interval
break;
case 3:
Fade(15); // fade at 50ms interval
break;
case 4:
Fade(50); // fade at 1ms interval
break;
case 5:
Fade(4); // fade at 2ms interval
break;
}
if(change) {
pattern=(pattern+1)%6; // change pattern
// call corresponding initialization function
if(pattern==0 || pattern==1 || pattern==2) {
initBlink();
} else {
initFade();
}
change=0;
}
}
}
示例14: Fade
void Transitions2D::Fade(CIwTexture* start, CIwTexture* end, uint8 transitionSpeed, bool skipFirstAndLastFrame)
{
CIwTexture* tempStart = mStartTexture;
CIwTexture* tempEnd = mEndTexture;
mStartTexture = start;
mEndTexture = end;
isUsingPrivateTextures = false;
Fade(transitionSpeed, skipFirstAndLastFrame);
isUsingPrivateTextures = true;
mStartTexture = tempStart;
mEndTexture = tempEnd;
}
示例15: Fade
void idLight::Event_FadeLight( float time, const idVec3 &newColor )
{
idVec3 color;
idVec4 color4;
currentLevel = levels;
color4.Set( newColor.x, newColor.y, newColor.z, 1.0f );
Fade( color4, time );
this->isOn = true;
}