本文整理汇总了C++中Fade函数的典型用法代码示例。如果您正苦于以下问题:C++ Fade函数的具体用法?C++ Fade怎么用?C++ Fade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fade函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:PerlinNoise.hpp
示例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))));
}
开发者ID:aik6980,项目名称:GameFrameworkCpp,代码行数:29,代码来源:Noise.cpp
示例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;
}
开发者ID:YackSaw,项目名称:test,代码行数:29,代码来源:DrawGraphics.cpp
示例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));
}
开发者ID:MarcMDE,项目名称:TapToJump,代码行数:9,代码来源:screen_title.c
示例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);
}
开发者ID:raysan5,项目名称:raylib,代码行数:10,代码来源:screen_ending.c
示例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!
}
开发者ID:raysan5,项目名称:raylib,代码行数:57,代码来源:screen_aisle01.c
示例7: Animate
void GameEntityWhiteScreen::Animate(float delay) {
GameEntity::Animate(delay);
float fade=Fade();
sprite.setColor(sf::Color(255, 255, 255, 255 * fade));
}
开发者ID:Cirrus-Minor,项目名称:freetumble,代码行数:7,代码来源:GameEntity.cpp
示例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);
};
开发者ID:altseed,项目名称:Altseed,代码行数:7,代码来源:asd.WrapperDLL.cpp
示例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 );
}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:35,代码来源:CPartSnowFlake.cpp
示例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,代码来源:Light.cpp
示例11: Fade
void UIPicButton::NotifyTimer (unsigned int wParam)
{
if (g_bUsefade == true) {
if (wParam == TMR_FADE+g_controlID) {
Fade ();
}
}
}
开发者ID:dannydraper,项目名称:CedeCryptClassic,代码行数:8,代码来源:UIPicButton.cpp
示例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;
}
开发者ID:Libertium,项目名称:raylib,代码行数:57,代码来源:textures_rectangle.c
示例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;
}
}
}
开发者ID:3dlogixbydesign,项目名称:squarewear,代码行数:41,代码来源:SquareWearDemo.c
示例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;
}
开发者ID:marmalade,项目名称:Transitions2d,代码行数:12,代码来源:transitions2d.cpp
示例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;
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:12,代码来源:Light.cpp
示例16: SetFadeState
void 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,代码来源:FriendChange_UI.cpp
示例17: SceneBase
Title::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,代码来源:title.cpp
示例18: Fade
/*
=================
idPlayerView::Flash
flashes 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,代码来源:PlayerView.cpp
示例19: UpdateDrawFrame
// Update and Draw one frame
void 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,代码来源:koala_seasons.c
示例20: DrawTransition
void DrawTransition(void)
{
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, transAlpha));
}
开发者ID:raysan5,项目名称:raylib,代码行数:4,代码来源:koala_seasons.c
注:本文中的Fade函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论