Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 |
/**
Once you are done trying to ‘optimize’ this routine,
and have realized what a terrible mistake that was,
please increment the following counter as a warning
to the next guy:
total_hours_wasted_here = 11
*/
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »xXSlayerXx« (12.02.2013, 19:57)
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
//Include SDL functions and datatypes #include "SDL/SDL.h" void LadeBild(SDL_Surface* screen, SDL_Surface* hello, SDL_Surface* eplogo, SDL_Surface* eplogo2,SDL_Rect *rect, SDL_Rect *Coords); int main( int argc, char* args[] ) { //The images SDL_Surface* hello = NULL; SDL_Surface* screen = NULL; SDL_Surface *eplogo = NULL; SDL_Surface *eplogo2 = NULL; eplogo = SDL_LoadBMP("Grassland.bmp"); eplogo2 = SDL_LoadBMP("Weg.bmp"); SDL_Rect Coords; Coords.x = 0; Coords.y=0; Coords.h = 50; Coords.w = 50; SDL_Rect rect; rect.x=0; rect.y=0; rect.h=50; rect.w=50; //Start SDL SDL_Init( SDL_INIT_EVERYTHING ); //Set Screen screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE ); //Load image hello = SDL_LoadBMP( "hello.bmp" ); LadeBild(screen, hello, eplogo, eplogo2, &rect,&Coords); //Quit SDL SDL_Quit(); return 0; } void LadeBild(SDL_Surface* screen, SDL_Surface* hello, SDL_Surface* eplogo, SDL_Surface* eplogo2, SDL_Rect *rect, SDL_Rect *Coords ) { //Apply image to screen SDL_BlitSurface( hello, NULL, screen, NULL ); //Update Screen SDL_Flip( screen ); //Pause SDL_Delay( 2000 ); //Apply image to screen SDL_BlitSurface( eplogo, NULL, screen, NULL ); //Update Screen SDL_Flip( screen ); //Pause SDL_Delay( 2000 ); //Free the loaded image SDL_FreeSurface( hello ); } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 |
//Load image hello = SDL_LoadBMP( "hello.bmp" ); //Quit SDL SDL_Quit(); //Pause SDL_Delay( 2000 ); //Free the loaded image SDL_FreeSurface( hello ); |
void LadeBild(SDL_Surface* screen, SDL_Surface* hello, SDL_Surface* eplogo, SDL_Surface* eplogo2,SDL_Rect *rect, SDL_Rect *Coords);
Ich habe jetzt eine Figur, die über eine Map läuft, allerdings wird diese immer neu auf den Bildschirm geladen, und nicht wieder gelöscht.
Werbeanzeige