Fixed per-pixel alpha in keyboard themes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# The application settings for Android libSDL port
|
# The application settings for Android libSDL port
|
||||||
AppSettingVersion=12
|
AppSettingVersion=16
|
||||||
LibSdlVersion=1.2
|
LibSdlVersion=1.2
|
||||||
AppName="Ballfield"
|
AppName="Ballfield"
|
||||||
AppFullName=net.olofson.ballfield
|
AppFullName=net.olofson.ballfield
|
||||||
@@ -10,14 +10,17 @@ SdlVideoResize=y
|
|||||||
SdlVideoResizeKeepAspect=n
|
SdlVideoResizeKeepAspect=n
|
||||||
NeedDepthBuffer=n
|
NeedDepthBuffer=n
|
||||||
AppUsesMouse=n
|
AppUsesMouse=n
|
||||||
AppNeedsArrowKeys=n
|
AppNeedsTwoButtonMouse=n
|
||||||
|
AppNeedsArrowKeys=y
|
||||||
|
AppNeedsTextInput=y
|
||||||
AppUsesJoystick=n
|
AppUsesJoystick=n
|
||||||
AppHandlesJoystickSensitivity=n
|
AppHandlesJoystickSensitivity=n
|
||||||
AppUsesMultitouch=n
|
AppUsesMultitouch=n
|
||||||
NonBlockingSwapBuffers=n
|
NonBlockingSwapBuffers=n
|
||||||
RedefinedKeys="SPACE RETURN"
|
RedefinedKeys="SPACE RETURN"
|
||||||
AppTouchscreenKeyboardKeysAmount=1
|
AppTouchscreenKeyboardKeysAmount=7
|
||||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
AppTouchscreenKeyboardKeysAmountAutoFire=2
|
||||||
|
RedefinedKeysScreenKb="SPACE RETURN"
|
||||||
MultiABI=n
|
MultiABI=n
|
||||||
AppVersionCode=101
|
AppVersionCode=101
|
||||||
AppVersionName="1.01"
|
AppVersionName="1.01"
|
||||||
@@ -27,4 +30,5 @@ AppCflags='-O2 -finline-functions'
|
|||||||
AppLdflags=''
|
AppLdflags=''
|
||||||
AppSubdirsBuild=''
|
AppSubdirsBuild=''
|
||||||
AppUseCrystaXToolchain=n
|
AppUseCrystaXToolchain=n
|
||||||
|
AppCmdline=''
|
||||||
ReadmeText='^'
|
ReadmeText='^'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
fheroes2
|
ballfield
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -18,8 +18,29 @@ main(int argc, char *argv[])
|
|||||||
SDL_Surface * src = IMG_Load(argv[1]);
|
SDL_Surface * src = IMG_Load(argv[1]);
|
||||||
if(!src)
|
if(!src)
|
||||||
return 1;
|
return 1;
|
||||||
SDL_Surface * format1 = SDL_CreateRGBSurface( SDL_SWSURFACE|SDL_SRCALPHA, 1, 1, 16, 0xF800, 0x7C0, 0x3E, 0x1 );
|
bool perPixeAlpha = false;
|
||||||
if( argc >= 4 )
|
if( argc >= 4 )
|
||||||
|
perPixeAlpha = true;
|
||||||
|
if( src->format->BitsPerPixel == 32 )
|
||||||
|
{
|
||||||
|
for( int i = 0; i < src->h; i++ )
|
||||||
|
{
|
||||||
|
for( int ii = 0; ii < src->w; ii++ )
|
||||||
|
{
|
||||||
|
Uint32 alpha = (* (Uint32 *) ((Uint8 *)src->pixels + i*src->pitch + ii*4)) & src->format->Amask;
|
||||||
|
if( src->format->Amask >= 0x000000ff )
|
||||||
|
alpha /= 0x1000000;
|
||||||
|
if( alpha > 15 && alpha < 240 )
|
||||||
|
{
|
||||||
|
perPixeAlpha = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("Converter: %s BPP %d %dx%d perPixeAlpha %d\n", argv[1], src->format->BitsPerPixel, src->w, src->h, (int)perPixeAlpha);
|
||||||
|
SDL_Surface * format1 = SDL_CreateRGBSurface( SDL_SWSURFACE|SDL_SRCALPHA, 1, 1, 16, 0xF800, 0x7C0, 0x3E, 0x1 );
|
||||||
|
if( perPixeAlpha )
|
||||||
format1 = SDL_CreateRGBSurface( SDL_SWSURFACE|SDL_SRCALPHA, 1, 1, 16, 0xF000, 0xF00, 0xF0, 0xF );
|
format1 = SDL_CreateRGBSurface( SDL_SWSURFACE|SDL_SRCALPHA, 1, 1, 16, 0xF000, 0xF00, 0xF0, 0xF );
|
||||||
if(!format1)
|
if(!format1)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -33,13 +54,13 @@ main(int argc, char *argv[])
|
|||||||
fwrite( &w, 1, 4, ff );
|
fwrite( &w, 1, 4, ff );
|
||||||
int h = htonl(dst->h);
|
int h = htonl(dst->h);
|
||||||
fwrite( &h, 1, 4, ff );
|
fwrite( &h, 1, 4, ff );
|
||||||
int format = htonl(argc <= 3 ? 0 : 1);
|
int format = htonl(perPixeAlpha ? 1 : 0);
|
||||||
fwrite( &format, 1, 4, ff );
|
fwrite( &format, 1, 4, ff );
|
||||||
for( int i = 0; i < dst->h; i++ )
|
for( int i = 0; i < dst->h; i++ )
|
||||||
{
|
{
|
||||||
for( int ii = 0; ii < dst->w; ii++ )
|
for( int ii = 0; ii < dst->w; ii++ )
|
||||||
{
|
{
|
||||||
if(* (Uint16 *) ((Uint8 *)dst->pixels + i*dst->pitch + ii*2) & 0x1 == 0 && argc <= 3)
|
if(* (Uint16 *) ((Uint8 *)dst->pixels + i*dst->pitch + ii*2) & 0x1 == 0 && ! perPixeAlpha)
|
||||||
* (Uint16 *) ((Uint8 *)dst->pixels + i*dst->pitch + ii*2) = 0;
|
* (Uint16 *) ((Uint8 *)dst->pixels + i*dst->pitch + ii*2) = 0;
|
||||||
fwrite( (Uint8 *)dst->pixels + i*dst->pitch + ii*2, 1, 2, ff );
|
fwrite( (Uint8 *)dst->pixels + i*dst->pitch + ii*2, 1, 2, ff );
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user