bool loadMedia() { //Loading success flag bool success = true; //Load sprites {if( !gButtonSpriteSheetTexture.loadFromFile( "res/menu/button.png" ) ) { printf( "Failed to load button sprite texture!\n" ); success = false; } else { //Set sprites for( int i = 0; i < 4; ++i ) { gSpriteClips[ i ].x = 0; gSpriteClips[ i ].y = i * 200; gSpriteClips[ i ].w = BUTTON_WIDTH; gSpriteClips[ i ].h = BUTTON_HEIGHT; } //Set buttons in corners gButtons[ 0 ].setPosition( 127, 150 ); } } if( !gBackgroundTexture.loadFromFile( "res/menu/new_background.png" ) ) { printf( "Failed to load background texture image!\n" ); success = false; } return success; }
SDL_Rect sword :: get_position(Dot myDot, Setup foo) { if(look_up) { box.x = myDot.box.x; box.y = (myDot.box.y - le) + properHeight; weaponsT.loadFromFile( "first_test12.bmp" ); } else if(look_down && !myDot.is_onGround()) ///very much so temp--- this should be its own move, once i get moves sorted :D { box.x = myDot.box.x; box.y = myDot.box.y + myDot.box.h; weaponsT.loadFromFile( "first_test11.bmp" ); } else { if(!direction) { box.x = myDot.box.x + trueWidth; weaponsT.loadFromFile( "first_test10.bmp" ); } else { box.x = (myDot.box.x - 128) + (128 - trueWidth); weaponsT.loadFromFile( "first_test9.bmp" ); } box.y = myDot.box.y + trueHeight/2; return box; } }
bool loadMedia() { //Loading success flag bool success = true; //Load front alpha texture if( !gModulatedTexture.loadFromFile( "13_alpha_blending/fadeout.png" ) ) { printf( "Failed to load front texture!\n" ); success = false; } else { //Set standard alpha blending gModulatedTexture.setBlendMode( SDL_BLENDMODE_BLEND ); } //Load background texture if( !gBackgroundTexture.loadFromFile( "13_alpha_blending/fadein.png" ) ) { printf( "Failed to load background texture!\n" ); success = false; } return success; }
bool loadMedia( Tile* tiles[] ) { //Loading success flag bool success = true; //Load dot texture if( !gDotTexture.loadFromFile( "39_tiling/dot.bmp" ) ) { printf( "Failed to load dot texture!\n" ); success = false; } //Load tile texture if( !gTileTexture.loadFromFile( "39_tiling/tiles.png" ) ) { printf( "Failed to load tile set texture!\n" ); success = false; } //Load tile map if( !setTiles( tiles ) ) { printf( "Failed to load tile set!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; if (!gDotTexture.loadFromFile( "gosho.png" )) { printf( "Failed to load ship texture!\n"); success = false; } if( !gEnemyTexture.loadFromFile( "enemy.png" ) ) { printf( "Failed to load arrow texture!\n" ); success = false; } if( !gBulletTexture.loadFromFile( "bullet.png" ) ) { printf( "Failed to load arrow texture!\n" ); success = false; } if( !gBGTexture.loadFromFile( "background.png" ) ) { printf( "Failed to load arrow texture!\n" ); success = false; } return success; }
SDL_Rect gun :: get_position(Dot myDot, Setup foo) { if(look_up) { box.x = myDot.box.x; box.y = myDot.box.y; weapons2T.loadFromFile( "first_test16.bmp" ); } else if(look_down && !myDot.is_onGround()) ///very much so temp--- this should be its own move, once i get moves sorted :D { box.x = myDot.box.x; box.y = myDot.box.y + (myDot.box.h - speed); weapons2T.loadFromFile( "first_test15.bmp" ); } else { if(!direction) { box.x = myDot.box.x + (trueWidth - speed); weapons2T.loadFromFile( "first_test14.bmp" ); } else { box.x = (myDot.box.x - 128) + (128 - trueWidth); weapons2T.loadFromFile( "first_test13.bmp" ); } box.y = myDot.box.y + trueHeight/2; } return box; }
bool loadMedia() { //Loading success flag bool success = true; gFont = TTF_OpenFont( "images/lazy.ttf", 22 ); if( gFont == NULL ) { printf( "Failed to load lazy font! SDL_ttf Error: %s\n", TTF_GetError() ); success = false; } else { //Render text SDL_Color textColor = { 0xFF, 0xFF, 0 }; if( !gPlayerLifesTexture.loadFromRenderedText( " Lifes: ", textColor, gRenderer, gFont ) ) { printf( "Failed to render text texture!\n" ); success = false; } } if( !gPlayerTexture.loadFromFile( "images/player.bmp", gRenderer ) ) { printf( "Failed to load dot texture!\n" ); success = false; } if( !gProjTexture.loadFromFile( "images/projectile.bmp", gRenderer ) ) { printf( "Failed to load dot texture!\n" ); success = false; } if( !gShipTexture.loadFromFile( "images/ship.bmp", gRenderer ) ) { printf( "Failed to load dot texture!\n" ); success = false; } if( !gLoseScreen.loadFromFile( "images/losescreen.png", gRenderer ) ) { printf( "Failed to load LoSE screen texture!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; if(!g_dotTexture.loadFromFile("dot.bmp")) { printf("Failed to load dot texture!\n"); success = false; } if(!g_bgTexture.loadFromFile("bg.png")) { printf("Failed to load bg texture!\n"); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load dot texture if( !gDotTexture.loadFromFile( "assets/38_particle_engines/dot.bmp" ) ) { printf( "Failed to load dot texture!\n" ); success = false; } //Load red texture if( !gRedTexture.loadFromFile( "assets/38_particle_engines/red.bmp" ) ) { printf( "Failed to load red texture!\n" ); success = false; } //Load green texture if( !gGreenTexture.loadFromFile( "assets/38_particle_engines/green.bmp" ) ) { printf( "Failed to load green texture!\n" ); success = false; } //Load blue texture if( !gBlueTexture.loadFromFile( "assets/38_particle_engines/blue.bmp" ) ) { printf( "Failed to load blue texture!\n" ); success = false; } //Load shimmer texture if( !gShimmerTexture.loadFromFile( "assets/38_particle_engines/shimmer.bmp" ) ) { printf( "Failed to load shimmer texture!\n" ); success = false; } //Set texture transparency gRedTexture.setAlpha( 192 ); gGreenTexture.setAlpha( 192 ); gBlueTexture.setAlpha( 192 ); gShimmerTexture.setAlpha( 192 ); return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load sprite sheet texture if( !gSpriteSheetTexture.loadFromFile( "14_animated_sprites_and_vsync/foo.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; }
bool loadMedia() { //Loading success flag bool success = true; //Load sprite sheet texture if( !gSpriteSheetTexture.loadFromFile( "11_clip_rendering_and_sprite_sheets/game.png" ) ) { printf( "Failed to load sprite sheet texture!\n" ); success = false; } else { //初始化矩形 for(int i = 0; i <= 2; i++) for(int j = 0; j <= 2; j++) { gSpriteClips[i * 3 + j].x = j * 250; gSpriteClips[i * 3 + j].y = i * 200; gSpriteClips[i * 3 + j].w = 250; gSpriteClips[i * 3 + j].h = 200; } } return success; }
bool loadMedia() { bool success = true; if( !gSquare.loadFromFile( "Sprites/Animation.png" ) ) { cout << "Falha ao carregar a sprite principal." << endl; success = false; } else { gSpriteClips[ANIMATION1].x = 0; gSpriteClips[ANIMATION1].y = 0; gSpriteClips[ANIMATION1].w = 250; gSpriteClips[ANIMATION1].h = 300; gSpriteClips[ANIMATION2].x = 250; gSpriteClips[ANIMATION2].y = 0; gSpriteClips[ANIMATION2].w = 250; gSpriteClips[ANIMATION2].h = 300; gSpriteClips[ANIMATION3].x = 500; gSpriteClips[ANIMATION3].y = 0; gSpriteClips[ANIMATION3].w = 250; gSpriteClips[ANIMATION3].h = 300; gSpriteClips[ANIMATION4].x = 750; gSpriteClips[ANIMATION4].y = 0; gSpriteClips[ANIMATION4].w = 250; gSpriteClips[ANIMATION4].h = 300; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load sprites if( !gButtonSpriteSheetTexture.loadFromFile( "assets/17_mouse_events/button.png" ) ) { printf( "Failed to load button sprite texture!\n" ); success = false; } else { //Set sprites for( int i = 0; i < BUTTON_SPRITE_TOTAL; ++i ) { gSpriteClips[ i ].x = 0; gSpriteClips[ i ].y = i * 200; gSpriteClips[ i ].w = BUTTON_WIDTH; gSpriteClips[ i ].h = BUTTON_HEIGHT; } //Set buttons in corners gButtons[ 0 ].setPosition( 0, 0 ); gButtons[ 1 ].setPosition( SCREEN_WIDTH - BUTTON_WIDTH, 0 ); gButtons[ 2 ].setPosition( 0, SCREEN_HEIGHT - BUTTON_HEIGHT ); gButtons[ 3 ].setPosition( SCREEN_WIDTH - BUTTON_WIDTH, SCREEN_HEIGHT - BUTTON_HEIGHT ); } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load dot texture if( !gDotTexture.loadFromFile( "30_scrolling/dot.bmp" ) ) { printf( "Failed to load dot texture!\n" ); success = false; } //Load background texture if( !gBGTexture.loadFromFile( "30_scrolling/bg.png" ) ) { printf( "Failed to load background texture!\n" ); success = false; } return success; }
bool IntroRender (int x, int y) { //Event handler SDL_Event e; LTexture texture; std::string counter=""; for (int i=0; i<1502; i+=2) { //Handle events on queue while( SDL_PollEvent( &e ) != 0 ) { //Clear screen SDL_SetRenderDrawColor( gRenderer, 0, 0, 0, 0 ); SDL_RenderClear( gRenderer ); //User requests quit if( e.type == SDL_QUIT ) { return false; } } bool quit=false; counter+="IntroPics/Intro"; counter+=IntToString(i+1); counter+=".jpg"; Intro [i]=texture.loadFromFile( counter.c_str(),gScreenRect.w, gScreenRect.h); gSplashTexture.render(x, y,Intro[i],IntroW, IntroH); //Update screen SDL_RenderPresent( gRenderer ); if (Intro [i]!=NULL) { SDL_DestroyTexture( Intro [i] ); Intro [i] = NULL; }; printf(counter.c_str()); counter=""; SDL_Delay(10); } // //Render splash // for (int i=0 ; i<1410; i++) // // { // if (Intro [i]!=NULL) // // { // SDL_DestroyTexture( Intro [i] ); // Intro [i] = NULL; // }; // if (i<910) // Intro [i+500]=texture.loadFromFile( counter.c_str(),gScreenRect.w, gScreenRect.h); // } return true; }
bool loadMedia() { //Loading success flag bool success = true; //Load press texture if( !gPressTexture.loadFromFile( "press.png" ) ) { printf( "Failed to load press texture!\n" ); success = false; } //Load up texture if( !gUpTexture.loadFromFile( "up.png" ) ) { printf( "Failed to load up texture!\n" ); success = false; } //Load down texture if( !gDownTexture.loadFromFile( "down.png" ) ) { printf( "Failed to load down texture!\n" ); success = false; } //Load left texture if( !gLeftTexture.loadFromFile( "left.png" ) ) { printf( "Failed to load left texture!\n" ); success = false; } //Load right texture if( !gRightTexture.loadFromFile( "right.png" ) ) { printf( "Failed to load right texture!\n" ); success = false; } return success; }
int load_media(void) { /* load dot texture */ if (gDotTexture.loadFromFile("dot.bmp") == -1) { fprintf(stderr, "Failed to load dot texture!\n"); return -1; } return 0; }
bool loadMedia() { //Loading success flag bool success = true; //Load arrow if( !gArrowTexture.loadFromFile( "15_rotation_and_flipping/arrow.png" ) ) { printf( "Failed to load arrow texture!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Initialize scene texture if(!g_sceneTexture.loadFromFile("window.png")) { printf("Failed to load window texture!\n"); success = false; } return success; }
int load_media(void) { /* load front alpha texture */ if (gModulatedTexture.loadFromFile("fadeout.png") == -1) { fprintf(stderr, "Failed to load front texture!\n"); return -1; } else { /*set standard alpha blending */ gModulatedTexture.setBlendMode(SDL_BLENDMODE_BLEND); } /* load background texture */ if (gBackgroundTexture.loadFromFile("fadein.png") == -1) { fprintf(stderr, "Failed to load background texture!\n"); return -1; } return 0; }
bool loadMedia() { //Loading success flag bool success = true; //Load Foo' texture if( !gFooTexture.loadFromFile( "assets/10_color_keying/foo.png" ) ) { printf( "Failed to load Foo' texture image!\n" ); success = false; } //Load background texture if( !gBackgroundTexture.loadFromFile( "assets/10_color_keying/background.png" ) ) { printf( "Failed to load background texture image!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load press texture if( !gSplashTexture.loadFromFile( "20_force_feedback/splash.png" ) ) { printf( "Failed to load splash texture!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load dot texture if( !gDotTexture.loadFromFile( "28_per-pixel_collision_detection/dot.bmp" ) ) { printf( "Failed to load dot texture!\n" ); success = false; } return success; }
int load_media(void) { /* load texture */ if (gModulatedTexture.loadFromFile("colors.png") == -1) { fprintf(stderr, "Failed to load colors texture!\n"); return -1; } return 0; }
bool loadMedia() { //Loading success flag bool success = true; //Load texture if( !gModulatedTexture.loadFromFile( "12_color_modulation/colors.png" ) ) { printf( "Failed to load colors texture!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load dot texture if( !gDotTexture.loadFromFile( "44_frame_independent_movement/dot.bmp" ) ) { printf( "Failed to load dot texture!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load prompt texture if( !gPromptTexture.loadFromFile( "images/prompt.png" ) ) { printf( "Failed to load prompt texture!\n" ); success = false; } //Load music gMusic = Mix_LoadMUS( "music/beat.wav" ); if( gMusic == NULL ) { printf( "Failed to load beat music! SDL_mixer Error: %s\n", Mix_GetError() ); success = false; } //Load sound effects gScratch = Mix_LoadWAV( "music/scratch.wav" ); if( gScratch == NULL ) { printf( "Failed to load scratch sound effect! SDL_mixer Error: %s\n", Mix_GetError() ); success = false; } gHigh = Mix_LoadWAV( "music/high.wav" ); if( gHigh == NULL ) { printf( "Failed to load high sound effect! SDL_mixer Error: %s\n", Mix_GetError() ); success = false; } gMedium = Mix_LoadWAV( "music/medium.wav" ); if( gMedium == NULL ) { printf( "Failed to load medium sound effect! SDL_mixer Error: %s\n", Mix_GetError() ); success = false; } gLow = Mix_LoadWAV( "music/low.wav" ); if( gLow == NULL ) { printf( "Failed to load low sound effect! SDL_mixer Error: %s\n", Mix_GetError() ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load press texture if( !gDotTexture.loadFromFile( "dot.bmp" ) ) { printf( "Failed to load dot texture!\n" ); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load splash texture if (!gSplashTexture.loadFromFile("C://Users/Yeis/Documents/SDL_Exercises/CppTesting/SDLSet/Images/splash.png")) { printf("Failed to load splash texture!\n"); success = false; } return success; }
bool loadMedia() { //Loading success flag bool success = true; //Load splash texture if( !gSplashTexture.loadFromFile( "assets/46_multithreading/splash.png" ) ) { printf( "Failed to load splash texture!\n" ); success = false; } return success; }