Added Sun keyboard theme by Sirea (Martina Smejkalova)
@@ -1068,7 +1068,8 @@ class Settings
|
|||||||
{
|
{
|
||||||
final CharSequence[] items = {
|
final CharSequence[] items = {
|
||||||
p.getResources().getString(R.string.controls_screenkb_by, "Ultimate Droid", "Sean Stieber"),
|
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, "Simple Theme", "Beholder"),
|
||||||
|
p.getResources().getString(R.string.controls_screenkb_by, "Sun", "Sirea")
|
||||||
};
|
};
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||||
@@ -2558,8 +2559,8 @@ class Settings
|
|||||||
{
|
{
|
||||||
if(Globals.TouchscreenKeyboardTheme < 0)
|
if(Globals.TouchscreenKeyboardTheme < 0)
|
||||||
Globals.TouchscreenKeyboardTheme = 0;
|
Globals.TouchscreenKeyboardTheme = 0;
|
||||||
if(Globals.TouchscreenKeyboardTheme > 1)
|
if(Globals.TouchscreenKeyboardTheme > 2)
|
||||||
Globals.TouchscreenKeyboardTheme = 1;
|
Globals.TouchscreenKeyboardTheme = 2;
|
||||||
|
|
||||||
if( Globals.TouchscreenKeyboardTheme == 0 )
|
if( Globals.TouchscreenKeyboardTheme == 0 )
|
||||||
{
|
{
|
||||||
@@ -2569,6 +2570,10 @@ class Settings
|
|||||||
{
|
{
|
||||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
|
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
|
||||||
}
|
}
|
||||||
|
if( Globals.TouchscreenKeyboardTheme == 2 )
|
||||||
|
{
|
||||||
|
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,24 @@
|
|||||||
# The application settings for Android libSDL port
|
# The application settings for Android libSDL port
|
||||||
AppSettingVersion=16
|
AppSettingVersion=17
|
||||||
LibSdlVersion=1.2
|
LibSdlVersion=1.2
|
||||||
AppName="OpenTyrian"
|
AppName="OpenTyrian"
|
||||||
AppFullName=com.googlecode.opentyrian
|
AppFullName=com.googlecode.opentyrian
|
||||||
ScreenOrientation=h
|
ScreenOrientation=h
|
||||||
InhibitSuspend=n
|
InhibitSuspend=n
|
||||||
AppDataDownloadUrl="Data files size is 11 Mb|tyrian21-data.zip|http://sourceforge.net/projects/libsdl-android/files/OpenTyrian/tyrian21-data.zip/download|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip"
|
AppDataDownloadUrl="Data files size is 11 Mb|tyrian21-data.zip|http://sourceforge.net/projects/libsdl-android/files/OpenTyrian/tyrian21-data.zip/download|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip"
|
||||||
|
VideoDepthBpp=16
|
||||||
|
NeedDepthBuffer=n
|
||||||
|
NeedStencilBuffer=n
|
||||||
|
NeedGles2=n
|
||||||
|
SwVideoMode=y
|
||||||
SdlVideoResize=y
|
SdlVideoResize=y
|
||||||
SdlVideoResizeKeepAspect=n
|
SdlVideoResizeKeepAspect=n
|
||||||
NeedDepthBuffer=n
|
CompatibilityHacks=n
|
||||||
|
CompatibilityHacksStaticInit=n
|
||||||
AppUsesMouse=y
|
AppUsesMouse=y
|
||||||
AppNeedsTwoButtonMouse=n
|
AppNeedsTwoButtonMouse=n
|
||||||
|
ShowMouseCursor=n
|
||||||
|
ForceRelativeMouseMode=n
|
||||||
AppNeedsArrowKeys=y
|
AppNeedsArrowKeys=y
|
||||||
AppNeedsTextInput=y
|
AppNeedsTextInput=y
|
||||||
AppUsesJoystick=n
|
AppUsesJoystick=n
|
||||||
@@ -21,14 +29,18 @@ RedefinedKeys="SPACE RETURN LCTRL LALT SPACE"
|
|||||||
AppTouchscreenKeyboardKeysAmount=4
|
AppTouchscreenKeyboardKeysAmount=4
|
||||||
AppTouchscreenKeyboardKeysAmountAutoFire=1
|
AppTouchscreenKeyboardKeysAmountAutoFire=1
|
||||||
RedefinedKeysScreenKb="SPACE RETURN LCTRL LALT"
|
RedefinedKeysScreenKb="SPACE RETURN LCTRL LALT"
|
||||||
|
StartupMenuButtonTimeout=3000
|
||||||
|
HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig'
|
||||||
|
FirstStartMenuOptions=''
|
||||||
MultiABI=n
|
MultiABI=n
|
||||||
AppVersionCode=2117
|
AppVersionCode=2117
|
||||||
AppVersionName="2.1.17"
|
AppVersionName="2.1.17"
|
||||||
|
ResetSdlConfigForThisVersion=y
|
||||||
|
DeleteFilesOnUpgrade="%"
|
||||||
CompiledLibraries="sdl_net"
|
CompiledLibraries="sdl_net"
|
||||||
CustomBuildScript=n
|
CustomBuildScript=n
|
||||||
AppCflags='-O3'
|
AppCflags='-O3'
|
||||||
AppLdflags=''
|
AppLdflags=''
|
||||||
AppSubdirsBuild=''
|
AppSubdirsBuild=''
|
||||||
AppUseCrystaXToolchain=n
|
|
||||||
AppCmdline=''
|
AppCmdline=''
|
||||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
sdl-1.3-test
|
opentyrian
|
||||||
@@ -70,12 +70,12 @@ SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_5)),
|
|||||||
|
|
||||||
enum { ARROW_LEFT = 1, ARROW_RIGHT = 2, ARROW_UP = 4, ARROW_DOWN = 8 };
|
enum { ARROW_LEFT = 1, ARROW_RIGHT = 2, ARROW_UP = 4, ARROW_DOWN = 8 };
|
||||||
static int oldArrows = 0;
|
static int oldArrows = 0;
|
||||||
static int ButtonAutoFire[MAX_BUTTONS_AUTOFIRE] = {0, 0};
|
static int ButtonAutoFire[MAX_BUTTONS_AUTOFIRE];
|
||||||
static int ButtonAutoFireX[MAX_BUTTONS_AUTOFIRE*2] = {0, 0, 0, 0};
|
static int ButtonAutoFireX[MAX_BUTTONS_AUTOFIRE*2];
|
||||||
static int ButtonAutoFireRot[MAX_BUTTONS_AUTOFIRE] = {0, 0};
|
static int ButtonAutoFireRot[MAX_BUTTONS_AUTOFIRE];
|
||||||
static int ButtonAutoFireDecay[MAX_BUTTONS_AUTOFIRE] = {0, 0};
|
static int ButtonAutoFireDecay[MAX_BUTTONS_AUTOFIRE];
|
||||||
|
|
||||||
static int pointerInButtonRect[MAX_BUTTONS + 1] = {0};
|
static int pointerInButtonRect[MAX_BUTTONS + 1];
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -84,9 +84,9 @@ typedef struct
|
|||||||
GLfloat h;
|
GLfloat h;
|
||||||
} GLTexture_t;
|
} GLTexture_t;
|
||||||
|
|
||||||
static GLTexture_t arrowImages[5] = { {0, 0, 0}, };
|
static GLTexture_t arrowImages[5];
|
||||||
static GLTexture_t buttonAutoFireImages[MAX_BUTTONS_AUTOFIRE*2] = { {0, 0, 0}, };
|
static GLTexture_t buttonAutoFireImages[MAX_BUTTONS_AUTOFIRE*2];
|
||||||
static GLTexture_t buttonImages[MAX_BUTTONS*2] = { {0, 0, 0}, };
|
static GLTexture_t buttonImages[MAX_BUTTONS*2];
|
||||||
static GLTexture_t mousePointer;
|
static GLTexture_t mousePointer;
|
||||||
enum { MOUSE_POINTER_W = 32, MOUSE_POINTER_H = 32, MOUSE_POINTER_X = 5, MOUSE_POINTER_Y = 7 }; // X and Y are offsets of the pointer tip
|
enum { MOUSE_POINTER_W = 32, MOUSE_POINTER_H = 32, MOUSE_POINTER_X = 5, MOUSE_POINTER_Y = 7 }; // X and Y are offsets of the pointer tip
|
||||||
|
|
||||||
@@ -676,25 +676,10 @@ power_of_2(int input)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf )
|
static int setupScreenKeyboardButtonTexture( GLTexture_t * data, Uint8 * charBuf )
|
||||||
{
|
{
|
||||||
// TODO: softstretch with antialiasing
|
int w, h, format, bpp;
|
||||||
int w, h, len, format;
|
|
||||||
GLTexture_t * data = NULL;
|
|
||||||
int texture_w, texture_h;
|
int texture_w, texture_h;
|
||||||
|
|
||||||
if( buttonID < 5 )
|
|
||||||
data = &(arrowImages[buttonID]);
|
|
||||||
else
|
|
||||||
if( buttonID < 9 )
|
|
||||||
data = &(buttonAutoFireImages[buttonID-5]);
|
|
||||||
else
|
|
||||||
data = &(buttonImages[buttonID-9]);
|
|
||||||
|
|
||||||
if( buttonID == 23 )
|
|
||||||
data = &mousePointer;
|
|
||||||
else if( buttonID > 22 ) // Error, array too big
|
|
||||||
return 12; // Return value bigger than zero to iterate it
|
|
||||||
|
|
||||||
memcpy(&w, charBuf, sizeof(int));
|
memcpy(&w, charBuf, sizeof(int));
|
||||||
memcpy(&h, charBuf + sizeof(int), sizeof(int));
|
memcpy(&h, charBuf + sizeof(int), sizeof(int));
|
||||||
@@ -702,7 +687,10 @@ static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf )
|
|||||||
w = ntohl(w);
|
w = ntohl(w);
|
||||||
h = ntohl(h);
|
h = ntohl(h);
|
||||||
format = ntohl(format);
|
format = ntohl(format);
|
||||||
|
bpp = 2;
|
||||||
|
if(format == 2)
|
||||||
|
bpp = 4;
|
||||||
|
|
||||||
texture_w = power_of_2(w);
|
texture_w = power_of_2(w);
|
||||||
texture_h = power_of_2(h);
|
texture_h = power_of_2(h);
|
||||||
data->w = w;
|
data->w = w;
|
||||||
@@ -715,11 +703,11 @@ static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf )
|
|||||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "On-screen keyboard generated OpenGL texture ID %d", data->id);
|
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "On-screen keyboard generated OpenGL texture ID %d", data->id);
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_w, texture_h, 0, GL_RGBA,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_w, texture_h, 0, GL_RGBA,
|
||||||
format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1, NULL);
|
bpp == 4 ? GL_UNSIGNED_BYTE : (format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1), NULL);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA,
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA,
|
||||||
format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1,
|
bpp == 4 ? GL_UNSIGNED_BYTE : (format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1),
|
||||||
charBuf + 3*sizeof(int) );
|
charBuf + 3*sizeof(int) );
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
@@ -727,7 +715,48 @@ static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf )
|
|||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
return 3*sizeof(int) + w * h * 2;
|
return 3*sizeof(int) + w * h * bpp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf, int count )
|
||||||
|
{
|
||||||
|
GLTexture_t * data = NULL;
|
||||||
|
|
||||||
|
if(count == 24)
|
||||||
|
{
|
||||||
|
if( buttonID < 5 )
|
||||||
|
data = &(arrowImages[buttonID]);
|
||||||
|
else
|
||||||
|
if( buttonID < 9 )
|
||||||
|
data = &(buttonAutoFireImages[buttonID-5]);
|
||||||
|
else
|
||||||
|
data = &(buttonImages[buttonID-9]);
|
||||||
|
|
||||||
|
if( buttonID == 23 )
|
||||||
|
data = &mousePointer;
|
||||||
|
else if( buttonID > 22 ) // Error, array too big
|
||||||
|
return 12; // Return value bigger than zero to iterate it
|
||||||
|
}
|
||||||
|
else if(count == 10)
|
||||||
|
{
|
||||||
|
if( buttonID == 0 )
|
||||||
|
data = &(arrowImages[0]);
|
||||||
|
if( buttonID >= 1 && buttonID <= 4 )
|
||||||
|
data = &(buttonImages[buttonID-1]);
|
||||||
|
if( buttonID >= 5 && buttonID <= 8 )
|
||||||
|
data = &(buttonImages[4+(buttonID-5)*2]);
|
||||||
|
if( buttonID == 9 )
|
||||||
|
data = &mousePointer;
|
||||||
|
else if( buttonID > 9 ) // Error, array too big
|
||||||
|
return 12; // Return value bigger than zero to iterate it
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__android_log_print(ANDROID_LOG_FATAL, "libSDL", "On-screen keyboard buton img count = %d, should be 10 or 24", count);
|
||||||
|
return 12; // Return value bigger than zero to iterate it
|
||||||
|
}
|
||||||
|
|
||||||
|
return setupScreenKeyboardButtonTexture(data, charBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
@@ -736,10 +765,12 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboardButtons) ( JNIEnv* env, jobj
|
|||||||
jboolean isCopy = JNI_TRUE;
|
jboolean isCopy = JNI_TRUE;
|
||||||
int len = (*env)->GetArrayLength(env, charBufJava);
|
int len = (*env)->GetArrayLength(env, charBufJava);
|
||||||
Uint8 * charBuf = (Uint8 *) (*env)->GetByteArrayElements(env, charBufJava, &isCopy);
|
Uint8 * charBuf = (Uint8 *) (*env)->GetByteArrayElements(env, charBufJava, &isCopy);
|
||||||
int but, pos;
|
int but, pos, count;
|
||||||
|
memcpy(&count, charBuf, sizeof(int));
|
||||||
|
count = ntohl(count);
|
||||||
|
|
||||||
for( but = 0, pos = 0; pos < len; but ++ )
|
for( but = 0, pos = sizeof(int); pos < len; but ++ )
|
||||||
pos += setupScreenKeyboardButton( but, charBuf + pos );
|
pos += setupScreenKeyboardButton( but, charBuf + pos, count );
|
||||||
|
|
||||||
(*env)->ReleaseByteArrayElements(env, charBufJava, (jbyte *)charBuf, 0);
|
(*env)->ReleaseByteArrayElements(env, charBufJava, (jbyte *)charBuf, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
project/res/raw/sun.raw
Normal file
BIN
project/themes/Sun/Sun-1.ico-10.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
project/themes/Sun/Sun-2.ico-10.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
project/themes/Sun/Sun-3.ico-10.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
project/themes/Sun/Sun-4.ico-10.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
project/themes/Sun/Sun-5.ico-10.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
project/themes/Sun/Sun-6.ico-10.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
project/themes/Sun/Sun-7.ico-10.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
project/themes/Sun/Sun-8.ico-10.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
project/themes/Sun/Sun-9.ico-10.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
project/themes/Sun/Sun-mouse_pointer.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
project/themes/Sun/abstractsun.zip
Normal file
23
project/themes/Sun/readme.txt
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
=== Abstract Sun Icon Set ===
|
||||||
|
|
||||||
|
By: Sirea - Martina Šmejkalová (http://www.sireasgallery.com/)
|
||||||
|
Contact: m.smejkalova@gmail.com
|
||||||
|
|
||||||
|
Download: http://www.sireasgallery.com/iconset/abstractsun/
|
||||||
|
|
||||||
|
Description: Abstract icon set with Sun theme.
|
||||||
|
==========
|
||||||
|
|
||||||
|
Attribution Required (CC by)
|
||||||
|
|
||||||
|
You are free:
|
||||||
|
|
||||||
|
To Share - To copy, distribute and transmit the work.
|
||||||
|
To Remix - To adapt the work.
|
||||||
|
|
||||||
|
Under the following conditions:
|
||||||
|
|
||||||
|
Attribution - You must attribute the work in the manner specified
|
||||||
|
by the author or licensor (but not in any way that suggests that
|
||||||
|
they endorse you or your use of the work). For example, if you are
|
||||||
|
making the work available on the Internet, you must link to the original source.
|
||||||
@@ -3,7 +3,3 @@ all: converter
|
|||||||
|
|
||||||
converter: *.cpp
|
converter: *.cpp
|
||||||
g++ -g3 -o $@ $? `sdl-config --cflags` `sdl-config --libs` -lSDL_image
|
g++ -g3 -o $@ $? `sdl-config --cflags` `sdl-config --libs` -lSDL_image
|
||||||
|
|
||||||
editor.exe: *.cpp
|
|
||||||
i586-mingw32msvc-g++ -o $@ $? -I ../sdl-1.2/include -L. -lSDL
|
|
||||||
i586-mingw32msvc-strip $@
|
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
|
|
||||||
for f in ../UltimateDroid/*.png; do
|
for f in ../UltimateDroid/*.png; do
|
||||||
newname=`echo $f | sed 's@.*/@@' | tr '[A-Z]' '[a-z]'`.raw
|
newname=`echo $f | sed 's@.*/@@' | tr '[A-Z]' '[a-z]'`.raw
|
||||||
./converter $f ../../res/raw/$newname 1
|
./converter $f ../../res/raw/$newname 16
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f ../../res/raw/ultimatedroid.raw
|
rm -f ../../res/raw/ultimatedroid.raw
|
||||||
|
printf '\000\000\000\030' > ../../res/raw/ultimatedroid.raw # size, 030 = 24
|
||||||
|
|
||||||
for F in \
|
for F in \
|
||||||
dpadbutton \
|
dpadbutton \
|
||||||
@@ -59,10 +60,11 @@ echo "};" >> ../touchscreentheme.h
|
|||||||
|
|
||||||
for f in ../SimpleTheme/*.png; do
|
for f in ../SimpleTheme/*.png; do
|
||||||
newname=simpletheme`echo $f | sed 's@.*/@@' | tr '[A-Z]' '[a-z]'`.raw
|
newname=simpletheme`echo $f | sed 's@.*/@@' | tr '[A-Z]' '[a-z]'`.raw
|
||||||
./converter $f ../../res/raw/$newname 1
|
./converter $f ../../res/raw/$newname 16
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f ../../res/raw/simpletheme.raw
|
rm -f ../../res/raw/simpletheme.raw
|
||||||
|
printf '\000\000\000\030' > ../../res/raw/simpletheme.raw # size, 030 = 24
|
||||||
|
|
||||||
for F in \
|
for F in \
|
||||||
dpad \
|
dpad \
|
||||||
@@ -107,3 +109,44 @@ mv -f ../../res/raw/simpletheme.raw.gz ../../res/raw/simpletheme.raw
|
|||||||
echo "unsigned char * SimpleTheme[] = { 00 // Dummy byte, skip it" >> ../touchscreentheme.h
|
echo "unsigned char * SimpleTheme[] = { 00 // Dummy byte, skip it" >> ../touchscreentheme.h
|
||||||
cat ../../res/raw/simpletheme.raw | od -t x1 -v -A n | tr " " "," >> ../touchscreentheme.h
|
cat ../../res/raw/simpletheme.raw | od -t x1 -v -A n | tr " " "," >> ../touchscreentheme.h
|
||||||
echo "};" >> ../touchscreentheme.h
|
echo "};" >> ../touchscreentheme.h
|
||||||
|
|
||||||
|
|
||||||
|
# Abstract Sun Icon Set by Sirea (Martina Šmejkalová)
|
||||||
|
for f in ../Sun/*.png; do
|
||||||
|
newname=`echo $f | sed 's@.*/@@' | tr '[A-Z]' '[a-z]'`.raw
|
||||||
|
./converter $f ../../res/raw/$newname 32
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f ../../res/raw/sun.raw
|
||||||
|
printf '\000\000\000\012' > ../../res/raw/sun.raw # size, 012 = 10
|
||||||
|
|
||||||
|
for F in \
|
||||||
|
sun-2.ico-10 \
|
||||||
|
\
|
||||||
|
sun-6.ico-10 \
|
||||||
|
sun-7.ico-10 \
|
||||||
|
sun-4.ico-10 \
|
||||||
|
sun-5.ico-10 \
|
||||||
|
\
|
||||||
|
sun-3.ico-10 \
|
||||||
|
sun-9.ico-10 \
|
||||||
|
sun-1.ico-10 \
|
||||||
|
sun-8.ico-10 \
|
||||||
|
\
|
||||||
|
sun-mouse_pointer \
|
||||||
|
; 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/sun.raw
|
||||||
|
done
|
||||||
|
|
||||||
|
rm ../../res/raw/sun*.png.raw
|
||||||
|
|
||||||
|
gzip -9 < ../../res/raw/sun.raw > ../../res/raw/sun.raw.gz
|
||||||
|
mv -f ../../res/raw/sun.raw.gz ../../res/raw/sun.raw
|
||||||
|
echo "unsigned char * SunTheme[] = { 00 // Dummy byte, skip it" >> ../touchscreentheme.h
|
||||||
|
cat ../../res/raw/sun.raw | od -t x1 -v -A n | tr " " "," >> ../touchscreentheme.h
|
||||||
|
echo "};" >> ../touchscreentheme.h
|
||||||
|
|||||||
@@ -14,13 +14,18 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if(argc < 3)
|
if(argc < 3)
|
||||||
|
{
|
||||||
|
printf("Usage: converter source.png target.raw [target bpp = 16 or 32]\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
SDL_Surface * src = IMG_Load(argv[1]);
|
SDL_Surface * src = IMG_Load(argv[1]);
|
||||||
if(!src)
|
if(!src)
|
||||||
return 1;
|
return 1;
|
||||||
bool perPixeAlpha = false;
|
bool perPixeAlpha = true;
|
||||||
if( argc >= 4 )
|
bool target32bpp = false;
|
||||||
perPixeAlpha = true;
|
if( argc >= 3 && strcmp(argv[3], "32") == 0 )
|
||||||
|
target32bpp = true;
|
||||||
|
/*
|
||||||
if( src->format->BitsPerPixel == 32 )
|
if( src->format->BitsPerPixel == 32 )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < src->h; i++ )
|
for( int i = 0; i < src->h; i++ )
|
||||||
@@ -38,10 +43,13 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Converter: %s BPP %d %dx%d perPixeAlpha %d\n", argv[1], src->format->BitsPerPixel, src->w, src->h, (int)perPixeAlpha);
|
*/
|
||||||
|
printf("Converter: %s BPP %d %dx%d perPixeAlpha %d target %d bpp\n", argv[1], src->format->BitsPerPixel, src->w, src->h, (int)perPixeAlpha, target32bpp ? 32 : 16);
|
||||||
SDL_Surface * format1 = SDL_CreateRGBSurface( SDL_SWSURFACE|SDL_SRCALPHA, 1, 1, 16, 0xF800, 0x7C0, 0x3E, 0x1 );
|
SDL_Surface * format1 = SDL_CreateRGBSurface( SDL_SWSURFACE|SDL_SRCALPHA, 1, 1, 16, 0xF800, 0x7C0, 0x3E, 0x1 );
|
||||||
if( perPixeAlpha )
|
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( target32bpp )
|
||||||
|
format1 = SDL_CreateRGBSurface( SDL_SWSURFACE|SDL_SRCALPHA, 1, 1, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF );
|
||||||
if(!format1)
|
if(!format1)
|
||||||
return 1;
|
return 1;
|
||||||
SDL_Surface * dst = SDL_ConvertSurface(src, format1->format, SDL_SWSURFACE|SDL_SRCALPHA);
|
SDL_Surface * dst = SDL_ConvertSurface(src, format1->format, SDL_SWSURFACE|SDL_SRCALPHA);
|
||||||
@@ -54,15 +62,16 @@ 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(perPixeAlpha ? 1 : 0);
|
int format = htonl(target32bpp ? 2 : (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 && ! perPixeAlpha)
|
if( (!target32bpp) && (
|
||||||
|
* (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*(target32bpp?4:2), 1, (target32bpp?4:2), ff );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(ff);
|
fclose(ff);
|
||||||
|
|||||||
@@ -381,3 +381,4 @@ using them, otherwise you'll have to release your whole application sources unde
|
|||||||
|
|
||||||
The "Ultimate Droid" on-screen keyboard theme by Sean Stieber is licensed under Creative Commons - Attribution license.
|
The "Ultimate Droid" on-screen keyboard theme by Sean Stieber is licensed under Creative Commons - Attribution license.
|
||||||
The "Simple Theme" on-screen keyboard theme by Dmitry Matveev is licensed under zlib license.
|
The "Simple Theme" on-screen keyboard theme by Dmitry Matveev is licensed under zlib license.
|
||||||
|
The "Sun" on-screen keyboard theme by Sirea (Martina Smejkalova) is licensed under Creative Commons - Attribution license.
|
||||||
|
|||||||