SDL: Retro keyboard theme by Santiago Radeff

This commit is contained in:
Sergii Pylypenko
2015-01-19 21:38:20 +02:00
parent 06bd08edb1
commit 4b91a33443
61 changed files with 122 additions and 51 deletions

View File

@@ -301,10 +301,11 @@ echo "# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separate
echo RedefinedKeysScreenKbNames=\"$RedefinedKeysScreenKbNames\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# On-screen keys theme" >> AndroidAppSettings.cfg
echo "# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick)" >> AndroidAppSettings.cfg
echo "# 1 = Simple Theme by Beholder (white, with gamepad joystick)" >> AndroidAppSettings.cfg
echo "# 0 = Ultimate Droid by Sean Stieber (green, with cross joystick)" >> AndroidAppSettings.cfg
echo "# 1 = Simple Theme by Beholder (white, with cross joystick)" >> AndroidAppSettings.cfg
echo "# 2 = Sun by Sirea (yellow, with round joystick)" >> AndroidAppSettings.cfg
echo "# 3 = Keen by Gerstrong (multicolor, with round joystick)" >> AndroidAppSettings.cfg
echo "# 4 = Retro by Santiago Radeff (red/white, with cross joystick)" >> AndroidAppSettings.cfg
echo TouchscreenKeysTheme=$TouchscreenKeysTheme >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Redefine gamepad keys to SDL keysyms, button order is:" >> AndroidAppSettings.cfg

View File

@@ -674,25 +674,19 @@ class Settings
{
if(Globals.TouchscreenKeyboardTheme < 0)
Globals.TouchscreenKeyboardTheme = 0;
if(Globals.TouchscreenKeyboardTheme > 3)
Globals.TouchscreenKeyboardTheme = 3;
if(Globals.TouchscreenKeyboardTheme > 4)
Globals.TouchscreenKeyboardTheme = 4;
if( Globals.TouchscreenKeyboardTheme == 0 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
}
if( Globals.TouchscreenKeyboardTheme == 1 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
}
if( Globals.TouchscreenKeyboardTheme == 2 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
}
if( Globals.TouchscreenKeyboardTheme == 3 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
}
if( Globals.TouchscreenKeyboardTheme == 4 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
}
}

View File

@@ -194,7 +194,8 @@ class SettingsMenuKeyboard extends SettingsMenu
p.getResources().getString(R.string.controls_screenkb_by, "Ultimate Droid", "Sean Stieber"),
p.getResources().getString(R.string.controls_screenkb_by, "Simple Theme", "Beholder"),
p.getResources().getString(R.string.controls_screenkb_by, "Sun", "Sirea"),
p.getResources().getString(R.string.controls_screenkb_by, "Keen", "Gerstrong")
p.getResources().getString(R.string.controls_screenkb_by, "Keen", "Gerstrong"),
p.getResources().getString(R.string.controls_screenkb_by, "Retro", "Santiago Radeff")
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);

View File

@@ -131,13 +131,13 @@ AppNeedsTextInput=y
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
# This will disable AppNeedsArrowKeys option
AppUsesJoystick=y
AppUsesJoystick=n
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
AppUsesSecondJoystick=y
AppUsesSecondJoystick=n
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
AppUsesThirdJoystick=
AppUsesThirdJoystick=n
# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7
AppUsesAccelerometer=y

View File

@@ -86,7 +86,7 @@ typedef struct
GLfloat h;
} GLTexture_t;
static GLTexture_t arrowImages[5];
static GLTexture_t arrowImages[9];
static GLTexture_t buttonAutoFireImages[MAX_BUTTONS_AUTOFIRE*2]; // These are not used anymore
static GLTexture_t buttonImages[MAX_BUTTONS*2];
static GLTexture_t mousePointer;
@@ -281,23 +281,48 @@ static void drawTouchscreenKeyboardLegacy()
int i;
float blendFactor;
blendFactor = ( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] ? 1 : 0 );
if( blendFactor == 0 || SDL_ANDROID_joysticksAmount >= 1 )
drawCharTex( &arrowImages[0], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else
if( arrowImages[8].id == 0 ) // No diagonal arrow images
{
if( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] )
drawCharTex( &arrowImages[1], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] )
drawCharTex( &arrowImages[2], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] )
drawCharTex( &arrowImages[3], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] )
drawCharTex( &arrowImages[4], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
blendFactor = ( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] ? 1 : 0 );
if( blendFactor == 0 || SDL_ANDROID_joysticksAmount >= 1 )
drawCharTex( &arrowImages[0], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else
{
if( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] )
drawCharTex( &arrowImages[1], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] )
drawCharTex( &arrowImages[2], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] )
drawCharTex( &arrowImages[3], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] )
drawCharTex( &arrowImages[4], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency / blendFactor );
}
}
else // Diagonal arrow images present
{
if( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] && SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] )
drawCharTex( &arrowImages[5], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else if( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] && SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] )
drawCharTex( &arrowImages[6], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else if( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] && SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] )
drawCharTex( &arrowImages[7], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else if( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] && SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] )
drawCharTex( &arrowImages[8], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else if( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] )
drawCharTex( &arrowImages[1], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else if( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] )
drawCharTex( &arrowImages[2], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else if( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] )
drawCharTex( &arrowImages[3], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else if( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] )
drawCharTex( &arrowImages[4], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
else
drawCharTex( &arrowImages[0], NULL, &arrowsDraw[0], 1.0f, 1.0f, 1.0f, transparency );
}
if( SDL_ANDROID_joysticksAmount >= 2 )
drawCharTex( &arrowImages[0], NULL, &arrowsDraw[1], 1.0f, 1.0f, 1.0f, transparency );
if( SDL_ANDROID_joysticksAmount >= 3 )
@@ -851,15 +876,15 @@ static int setupScreenKeyboardButtonLegacy( int buttonID, Uint8 * charBuf )
if( buttonID < 5 )
data = &(arrowImages[buttonID]);
else
if( buttonID < 9 )
else if( buttonID < 9 )
data = &(buttonAutoFireImages[buttonID-5]);
else
else if( buttonID < 23 )
data = &(buttonImages[buttonID-9]);
if( buttonID == 23 )
else if( buttonID == 23 )
data = &mousePointer;
else if( buttonID > 22 ) // Error, array too big
else if( buttonID < 28 )
data = &(arrowImages[buttonID - 24 + 5]); // Diagonal arrows
else // Error, array too big
return 12; // Return value bigger than zero to iterate it
return setupScreenKeyboardButtonTexture(data, charBuf);
@@ -900,19 +925,19 @@ static int setupScreenKeyboardButtonSun( int buttonID, Uint8 * charBuf )
static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf, int count )
{
if(count == 24)
if( count == 24 || count == 28)
{
sunTheme = 0;
return setupScreenKeyboardButtonLegacy(buttonID, charBuf);
}
else if(count == 10)
else if( count == 10 )
{
sunTheme = 1;
return setupScreenKeyboardButtonSun(buttonID, charBuf);
}
else
{
__android_log_print(ANDROID_LOG_FATAL, "libSDL", "On-screen keyboard buton img count = %d, should be 10 or 24", count);
__android_log_print(ANDROID_LOG_FATAL, "libSDL", "On-screen keyboard buton img count = %d, should be 10 or 24 or 28", count);
return 12; // Return value bigger than zero to iterate it
}
}

Binary file not shown.

BIN
project/res/raw/retro.raw Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +0,0 @@
all: converter
converter: *.cpp
g++ -g3 -o $@ $? `sdl-config --cflags` `sdl-config --libs` -lSDL_image

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,7 +2,7 @@
# Ultimate Droid by Sean Stieber
[ -x ./converter ] || make || exit 1
[ -x ./converter ] || g++ -g3 -o converter *.cpp `sdl-config --cflags` `sdl-config --libs` -lSDL_image || exit 1
for f in UltimateDroid/*.png; do
newname=`echo $f | sed 's@.*/@@' | tr '[A-Z]' '[a-z]'`.raw
@@ -141,11 +141,10 @@ gzip -9 < ../res/raw/sun.raw > ../res/raw/sun.raw.gz
mv -f ../res/raw/sun.raw.gz ../res/raw/sun.raw
# Keen Icon Set by Gerstrong (Gerhard Stein)
for f in Keen/*.png; do
newname=`echo $f | sed 's@.*/@@' | tr '[A-Z]' '[a-z]'`.raw
./converter $f ../res/raw/$newname 32
./converter $f ../res/raw/$newname 16
done
rm -f ../res/raw/keen.raw
@@ -187,7 +186,63 @@ mouse_pointer \
cat ../res/raw/$F.png.raw >> ../res/raw/keen.raw
done
rm ../res/raw/*.png.raw
gzip -9 < ../res/raw/keen.raw > ../res/raw/keen.raw.gz
mv -f ../res/raw/keen.raw.gz ../res/raw/keen.raw
rm ../res/raw/*.png.raw
# Retro set by Santiago Radeff
for f in Retro/*.png; do
newname=`echo $f | sed 's@.*/@@'`.raw
./converter $f ../res/raw/$newname 16
done
rm -f ../res/raw/retro.raw
printf '\000\000\000\030' > ../res/raw/retro.raw # size, 030 = 24
for F in \
joyPad \
joypadLeft \
joypadRight \
joypadUp \
joypadDown \
\
buttonA-auto \
buttonA-autoAnim \
buttonB-auto \
buttonB-autoAnim \
\
buttonA \
buttonA-Pressed \
buttonB \
buttonB-Pressed \
buttonX \
buttonX-Pressed \
buttonY \
buttonY-Pressed \
buttonL1 \
buttonL1-Pressed \
buttonR1 \
buttonR1-Pressed \
buttonPause \
buttonPause-Pressed \
mousePointer \
\
joypadUpLeft \
joypadUpRight \
joypadDownLeft \
joypadDownRight \
\
; do
if [ \! -e ../res/raw/$F.png.raw ]; then
echo Cannot find ../res/raw/$F.png.raw - check if all files are in place
exit 1
fi
cat ../res/raw/$F.png.raw >> ../res/raw/retro.raw
done
gzip -9 < ../res/raw/retro.raw > ../res/raw/retro.raw.gz
mv -f ../res/raw/retro.raw.gz ../res/raw/retro.raw
rm ../res/raw/*.png.raw