当前位置: 首页>>代码示例>>C++>>正文


C++ LTexture类代码示例

本文整理汇总了C++中LTexture的典型用法代码示例。如果您正苦于以下问题:C++ LTexture类的具体用法?C++ LTexture怎么用?C++ LTexture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
close_sdl(void)
{
	printf("close_sdl()\n");

	/* free loaded image */
	gDotTexture.free();


	/* destroy window */
	SDL_DestroyRenderer(gRenderer);
	SDL_DestroyWindow(gWindow);
	gWindow = NULL;
	gRenderer = NULL;


	/* Quit SDL subsystem */
#ifdef _SDL_TTF_H
	TTF_Quit();
#endif
	IMG_Quit();
	SDL_Quit();
}
开发者ID:LXiong,项目名称:blog_tmp,代码行数:23,代码来源:collision_detection.cpp

示例2: loadMedia

void loadMedia(){
    
    batman->loadMedia();
    
    // load background
    gBackGroundTexture.loadFromFile("media/gotham.jpg", gRenderer);
    
    // load game file
    SDL_RWops* file = SDL_RWFromFile("gamestates/01.bin", "r+b");
    if (file == NULL) {
        printf("game state file not exist!\n");
        file = SDL_RWFromFile("gamestates/01.bin", "w+b");
        printf("new game state file created!\n");
        gameState.scrollingOffset = 0;
        SDL_RWwrite(file, &gameState, sizeof(gameState), 1);
        SDL_RWclose(file);
    }
    else{
        printf("previous game state found, reading file..\n");
        SDL_RWread(file, &gameState, sizeof(gameState), 1);
        SDL_RWclose(file);
    }
}
开发者ID:xysun,项目名称:batman1,代码行数:23,代码来源:main.cpp

示例3: loadMedia

    bool loadMedia()
    {
        //Loading success flag
        bool success = true;

        //Load sprite sheet texture
        if( !gSpriteSheetTexture.loadFromFile( "foo_animation.png" ) )
        {
            printf( "Failed to load walking animation texture!\n" );
            success = false;
        }
        else
        {
            //Set sprite clips
            gSpriteClips[ 0 ].x =   0;
            gSpriteClips[ 0 ].y =   0;
            gSpriteClips[ 0 ].w =  64;
            gSpriteClips[ 0 ].h = 205;

            gSpriteClips[ 1 ].x =  64;
            gSpriteClips[ 1 ].y =   0;
            gSpriteClips[ 1 ].w =  64;
            gSpriteClips[ 1 ].h = 205;

            gSpriteClips[ 2 ].x = 128;
            gSpriteClips[ 2 ].y =   0;
            gSpriteClips[ 2 ].w =  64;
            gSpriteClips[ 2 ].h = 205;

            gSpriteClips[ 3 ].x = 196;
            gSpriteClips[ 3 ].y =   0;
            gSpriteClips[ 3 ].w =  64;
            gSpriteClips[ 3 ].h = 205;
        }

        return success;
    }
开发者ID:osom8979,项目名称:example,代码行数:37,代码来源:sdl14.cpp

示例4: PlayerDisplayingHitsAndMiss

void PlayerDisplayingHitsAndMiss (char AImap [10][10])
{
    int xchange = gScreenRect.w/23.9473684211;
    int ychange = ceil(gScreenRect.h/11.9512195122);
    int rows=0;

    for (int ys=gScreenRect.h/5.76470588235; ys<gScreenRect.h/1.00926879506; ys+=ychange)
    {
        int cols=0;
        for (int xs=ceil(gScreenRect.w/2.82608695652)+10; xs<gScreenRect.w/1.2962962963; xs+=xchange)
        {

            if (AImap[cols][rows]=='X')
            {
                gSplashTexture.render(xs,ys,Miss,xchange, ychange);
            }
            cols++;
        }
        rows++;

    }


}
开发者ID:sman13,项目名称:battleship,代码行数:24,代码来源:main.cpp

示例5: close

void close() {
  //Open data for writing
  SDL_RWops* file = SDL_RWFromFile( "33_file_reading_and_writing/nums.bin", "w+b" );
  if( file != NULL ) {
    //Save data
    for( int i = 0; i < TOTAL_DATA; ++i ) {
      SDL_RWwrite( file, &gData[ i ], sizeof(Sint32), 1 );
    }

    //Close file handler
    SDL_RWclose( file );
  } else {
    printf( "Error: Unable to save file! %s\n", SDL_GetError() );
  }

  //Free loaded images
  gPromptTextTexture.free();
  for( int i = 0; i < TOTAL_DATA; ++i ) {
    gDataTextures[ i ].free();
  }

  //Free global font
  TTF_CloseFont( gFont );
  gFont = NULL;

  //Destroy window
  SDL_DestroyRenderer( gRenderer );
  SDL_DestroyWindow( gWindow );
  gWindow = NULL;
  gRenderer = NULL;

  //Quit SDL subsystems
  TTF_Quit();
  IMG_Quit();
  SDL_Quit();
}
开发者ID:kaprikawn,项目名称:sdl-starter,代码行数:36,代码来源:33_file_reading_and_writing.cpp

示例6:

int
load_media(void)
{
	/* open the font */
	gFont = TTF_OpenFont("lazy.ttf", 28);
	if (gFont == NULL) {
		fprintf(stderr, "Failed to load lazy font! SDL_ttf Error: %s\n",
			TTF_GetError());
		return -1;
	}

	/* set text color as black */
	SDL_Color textColor = { 0, 0, 0, 255 };

	/* load prompt texture */
	if (gPromptTexture.loadFromRenderedText(
		"Please Enter to Reset Start Time.", textColor) == -1)
	{
		fprintf(stderr, "Unable to render prompt texture!\n");
		return -1;
	}

	return 0;
}
开发者ID:LXiong,项目名称:blog_tmp,代码行数:24,代码来源:timing.cpp

示例7: loadMedia

bool loadMedia() {
  //Loading success flag
  bool success = true;

  //Load foo' texture
  if( !gFooTexture.loadFromFile( "40_texture_manipulation/foo.png" ) ) {
    printf( "Failed to load corner texture!\n" );
    success = false;
  } else {
    //Lock texture
    if( !gFooTexture.lockTexture() ) {
      printf( "Unable to lock Foo' texture!\n" );
    }
    //Manual color key
    else {
      //Get pixel data
      Uint32* pixels = (Uint32*)gFooTexture.getPixels();
      int pixelCount = ( gFooTexture.getPitch() / 4 ) * gFooTexture.getHeight();

      //Map colors
      Uint32 colorKey = SDL_MapRGB( SDL_GetWindowSurface( gWindow )->format, 0, 0xFF, 0xFF );
      Uint32 transparent = SDL_MapRGBA( SDL_GetWindowSurface( gWindow )->format, 0xFF, 0xFF, 0xFF, 0x00 );

      //Color key pixels
      for( int i = 0; i < pixelCount; ++i ) {
        if( pixels[ i ] == colorKey ) {
          pixels[ i ] = transparent;
        }
      }

      //Unlock texture
      gFooTexture.unlockTexture();
    }
  }

  return success;
}
开发者ID:kaprikawn,项目名称:sdl-starter,代码行数:37,代码来源:40.cpp

示例8: render

void Dot::render() {
  //Show the dot
  gDotTexture.render( mPosX, mPosY );
}
开发者ID:kaprikawn,项目名称:sdl-starter,代码行数:4,代码来源:28.cpp

示例9: if

int
main(int argc, char *argv[])
{
	int quit = 0;
	/* event handler */
	SDL_Event event;
	/* modulation components */
	Uint8 r = 255;
	Uint8 g = 255;
	Uint8 b = 255;

	/* starts up SDL and create window */
	if (init_sdl() == -1) {
		fprintf(stderr, "Failed to initialize SDL!\n");
		return -1;
	}

	/* load media */
	if (load_media() == -1) {
		fprintf(stderr, "Failed to load media!\n");
		return -2;
	}

	/* main loop */
	while (quit == 0) {
		/* handle events on queue */
		while (SDL_PollEvent(&event) != 0) {
			/* users request quit */
			if (event.type == SDL_QUIT)
				quit = 1;

			/* on key press change rgb values */
			else if (event.type == SDL_KEYDOWN) {
				switch (event.key.keysym.sym) {
				case SDLK_q:	/* increase red */
					r += 32;
					break;
				case SDLK_w:	/* increase green */
					g += 32;
					break;
				case SDLK_e:	/* increase blue */
					b += 32;
					break;
				case SDLK_a:	/* decrease red */
					r -= 32;
					break;
				case SDLK_s:	/* decrease green */
					g -= 32;
					break;
				case SDLK_d:	/* decrease blue */
					b -= 32;
					break;
				}
			}
		}

		/* clear screen */
		SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
		SDL_RenderClear(gRenderer);

		/* modulate and render texture */
		gModulatedTexture.setColor(r, g, b);
		gModulatedTexture.render(0, 0);


		/* update screen */
		SDL_RenderPresent(gRenderer);
	}

	/* free resources and close */
	close_sdl();

	return 0;
}
开发者ID:LXiong,项目名称:blog_tmp,代码行数:74,代码来源:color_modulation.cpp

示例10: main

int main( int argc, char* args[])
 {
	SDL_Color textColor = { 255, 255, 200, 255 };
//	 int i = 0;
	int timer = 0;
	int direction = 1;   //  1 : left moving / 2 : right
	bool screenHit = false;

	int PlayerLifes = 3;

	std::stringstream PlayerLifesText;

	if( !init() )
	{
		printf( "Failed to initialize!\n" );
	}
	else
	{
		if( !loadMedia() )
		{
			printf( "Failed to load media!\n" );
		}
		else
		{	
			bool quit = false;

			SDL_Event e;

			Player player(0, SCREEN_HEIGHT - gPlayerTexture.getHeight());
            player.setTex(&gPlayerTexture);
            gameObjects.push_back(&player);
        
			createArmy(100, 50, 0);

			while( !quit )
			{
				while( SDL_PollEvent( &e ) != 0 )
				{
					if( e.type == SDL_QUIT )
					{
						quit = true;
					}
					//if(e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_n) 
					//{
					//	PlayerLifes = 1;
					//	deleteShips();
					//	createArmy(100, 50, 0);
					//}
					bool shouldShoot = player.handleEvent( e );
                    if (shouldShoot)
                        addProj(player);
					
				}
           
			if(PlayerLifes <= 0) {
				SDL_SetRenderDrawColor( gRenderer, 0x00, 0x00, 0x00, 0x00 );
				SDL_RenderClear( gRenderer );

				gLoseScreen.render(0, 0, gRenderer);

			}
			else 
			{
				PlayerLifesText.str("");
				PlayerLifesText << "Lifes " << PlayerLifes;

				gPlayerLifesTexture.loadFromRenderedText( PlayerLifesText.str().c_str(), textColor, gRenderer, gFont  ); 

				if( timer > 100 )
					timer = 0;
				timer += 1; 

				if( timer % 3 == 0) 
				{
					if(ifScreenEndHit()) {
						screenHit = true;
						direction += 1;
					}	
				
					movingShips(direction, screenHit);
				
					if(screenHit)
						screenHit = false;
				}				
				
				if( timer % 50 == 0) {
					shipFire();
				}

				ifProjCollShip();
				projCollPlayer(player, PlayerLifes);
				
				//cout << PlayerLifes << endl;

				  for(std::list<GameObject*>::iterator it = gameObjects.begin(); it != gameObjects.end();)
				  {
					if( (*it)->alive == true ) 
						(*it)->update();
					    ++it;
					
//.........这里部分代码省略.........
开发者ID:nbudinov,项目名称:Game-Dev-Summer-2014,代码行数:101,代码来源:Main.cpp

示例11: main

int main( int argc, char* args[] )
{
	//Start up SDL and create window
	if( !init() )
	{
		printf( "Failed to initialize!\n" );
	}
	else
	{
		//Load media
		if( !loadMedia() )
		{
			printf( "Failed to load media!\n" );
		}
		else
		{	
			//Main loop flag
			bool quit = false;

			//Event handler
			SDL_Event e;

			//The dot that will be moving around on the screen
			Dot dot;

			//The camera area
			SDL_Rect camera = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };

			//While application is running
			while( !quit )
			{
				//Handle events on queue
				while( SDL_PollEvent( &e ) != 0 )
				{
					//User requests quit
					if( e.type == SDL_QUIT )
					{
						quit = true;
					}

					//Handle input for the dot
					dot.handleEvent( e );
				}

				//Move the dot
				dot.move();

				//Center the camera over the dot
				camera.x = ( dot.getPosX() + Dot::DOT_WIDTH / 2 ) - SCREEN_WIDTH / 2;
				camera.y = ( dot.getPosY() + Dot::DOT_HEIGHT / 2 ) - SCREEN_HEIGHT / 2;

				//Keep the camera in bounds
				if( camera.x < 0 )
				{ 
					camera.x = 0;
				}
				if( camera.y < 0 )
				{
					camera.y = 0;
				}
				if( camera.x > LEVEL_WIDTH - camera.w )
				{
					camera.x = LEVEL_WIDTH - camera.w;
				}
				if( camera.y > LEVEL_HEIGHT - camera.h )
				{
					camera.y = LEVEL_HEIGHT - camera.h;
				}

				//Clear screen
				SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
				SDL_RenderClear( gRenderer );

				//Render background
				gBGTexture.render( 0, 0, &camera );

				//Render objects
				dot.render( camera.x, camera.y );

				//Update screen
				SDL_RenderPresent( gRenderer );
			}
		}
	}

	//Free resources and close SDL
	close();

	return 0;
}
开发者ID:rosen90,项目名称:GitHub,代码行数:90,代码来源:30_scrolling.cpp

示例12: main

int main( int argc, char* args[] )
{
	//Start up SDL and create window
	if( !init() )
	{
		printf( "Failed to initialize!\n" );
	}
	else
	{
		//Load media
		if( !loadMedia() )
		{
			printf( "Failed to load media!\n" );
		}
		else
		{	
			//Main loop flag
			bool quit = false;

			//Event handler
			SDL_Event e;

			//Set text color as black
			SDL_Color textColor = { 0, 0, 0, 255 };

			//The application timer
			LTimer timer;

			//In memory text stream
			std::stringstream timeText;

			//While application is running
			while( !quit )
			{
				//Handle events on queue
				while( SDL_PollEvent( &e ) != 0 )
				{
					//User requests quit
					if( e.type == SDL_QUIT )
					{
						quit = true;
					}
					//Reset start time on return keypress
					else if( e.type == SDL_KEYDOWN )
					{
						//Start/stop
						if( e.key.keysym.sym == SDLK_s )
						{
							if( timer.isStarted() )
							{
								timer.stop();
							}
							else
							{
								timer.start();
							}
						}
						//Pause/unpause
						else if( e.key.keysym.sym == SDLK_p )
						{
							if( timer.isPaused() )
							{
								timer.unpause();
							}
							else
							{
								timer.pause();
							}
						}
					}
				}

				//Set text to be rendered
				timeText.str( "" );
				timeText << "Seconds since start time " << ( timer.getTicks() / 1000.f ) ; 

				//Render text
				if( !gTimeTextTexture.loadFromRenderedText( timeText.str().c_str(), textColor ) )
				{
					printf( "Unable to render time texture!\n" );
				}

				//Clear screen
				SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
				SDL_RenderClear( gRenderer );

				//Render textures
				gStartPromptTexture.render( ( SCREEN_WIDTH - gStartPromptTexture.getWidth() ) / 2, 0 );
				gPausePromptTexture.render( ( SCREEN_WIDTH - gPausePromptTexture.getWidth() ) / 2, gStartPromptTexture.getHeight() );
				gTimeTextTexture.render( ( SCREEN_WIDTH - gTimeTextTexture.getWidth() ) / 2, ( SCREEN_HEIGHT - gTimeTextTexture.getHeight() ) / 2 );

				//Update screen
				SDL_RenderPresent( gRenderer );
			}
		}
	}

	//Free resources and close SDL
	close();

//.........这里部分代码省略.........
开发者ID:JerelynCo,项目名称:CS179.14,代码行数:101,代码来源:23_advanced_timers.cpp

示例13: main

//Fonction principale du programme
int main(int argc, char* args[])
{

  bool quit = false;  //flag pour la boucle principale. Elle permet de déterminer si l'on doit quitter le programme
  int indexImageCharset = 0;  //Cette variable nous permet de sélectionner une image du charset de l'homme
  int compteur = 0;	  //Ce compteur est utilisé pour déterminer à quel moment changer d'image dans 'homeCharset'
 

  SDL_Event e;        //Cette variable nous permet de détecter l'événement courant que le programme doit gérer (click, touche du clavier, etc.)

  SDL_Rect* currentHommeRect = &hommeRect[indexImageCharset];  //Ce rectangle correspond à celui qu'on prendra pour afficher l'une des images du charset 'homeCharset'

  //On définit la position initial de l'image
  int positionHommeX = (LARGEUR_FENETRE - LARGEUR_IMAGE_HOMME_CHARSET) / 2;
  int positionHommeY = (HAUTEUR_FENETRE - HAUTEUR_IMAGE_HOMME_CHARSET) / 2;

  //Start up SDL and create window
  if (!init())
  {
	printf("Failed to initialize!\n");
  }
  else
  {
	//Load media
	if (!loadMedia())
	{
	  printf("Failed to load media!\n");
	}
	else
	{
	  printf("Programme OK!\n");

	  //Netoyyer l'écran (Clear Screen)
	  SDL_RenderClear(rendererFenetre);

	  //Il est possible de définir une couleur de background du 'renderer'
	  SDL_SetRenderDrawColor(rendererFenetre, 0xFF, 0xCC, 0xCC, 0xCC);

	  //On dessine cette texture
	  hommeTexture.render(0, 0, currentHommeRect);

	  //Mise à jour de 'rendererFenetre' (on redesine les images (contenues dans leurs textures) dans le renderer)
	  SDL_RenderPresent(rendererFenetre);


	  //Le programme reste ouvert tant que quit != true 
	  while (!quit)
	  {
		//Handle events on queue
		while (SDL_PollEvent(&e) != 0)
		{
		  //Si l'utilisateur appuiie sur le bouton 'fermer' de la fenêtre
		  if (e.type == SDL_QUIT)
		  {
			quit = true;
		  }

		  //Si l'utilisateur fait un click de souris
		  else if (e.type == SDL_MOUSEBUTTONDOWN)
		  {
			quit = true;
		  }
		  //Si l'utilisateur dépplace la souris
		  else if (e.type == SDL_MOUSEMOTION)
		  {
			//On définit comme nouvelle position du fantôme celle de la souris
			positionHommeX = e.motion.x;
			positionHommeY = e.motion.y;

		  }

		  //Si une touche du clavier a été appuyée
		  else if (e.type == SDL_KEYDOWN)
		  {

			//Avec ce switch on indique qoui faire lorsque l'utilisateur appuie sur une touche
			switch (e.key.keysym.sym)
			{
			case SDLK_w:  //La touche 'w' a été appuyée
			  positionHommeX = 0;
			  positionHommeY = 0;
			  break;

			case SDLK_b:  ////La touche 'b' a été appuyée
			  positionHommeX = 250;
			  positionHommeY = 250;
			  break;

			case SDLK_UP:
			  positionHommeY -= 10;
			  break;

			case SDLK_DOWN:
			  positionHommeY += 10;
			  break;

			case SDLK_LEFT:
			  positionHommeX -= 10;
			  break;
//.........这里部分代码省略.........
开发者ID:Lahkust,项目名称:Barkanoid,代码行数:101,代码来源:sdl2_ex4_animation.cpp

示例14: main

int main( int argc, char* args[] )
{

	bool inside = true;
	//Start up SDL and create window
	if( !init() )
	{
		printf( "Failed to initialize!\n" );
	}
	else
	{
		if( !loadMedia() )
		{
			printf( "Failed to load media!\n" );
		}
		else
		{
			//Main loop flag
			bool quit = false;

			//Event handler
			SDL_Event e;

			//While application is running
			while( !quit )
			{
				//Handle events on queue
				while( SDL_PollEvent( &e ) != 0 )
				{
					//User requests quit
					if( e.type == SDL_QUIT )
					{
						quit = true;
					}

					//Handle button events
					for( int i = 0; i < 4; ++i )
					{

						gButtons[ i ].handleEvent( &e );
					}
				}

				//Clear screen
				SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
				SDL_RenderClear( gRenderer );

				//Render background texture to screen
				gBackgroundTexture.render( 0, 0 );

				//Render Foo' to the screen
				gFooTexture.render( 0, 0 );

				//Render buttons
				gButtonSpriteSheetTexture.loadFromFile( "res/menu/555.png" );
				for( int i = 0; i < TOTAL_BUTTONS; ++i )
				{
					gButtons[ 0 ].render();
					/*switch(e.type)
						{
							case SDL_MOUSEBUTTONDOWN:
								 SDL_Quit();
							break;
						}*/
				}
				gButtonSpriteSheetTexture.loadFromFile( "res/menu/options.png" );
				for( int i = 0; i < TOTAL_BUTTONS; ++i )
				{
					gButtons[ 1 ].render();
				}
				gButtonSpriteSheetTexture.loadFromFile( "res/menu/exit.png" );
				for( int i = 0; i < TOTAL_BUTTONS; ++i )
				{
					gButtons[ 2 ].render();
					/*if (event->type == SDL_MOUSEBUTTONDOWN)
					  {
						if (event->button.button == SDL_BUTTON_LEFT)
							{    //if it is pressed then play1 becomes true which you could use to initiate the newgame
									play1 = true;
							}
					  }


					{
						LButton().mCurrentSprite = BUTTON_SPRITE_MOUSE_OUT;
					}
					else
					{
						switch(e.type)
						{
							case SDL_MOUSEBUTTONUP:
								 SDL_Quit();
							break;
						}
					}*/
					break;

				}
				gButtonSpriteSheetTexture.loadFromFile( "res/menu/options.png" );
				for( int i = 0; i < TOTAL_BUTTONS; ++i )
//.........这里部分代码省略.........
开发者ID:Bfgeshka,项目名称:labyrinta,代码行数:101,代码来源:menu.cpp

示例15: main

int main( int argc, char* args[] )
{
	//Start up SDL and create window
	if( !init() )
	{
		printf( "Failed to initialize!\n" );
	}
	else
	{
		//Load media
		if( !loadMedia() )
		{
			printf( "Failed to load media!\n" );
		}
		else
		{	
			//Main loop flag
			bool quit = false;

			//Event handler
			SDL_Event e;

			//While application is running
			while( !quit )
			{
				//Handle events on queue
				while( SDL_PollEvent( &e ) != 0 )
				{
					//User requests quit
					if( e.type == SDL_QUIT )
					{
						quit = true;
					}
				}

				//Clear screen
				SDL_SetRenderDrawColor( gRenderer, 0xaa, 0xFF, 0xFF, 0xFF );
				SDL_RenderClear( gRenderer );

				//Render top left sprite
				gSpriteSheetTexture.render( 20, 30, &gSpriteClips[ 0 ] );
				gSpriteSheetTexture.render( 200, 150, &gSpriteClips[ 0 ] );

				//Render top right sprite
				gSpriteSheetTexture.render( SCREEN_WIDTH - gSpriteClips[ 1 ].w, 0, &gSpriteClips[ 1 ] );

				//Render bottom left sprite
				gSpriteSheetTexture.render( 0, SCREEN_HEIGHT - gSpriteClips[ 2 ].h, &gSpriteClips[ 2 ] );

				//Render bottom right sprite
				gSpriteSheetTexture.render( SCREEN_WIDTH - gSpriteClips[ 3 ].w, SCREEN_HEIGHT - gSpriteClips[ 3 ].h, &gSpriteClips[ 3 ] );

				//Update screen
				SDL_RenderPresent( gRenderer );
			}
		}
	}

	//Free resources and close SDL
	close();

	return 0;
}
开发者ID:miroslavavramov,项目名称:Memory-Game,代码行数:63,代码来源:11_clip_rendering_and_sprite_sheets.cpp


注:本文中的LTexture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。