SDL 1.2 now works in SW mode, though it's really slow (that was Alien Blaster drawing to wrong surface)

This commit is contained in:
pelya
2010-07-21 16:46:27 +03:00
parent 959af7a7f3
commit a2cecdf9f4
4 changed files with 11 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
LibSdlVersion=1.3
LibSdlVersion=1.2
AppName="Alien Blaster"
AppFullName=de.schwardtnet.alienblaster
ScreenOrientation=h

View File

@@ -130,7 +130,7 @@ typedef SDL_Surface SdlCompat_AcceleratedSurface;
static inline SdlCompat_AcceleratedSurface * SdlCompat_CreateAcceleratedSurface(SDL_Surface * surface)
{
return SDL_ConvertSurface(surface, surface->format, 0); // Just copy it
return SDL_ConvertSurface(surface, surface->format, surface->flags | SDL_HWSURFACE);
};
#endif

View File

@@ -54,6 +54,7 @@ SdlCompat_AcceleratedSurface *Video::init(){
__android_log_print(ANDROID_LOG_ERROR, "Alien Blaster", "Couldn't set %dx%d, %dbit video mode: %s\n", SCREEN_WIDTH, SCREEN_HEIGHT, BIT_DEPTH, SDL_GetError());
exit(2);
}
#if SDL_VERSION_ATLEAST(1,3,0)
// Dummy texture
screen2 = SDL_CreateRGBSurface( 0, 16, 16, 16, 0xff, 0x00ff, 0x0000ff, 0 );
SDL_Surface * screen3 = SDL_DisplayFormat( screen2 );
@@ -62,17 +63,19 @@ SdlCompat_AcceleratedSurface *Video::init(){
screen->w = SCREEN_WIDTH;
screen->h = SCREEN_HEIGHT;
SDL_FreeSurface(screen3);
#else
screen = screen2;
#endif
SDL_WM_SetCaption("AlienBlaster", "AlienBlaster");
SDL_WM_SetIcon(SDL_LoadBMP( FN_ALIENBLASTER_ICON.c_str() ), NULL);
SDL_ShowCursor(SDL_DISABLE);
__android_log_print(ANDROID_LOG_INFO, "Alien Blaster", "Initializing video done");
screen3 = SDL_CreateRGBSurface( 0, 16, 16, 16, 0xff, 0x00ff, 0x0000ff, 0 );
SDL_FillRect(screen3, NULL, SDL_MapRGB(screen3->format, 0, 0, 0) );
empty = SdlCompat_CreateAcceleratedSurface(screen3);
SDL_FreeSurface(screen3);
SDL_Surface * empty2 = SDL_CreateRGBSurface( 0, 16, 16, 16, 0xff, 0x00ff, 0x0000ff, 0 );
SDL_FillRect(empty2, NULL, SDL_MapRGB(empty2->format, 0, 0, 0) );
empty = SdlCompat_CreateAcceleratedSurface(empty2);
SDL_FreeSurface(empty2);
return screen;
}

View File

@@ -1 +1 @@
../sdl/sdl-1.3
../sdl/sdl-1.2