这篇教程C++ Fade函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Fade函数的典型用法代码示例。如果您正苦于以下问题:C++ Fade函数的具体用法?C++ Fade怎么用?C++ Fade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Fade函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)))); }
开发者ID:lightspark,项目名称:lightspark,代码行数:26,
示例2: floorfloat 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))));}
开发者ID:aik6980,项目名称:GameFrameworkCpp,代码行数:29,
示例3: switchBOOL 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;}
开发者ID:YackSaw,项目名称:test,代码行数:29,
示例4: DrawTitleScreen// Title Screen Draw logicvoid 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));}
开发者ID:MarcMDE,项目名称:TapToJump,代码行数:9,
示例5: DrawEndingScreen// Ending Screen Draw logicvoid 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);}
开发者ID:raysan5,项目名称:raylib,代码行数:10,
示例6: DrawAisle01Screen// Gameplay Screen Draw logicvoid 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!}
开发者ID:raysan5,项目名称:raylib,代码行数:57,
示例7: Animatevoid GameEntityWhiteScreen::Animate(float delay) { GameEntity::Animate(delay); float fade=Fade(); sprite.setColor(sf::Color(255, 255, 255, 255 * fade));}
开发者ID:Cirrus-Minor,项目名称:freetumble,代码行数:7,
示例8: Sound_Fadevoid 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);};
开发者ID:altseed,项目名称:Altseed,代码行数:7,
示例9: Fadevoid 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 );}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:35,
示例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 );}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:13,
示例11: Fadevoid UIPicButton::NotifyTimer (unsigned int wParam){ if (g_bUsefade == true) { if (wParam == TMR_FADE+g_controlID) { Fade (); } }}
开发者ID:dannydraper,项目名称:CedeCryptClassic,代码行数:8,
示例12: mainint 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;}
开发者ID:Libertium,项目名称:raylib,代码行数:57,
示例13: mainvoid 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; } }}
开发者ID:3dlogixbydesign,项目名称:squarewear,代码行数:41,
示例14: Fadevoid 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;}
开发者ID:marmalade,项目名称:Transitions2d,代码行数:12,
示例15: Fadevoid 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;}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:12,
示例16: SetFadeStatevoid CFriendChange_UI::Update(){ float fTime = g_D3dDevice->GetTime() ; float fSpeed = 0.0f ; if(m_StateC==NONE && g_Keyboard->IsButtonDown(DIK_A)) { if(m_StateF==DISABLE) SetFadeState(FADE_IN) ; m_fFadeTime = 0.0f ; m_nNowAlpha = 255 ; m_StateC = RIGHT ; m_StateF = ENABLE ; } else if(m_StateC==NONE && g_Keyboard->IsButtonDown(DIK_S)) { if(m_StateF==DISABLE) SetFadeState(FADE_IN) ; m_fFadeTime = 0.0f ; m_nNowAlpha = 255 ; m_StateC = LEFT ; m_StateF = ENABLE ; } for(int i=0; i<5; i++) { m_fDegree[i] += fSpeed * fTime ; if(m_fDegree[i]>=360.0f) m_fDegree[i] -= 360.0f ; else if(m_fDegree[i]<0.0f) m_fDegree[i] += 360.0f ; } Animation() ; Fade() ; SetCirclePosition() ;}
开发者ID:Nickchooshin,项目名称:THE-DILUVIO,代码行数:40,
示例17: SceneBaseTitle::Title(AppNative* app) :SceneBase(app, Fade(Fade::Type::In)),font_(loadAsset("rounded-l-mplus-1c-regular.ttf")),pos_(0, 0),net_("127.0.0.1", 12345) { font_.setSize(50); recv_.init(54321); enable_ = true; send_th_ = std::thread([&] { while (true) { picojson::object obj; obj.emplace(std::make_pair("posx", pos_.x)); obj.emplace(std::make_pair("posy", pos_.y)); picojson::value val(obj); net_.send(val.serialize()); if (!enable_) break; } }); recv_th_ = std::thread([&] { while (true) { std::string data; recv_ >> data; if (data.size() < 8) continue; picojson::value val; picojson::parse(val, data); picojson::object obj(val.get<picojson::object>()); e_pos_.x = obj["posx"].get<double>(); e_pos_.y = obj["posy"].get<double>(); if (!enable_) break; } });
开发者ID:Lacty,项目名称:Connection,代码行数:38,
示例18: Fade/*=================idPlayerView::Flashflashes the player view with the given color=================*/void idPlayerView::Flash(idVec4 color, int time ) { Fade(idVec4(0, 0, 0, 0), time); fadeFromColor = colorWhite;}
开发者ID:chegestar,项目名称:omni-bot,代码行数:11,
示例19: UpdateDrawFrame// Update and Draw one framevoid UpdateDrawFrame(void){ // Update //---------------------------------------------------------------------------------- if (!onTransition) { switch (currentScreen) { case LOGO: { UpdateLogoScreen(); if (FinishLogoScreen()) TransitionToScreen(TITLE); } break; case TITLE: { UpdateTitleScreen(); // NOTE: FinishTitleScreen() return an int defining the screen to jump to if (FinishTitleScreen() == 1) { UnloadTitleScreen(); //currentScreen = OPTIONS; //InitOptionsScreen(); } else if (FinishTitleScreen() == 2) { UnloadTitleScreen(); InitGameplayScreen(); TransitionToScreen(GAMEPLAY); } } break; case GAMEPLAY: { UpdateGameplayScreen(); if (FinishGameplayScreen()) { UnloadGameplayScreen(); InitEndingScreen(); TransitionToScreen(ENDING); } } break; case ENDING: { UpdateEndingScreen(); if (FinishEndingScreen()) { UnloadEndingScreen(); InitGameplayScreen(); TransitionToScreen(GAMEPLAY); } } break; default: break; } } else UpdateTransition(); UpdateMusicStream(music); //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(WHITE); switch (currentScreen) { case LOGO: DrawLogoScreen(); break; case TITLE: DrawTitleScreen(); break; case GAMEPLAY: DrawGameplayScreen(); break; case ENDING: DrawEndingScreen(); break; default: break; } if (onTransition) DrawTransition(); DrawFPS(20, GetScreenHeight() - 30); DrawRectangle(GetScreenWidth() - 200, GetScreenHeight() - 50, 200, 40, Fade(WHITE, 0.6f)); DrawText("ALPHA VERSION", GetScreenWidth() - 180, GetScreenHeight() - 40, 20, DARKGRAY); EndDrawing(); //----------------------------------------------------------------------------------}
开发者ID:raysan5,项目名称:raylib,代码行数:92,
示例20: DrawTransitionvoid DrawTransition(void){ DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, transAlpha));}
开发者ID:raysan5,项目名称:raylib,代码行数:4,
示例21: Fade/*================idLight::FadeOut================*/void idLight::FadeOut( float time ) { Fade( colorBlack, time );}
开发者ID:alepulver,项目名称:dhewm3,代码行数:8,
示例22: Fadevoid ZoomControlExternal::ExtendedZoomControls::Hide(){ Fade(IView::GONE, 1.0f, 0.0f);}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:4,
示例23: mainint main(void){ // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles blending"); // Particles pool, reuse them! Particle mouseTail[MAX_PARTICLES] = { 0 }; // Initialize particles for (int i = 0; i < MAX_PARTICLES; i++) { mouseTail[i].position = (Vector2){ 0, 0 }; mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 }; mouseTail[i].alpha = 1.0f; mouseTail[i].size = (float)GetRandomValue(1, 30)/20.0f; mouseTail[i].rotation = (float)GetRandomValue(0, 360); mouseTail[i].active = false; } float gravity = 3.0f; Texture2D smoke = LoadTexture("resources/smoke.png"); int blending = BLEND_ALPHA; SetTargetFPS(60); //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- // Activate one particle every frame and Update active particles // NOTE: Particles initial position should be mouse position when activated // NOTE: Particles fall down with gravity and rotation... and disappear after 2 seconds (alpha = 0) // NOTE: When a particle disappears, active = false and it can be reused. for (int i = 0; i < MAX_PARTICLES; i++) { if (!mouseTail[i].active) { mouseTail[i].active = true; mouseTail[i].alpha = 1.0f; mouseTail[i].position = GetMousePosition(); i = MAX_PARTICLES; } } for (int i = 0; i < MAX_PARTICLES; i++) { if (mouseTail[i].active) { mouseTail[i].position.y += gravity; mouseTail[i].alpha -= 0.01f; if (mouseTail[i].alpha <= 0.0f) mouseTail[i].active = false; mouseTail[i].rotation += 5.0f; } } if (IsKeyPressed(KEY_SPACE)) { if (blending == BLEND_ALPHA) blending = BLEND_ADDITIVE; else blending = BLEND_ALPHA; } //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(DARKGRAY); BeginBlendMode(blending); // Draw active particles for (int i = 0; i < MAX_PARTICLES; i++) { if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0.0f, 0.0f, (float)smoke.width, (float)smoke.height }, (Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size }, (Vector2){ (float)(smoke.width*mouseTail[i].size/2.0f), (float)(smoke.height*mouseTail[i].size/2.0f) }, mouseTail[i].rotation, Fade(mouseTail[i].color, mouseTail[i].alpha)); } EndBlendMode(); DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, BLACK); if (blending == BLEND_ALPHA) DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, BLACK); else DrawText("ADDITIVE BLENDING", 280, screenHeight - 40, 20, RAYWHITE); EndDrawing(); //---------------------------------------------------------------------------------- }//.........这里部分代码省略.........
开发者ID:raysan5,项目名称:raylib,代码行数:101,
示例24: DrawMissionScreen// Mission Screen Draw logicvoid DrawMissionScreen(void){ // Draw MISSION screen here! DrawTexture(texBackground, 0,0, WHITE); DrawTexturePro(texBackline, sourceRecBackLine, destRecBackLine, (Vector2){0,0},0, Fade(WHITE, fadeBackLine)); if (writeNumber) DrawTextEx(fontMission, FormatText("Filtración #%02i ", currentMission + 1), numberPosition, missionSize + 10, 0, numberColor); DrawTextEx(fontMission, TextSubtext(missions[currentMission].brief, 0, missionLenght), missionPosition, missionSize, 0, missionColor); if (writeKeyword && blinkKeyWord) DrawTextEx(fontMission, FormatText("Keyword: %s", missions[currentMission].key), keywordPosition, missionSize + 10, 0, keywordColor); if (showButton) { if (!writeEnd) DrawButton("saltar"); else DrawButton("codificar"); }}
开发者ID:raysan5,项目名称:raylib,代码行数:17,
注:本文中的Fade函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FatCompleteRequest函数代码示例 C++ Factorial函数代码示例 |