bool TFour::loadMedia(){ bool success = true; gKeyPressSurfaces[DEFAULT] = loadSurface("images/T4/default.bmp"); if(gKeyPressSurfaces[DEFAULT] == NULL){ std::cout<<"Error: "<<SDL_GetError()<<std::endl; success = false; } gKeyPressSurfaces[UP] = loadSurface("images/T4/up.bmp"); if(gKeyPressSurfaces[UP] == NULL){ std::cout<<"Error: "<<SDL_GetError()<<std::endl; success = false; } gKeyPressSurfaces[DOWN] = loadSurface("images/T4/down.bmp"); if(gKeyPressSurfaces[DOWN] == NULL){ std::cout<<"Error: "<<SDL_GetError()<<std::endl; success = false; } gKeyPressSurfaces[LEFT] = loadSurface("images/T4/left.bmp"); if(gKeyPressSurfaces[LEFT] == NULL){ std::cout<<"Error: "<<SDL_GetError()<<std::endl; success = false; } gKeyPressSurfaces[RIGHT] = loadSurface("images/T4/right.bmp"); if(gKeyPressSurfaces[RIGHT] == NULL){ std::cout<<"Error: "<<SDL_GetError()<<std::endl; success = false; } return success; }
bool loadMedia() { bool success = true; gKeyPressSurfaces[KEY_PRESS_SURFACE_DEFAULT] = loadSurface("04_key_presses/press.bmp"); if (gKeyPressSurfaces == NULL) { std::cout << "Bitmap could not be loaded! SDL_Error: " << SDL_GetError() << "\n"; success = false; } gKeyPressSurfaces[KEY_PRESS_SURFACE_UP] = loadSurface("04_key_presses/up.bmp"); if (gKeyPressSurfaces == NULL) { std::cout << "Bitmap could not be loaded! SDL_Error: " << SDL_GetError() << "\n"; success = false; } gKeyPressSurfaces[KEY_PRESS_SURFACE_DOWN] = loadSurface("04_key_presses/down.bmp"); if (gKeyPressSurfaces == NULL) { std::cout << "Bitmap could not be loaded! SDL_Error: " << SDL_GetError() << "\n"; success = false; } gKeyPressSurfaces[KEY_PRESS_SURFACE_LEFT] = loadSurface("04_key_presses/left.bmp"); if (gKeyPressSurfaces == NULL) { std::cout << "Bitmap could not be loaded! SDL_Error: " << SDL_GetError() << "\n"; success = false; } gKeyPressSurfaces[KEY_PRESS_SURFACE_RIGHT] = loadSurface("04_key_presses/right.bmp"); if (gKeyPressSurfaces == NULL) { std::cout << "Bitmap could not be loaded! SDL_Error: " << SDL_GetError() << "\n"; success = false; } return success; }
bool loadMedia() { bool success = true; keyPressSurfaces[KEY_PRESS_SURFACE_DEFAULT] = loadSurface("press.bmp"); if (keyPressSurfaces[KEY_PRESS_SURFACE_DEFAULT] == NULL) { printf("Failed to load default image. \n"); success = false; } keyPressSurfaces[KEY_PRESS_SURFACE_UP] = loadSurface("up.bmp"); if (keyPressSurfaces[KEY_PRESS_SURFACE_UP] == NULL) { printf("Failed to load up image. \n"); success = false; } keyPressSurfaces[KEY_PRESS_SURFACE_DOWN] = loadSurface("down.bmp"); if (keyPressSurfaces[KEY_PRESS_SURFACE_DOWN] == NULL) { printf("Failed to load down image. \n"); success = false; } keyPressSurfaces[KEY_PRESS_SURFACE_LEFT] = loadSurface("left.bmp"); if (keyPressSurfaces[KEY_PRESS_SURFACE_LEFT] == NULL) { printf("Failed to load left image. \n"); success = false; } keyPressSurfaces[KEY_PRESS_SURFACE_RIGHT] = loadSurface("right.bmp"); if (keyPressSurfaces[KEY_PRESS_SURFACE_RIGHT] == NULL) { printf("Failed to load right image. \n"); success = false; } return success; }
Surface* loadRgbaSurface(const char* filename) override { int old_color_conv = _color_conv; set_color_conversion(COLORCONV_NONE); Surface* sur = loadSurface(filename); set_color_conversion(old_color_conv); return sur; }
bool CCage::PreEnterViewMsg(CPreEnterViewMsg *msg) { loadSurface(); _open = CParrot::_v4 != 0; loadFrame(_open ? 8 : 0); return true; }
// loads media bool ExtLoadApp::loadMedia() { bool success = true; // try changing this to vector later // gKeyPressSurfaces[KEY_PRESS_SURFACE_DEFAULT] = loadSurface("minecraft24.bmp"); gKeyPressSurfaces.push_back(loadSurface("minecraft24.png")); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_DEFAULT] == nullptr) { std::cout << "Failed to load image: " << "minecraft24" << std::endl; success = false; } // gKeyPressSurfaces[KEY_PRESS_SURFACE_UP] = loadSurface("minecraft24_UP.bmp")); gKeyPressSurfaces.push_back(loadSurface("minecraft24_UP.png")); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_UP] == nullptr) { std::cout << "Failed to load image: " << "mincraft24_UP.bmp" << std::endl; success = false; } // gKeyPressSurfaces[KEY_PRESS_SURFACE_DOWN] = loadSurface("minecraft24_DOWN.bmp"); gKeyPressSurfaces.push_back(loadSurface("minecraft24_DOWN.png")); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_DOWN] == nullptr) { std::cout << "Failed to load image: " << "minecraft24_DOWN.bmp" << std::endl; success = false; } // gKeyPressSurfaces[KEY_PRESS_SURFACE_LEFT] = loadSurface("minecraft24_LEFT.bmp"); gKeyPressSurfaces.push_back(loadSurface("minecraft24_LEFT.png")); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_LEFT] == nullptr) { std::cout << "Failed to load image: " << "minecraft24_LEFT.bmp" << std::endl; success = false; } // gKeyPressSurfaces[KEY_PRESS_SURFACE_RIGHT] = loadSurface("minecraft24_RIGHT.bmp"); gKeyPressSurfaces.push_back(loadSurface("minecraft24_RIGHT.png")); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_RIGHT] == nullptr) { std::cout << "Failed to load image: " << "minecraft24_RIGHT.bmp" << std::endl; success = false; } return success; }
bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) { loadSurface(); CCarryParrot *parrot = dynamic_cast<CCarryParrot *>(getRoot()->findByName("CarryParrot")); if (parrot) parrot->_fieldE0 = 0; return true; }
//loads media bool loadMedia() { bool success = true; //load default surface key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_DEFAULT] = loadSurface("../data/press.bmp"); if(key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_DEFAULT] == nullptr) { std::cout << "Failed to load default image!" << std::endl; success = false; } //load up surface key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_UP] = loadSurface("../data/up.bmp"); if(key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_UP] == nullptr) { std::cout << "Failed to load default image!" << std::endl; success = false; } //load down surface key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_DOWN] = loadSurface("../data/down.bmp"); if(key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_DEFAULT] == nullptr) { std::cout << "Failed to load default image!" << std::endl; success = false; } //load left surface key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_LEFT] = loadSurface("../data/left.bmp"); if(key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_LEFT] == nullptr) { std::cout << "Failed to load default image!" << std::endl; success = false; } //load right surface key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_RIGHT] = loadSurface("../data/right.bmp"); if(key_press_surfaces[KeyPressSurfaces::KEY_PRESS_SURFACE_RIGHT] == nullptr) { std::cout << "Failed to load default image!" << std::endl; success = false; } return success; }
void COpenGL::updateScreen() { glEnable(GL_TEXTURE_2D); // Set up an array of values to use as the sprite vertices. GLfloat vertices[] = { 0, 0, 1, 0, 1, 1, 0, 1, }; // Set up an array of values for the texture coordinates. GLfloat texcoords[] = { 0, 0, 1, 0, 1, 1, 0, 1, }; //Render the vertices by pointing to the arrays. glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vertices); glTexCoordPointer(2, GL_FLOAT, 0, texcoords); glEnable(GL_BLEND); if(m_VidConfig.m_ScaleXFilter > 1) { if(getPerSurfaceAlpha(FXSurface)) SDL_BlitSurface(FXSurface, NULL, BlitSurface, NULL); } loadSurface(m_texture, BlitSurface); renderTexture(m_texture); if(m_VidConfig.m_ScaleXFilter == 1) { if(FXSurface && getPerSurfaceAlpha(FXSurface)) { reloadFX(FXSurface); renderTexture(m_texFX, true); } } glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); g_pInput->renderOverlay(); SDL_GL_SwapBuffers(); }
bool loadMedia() { bool success = true; stretchedSurface = loadSurface("loaded.png"); if (stretchedSurface == NULL) { printf("There was an error while trying to load the stretched image.\nSDL Error: %s\n", SDL_GetError()); success = false; } return success; }
void Board::loadBackground() { HelloWorld = loadSurface("assets/Board.png"); if( HelloWorld == NULL ) printf( "Unable to load image %s! SDL Error: %s\n", "assets/Board.png", SDL_GetError() ); SDL_BlitSurface( HelloWorld, NULL, screenSurface, NULL ); }
surfDepValues *determineSurfaceDepthsBasin(globalBasinData *basinData ,gridStruct *location, char *fileName, int basinNum, int surfNum) /* Purpose: obtain the depths for all lat lon points within the for a given surface file Input variables: location - structure containing lat lon grid fileName - filename of the surface file for reading Output variables: surfDep - (malloc'd) pointer to structure containing surface depths for all lat lon points */ { // read in the filename surfRead *currentSurface; currentSurface = loadSurface(fileName); surfDepValues *surfDep; surfDep = malloc(sizeof(surfDepValues)); adjacentPointsStruct *points; // loop over values and find the depth of the surface at all points (2D interpolation) for(int i = 0; i < location->nX; i++) { for(int j = 0; j < location->nY; j++) { if(basinData->inBasinLatLon[basinNum][basinData->boundaryType[basinNum][surfNum]][i][j] == 1) { // find adjacent points points = findAdjacentPoints(currentSurface, location->Lat[i][j], location->Lon[i][j]); // printf("%lf %lf\n",location->Lat[i][j], location->Lon[i][j]); // printf("%i\n",basinData->inBasinLatLon[basinNum][basinData->boundaryType[basinNum][surfNum]][i][j]); if (points->inSurfaceBounds == 1) { // interpolate surfDep->dep[i][j] = biLinearInterpolation( currentSurface->loni[points->lonInd[0]], currentSurface->loni[points->lonInd[1]], currentSurface->lati[points->latInd[0]], currentSurface->lati[points->latInd[1]], currentSurface->raster[points->lonInd[0]][points->latInd[0]], currentSurface->raster[points->lonInd[0]][points->latInd[1]], currentSurface->raster[points->lonInd[1]][points->latInd[0]], currentSurface->raster[points->lonInd[1]][points->latInd[1]], location->Lon[i][j], location->Lat[i][j]); free(points); } else { printf("%lf %lf\n",location->Lat[i][j], location->Lon[i][j]); printf("Error, point lies outside basin surface domain.\n"); } } else { surfDep->dep[i][j] = NAN; // define as NAN if surface is outside of the boundary } } } free(currentSurface); return surfDep; }
void Game::helpThirdScreen() { SDL_Surface* helpThird = NULL; helpThird = loadSurface("resources//images//help//helpThird.png"); SDL_BlitSurface(helpThird,NULL,getSurface(),NULL); menuButtons[7].draw(); menuButtons[9].draw(); mouseCursor(); SDL_UpdateWindowSurface(window); SDL_FreeSurface(helpThird); helpThird = NULL; }
bool loadMedia() { bool l_success = true; //Load stretching surface g_pngSurface = loadSurface("image.png"); if(g_pngSurface == NULL) { printf("Failed to load image.png! \n"); l_success = false; } return l_success; }
//for textures SDL_Texture* Renderer::loadTexture(char* File) { SDL_Surface* newSurface = loadSurface(File); if (newSurface != NULL) { SDL_Texture* newTexture = SDL_CreateTextureFromSurface(Renderer::g_renderer, newSurface); SDL_FreeSurface(newSurface); return newTexture; } else { return NULL; } }
void Game::helpWindowScreen() { SDL_Surface* helpImage = NULL; helpImage = loadSurface("resources//images//help//helpFirst.png"); SDL_BlitSurface(helpImage,NULL,getSurface(),NULL); menuButtons[7].draw(); menuButtons[8].draw(); mouseCursor(); SDL_UpdateWindowSurface(window); SDL_FreeSurface(helpImage); helpImage = NULL; }
Drawable::Drawable(SDL_Surface* screen, std::string imageloc) : m_screen(screen), m_center(0, 0) { loadSurface(imageloc); m_drawablezoomsurf = rotozoomSurface(m_drawablesurf, 0.0, 1, 1); m_pos.w = m_drawablezoomsurf->w; m_pos.h = m_drawablezoomsurf->h; setTopLeftPos(); }
void Game::statsWindowScreen() { SDL_Surface* statsScreen = NULL; statsScreen = loadSurface("resources//images//background//background2.png"); SDL_BlitSurface(statsScreen,NULL,getSurface(),NULL); printStatisticData(); menuButtons[7].draw(); mouseCursor(); SDL_UpdateWindowSurface(window); SDL_FreeSurface(statsScreen); statsScreen = NULL; }
bool loadMedia() { //Loading success flag bool success = true; //Load default surface gKeyPressSurfaces[KEY_PRESS_SURFACE_DEFAULT] = loadSurface("press.bmp"); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_DEFAULT] == NULL) { printf("Failed to load default image!\n"); success = false; } //Load up surface gKeyPressSurfaces[KEY_PRESS_SURFACE_UP] = loadSurface("up.bmp"); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_UP] == NULL) { printf("Failed to load up image!\n"); success = false; } //Load down surface gKeyPressSurfaces[KEY_PRESS_SURFACE_DOWN] = loadSurface("down.bmp"); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_DOWN] == NULL) { printf("Failed to load down image!\n"); success = false; } //Load left surface gKeyPressSurfaces[KEY_PRESS_SURFACE_LEFT] = loadSurface("left.bmp"); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_LEFT] == NULL) { printf("Failed to load left image!\n"); success = false; } //Load right surface gKeyPressSurfaces[KEY_PRESS_SURFACE_RIGHT] = loadSurface("right.bmp"); if (gKeyPressSurfaces[KEY_PRESS_SURFACE_RIGHT] == NULL) { printf("Failed to load right image!\n"); success = false; } //Load stretching surface gStretchedSurface = loadSurface("stretch.bmp"); if (gStretchedSurface == NULL) { printf("Failed to load stretching image!\n"); success = false; } //Load PNG surface gPNGSurface = loadSurface("loaded.png"); if (gPNGSurface == NULL) { printf("Failed to load PNG image!\n"); success = false; } return success; }
static bool loadMediaLocal() { //Loading success flag bool success = true; //Load PNG surface gPNGSurface = loadSurface(resources_path("images/lesson06/loaded.png")); if (gPNGSurface == NULL) { printf("Failed to load PNG image!\n"); success = false; } return success; }
//for textures with color key SDL_Texture* Renderer::loadTexture(char* File, Uint32 key) { SDL_Surface* newSurface = loadSurface(File); if (newSurface != NULL) { SDL_SetColorKey(newSurface, SDL_TRUE, key); SDL_Texture* newTexture = SDL_CreateTextureFromSurface(Renderer::g_renderer, newSurface); SDL_FreeSurface(newSurface); return newTexture; } else { return NULL; } }
void Texture::loadImage(const std::string& path) { assert(m_renderer); //SDL_Rect rect = {0, 0, 0, 0}; //m_rect = rect; SDL_Surface* surface = loadSurface(path); m_texture = SDL_CreateTextureFromSurface(m_renderer, surface); SDL_FreeSurface(surface); SDL_QueryTexture(m_texture, NULL, NULL, &m_rect.w, &m_rect.h); }
//loads media bool loadMedia() { bool success = true; //load splash image hello_world = loadSurface("../data/loaded.png"); if(hello_world == nullptr) { std::cout << "Unable to load image! SDL_Error: " << SDL_GetError() << std::endl; success = false; } return success; }
bool RenderManagerGP2X::setBackground(const std::string& filename) { try { SDL_Surface *tempBackground = loadSurface(filename); mBackground = SDL_DisplayFormat(tempBackground); SDL_FreeSurface(tempBackground); } catch (FileLoadException) { return false; } return true; }
Image *ImageHelper::load(SDL_RWops *const rw) { SDL_Surface *const tmpImage = loadPng(rw); if (!tmpImage) { logger->log("Error, image load failed: %s", IMG_GetError()); return nullptr; } Image *const image = loadSurface(tmpImage); MSDL_FreeSurface(tmpImage); return image; }
void loadAllKeySurfaces() { //Load default surface gKeyPressSurfaces[ KEY_PRESS_SURFACE_DEFAULT ] = loadSurface( "resources/press.bmp" ); if( gKeyPressSurfaces[ KEY_PRESS_SURFACE_DEFAULT ] == NULL ) { printf( "Failed to load default image!\n" ); } //Load up surface gKeyPressSurfaces[ KEY_PRESS_SURFACE_UP ] = loadSurface( "resources/up.bmp" ); if( gKeyPressSurfaces[ KEY_PRESS_SURFACE_UP ] == NULL ) { printf( "Failed to load up image!\n" ); } //Load down surface gKeyPressSurfaces[ KEY_PRESS_SURFACE_DOWN ] = loadSurface( "resources/down.bmp" ); if( gKeyPressSurfaces[ KEY_PRESS_SURFACE_DOWN ] == NULL ) { printf( "Failed to load down image!\n" ); } //Load left surface gKeyPressSurfaces[ KEY_PRESS_SURFACE_LEFT ] = loadSurface( "resources/left.bmp" ); if( gKeyPressSurfaces[ KEY_PRESS_SURFACE_LEFT ] == NULL ) { printf( "Failed to load left image!\n" ); } //Load right surface gKeyPressSurfaces[ KEY_PRESS_SURFACE_RIGHT ] = loadSurface( "resources/right.bmp" ); if( gKeyPressSurfaces[ KEY_PRESS_SURFACE_RIGHT ] == NULL ) { printf( "Failed to load right image!\n" ); } }
LTexture::LTexture(SDL_Renderer *ren, std::string path) : mRen(ren), mTexture(nullptr), w(0), h(0) { SDL_Surface *tmp = loadSurface(path); if (!tmp) throw; SDL_SetColorKey(tmp, true, SDL_MapRGB(tmp->format, 0xFF, 0, 0xFF)); mTexture = SDL_CreateTextureFromSurface(ren, tmp); w = tmp->w; h = tmp->h; SDL_FreeSurface(tmp); if (!mTexture) { Log("Unable to create texture from surface : %s\n", path.c_str()); throw; } }
bool loadMedia() { //Loading success flag bool success = true; //Load PNG surface gPNGSurface = loadSurface("loaded.png"); if (gPNGSurface == NULL) { printf("Failed to load PNG image!\n"); success = false; } return success; }
SDL_Texture* SDL::loadTexture( string filename ) { map<string,SDL_Texture*>::iterator iter = texes.find( filename ); if( iter != texes.end() ) { warning( "%s already loaded", filename.c_str() ); return iter->second; } SDL_Texture* tex = SDL_CreateTextureFromSurface( renderer, loadSurface(filename) ); if( !tex ) error( "loadTexture: SDL_CreateTextureFromSurface failed %s %s", filename.c_str(), SDL_GetError() ); SDL_SetTextureBlendMode( tex, SDL_BLENDMODE_BLEND ); texes[ filename ] = tex; return tex; }
bool loadMedia() { //Loading success flag bool success = true; //Load stretching surface gStretchedSurface = loadSurface("stretch.bmp"); if (gStretchedSurface == NULL) { printf("Failed to load stretching image!\n"); success = false; } return success; }