Support and General Use > Theming and Appearance Customization

Text "always on top"

(1/1)

ben106:
Hi,
I got a problem creating my WPS (for the Sansa e200) : the progress bar is big (red rectangle on the picture), and I got some text on the progress bar. How can I do so that the text doesn't get covered by the progress bar ?

The text that refreshes (current time, remaining time) doesn't get hidden by the bar but total time and next song get covered (or flickers while scrolling).

I didn't try this on the mp3 player itself (I don't have the player here), so I'm trying on the simulator, on Wine (I got Linux).

Here is my .wps :

--- Code: ---%wd

%X|back.bmp|

%xl|a|battery.bmp|5|5|4|
%xl|b|volume.bmp|127|14|5|
%xl|c|playMode.bmp|8|195|5|
%xl|d|repeat.bmp|27|195|4|

%?bl<||%xdaa|%xdab|%xdac|%xdad>
%?pv<|%xdba|%xdbb|%xdbc|%xdbd|%xdbe|%xdbe>
%pb|progressbar.bmp|60|131|90|58|
%?mp<%xdca|%xdcb|%xdcc|%xdcd|%xdce>
%?mm<|%xdda|%xddb|%xddc|%xddd>

%Cl|5|30|75|75|
%C



%V|18|2|40|12|-|-|-|
%al%bt

%V|95|2|32|12|-|-|-|
%ar%pvdB

%V|86|50|66|12|-|-|-|
%s%ia

%V|96|73|77|12|-|-|-|
%s%id

%V|34|119|90|12|-|-|-|
%s%it

%V|12|143|115|12|-|-|-|
%s Next : %Ia - %It

%V|140|119|34|12|-|-|-|
%pr

%V|118|180|34|12|-|-|-|
%pt

%V|40|164|34|12|-|-|-|
%pc

%V|72|205|42|12|-|-|-|
%ck:%cM
--- End code ---

hope someone can help.. thanks !

karashata:
Sadly, you can't really draw text over a progress bar or any other graphics without some sort of complication.  Viewports aren't drawn transparently so any text drawn over a graphic will blank out where the text viewport is, and any graphics drawn over text will hide the text under it.  It's best to try not to overlap viewports because of this.

However, if you really want to have text show over an image, make sure the image is drawn to the screen first, then the text.  This is done by having the image display tag (or in your case, the progress bar tag) before the text you want to have over the image.

I hope that helps some.

ben106:
Thanks for the reply !
The progress bar tag (%pb) is before the viewports and text. I think the progress bar refreshes (and goes to foreground) maybe every 0.1s, and the text only when the song changes.

I just tried putting the progress bar into a viewport, but same problem.

It would be great having something that makes the text refresh at the same time as the progress bar.
---------------------------------
EDIT :
I now found a solution, not really clean, but works. I changed the display of the total time %pt into %?px<%pt|%pt>. I removed the scrolling for the "next song", replaced it by alternatively printing artist and song.

Here is the new .wps :

--- Code: ---%wd

%X|back.bmp|

%xl|a|battery.bmp|5|5|4|
%xl|b|volume.bmp|127|14|5|
%xl|c|playMode.bmp|8|195|5|
%xl|d|repeat.bmp|27|195|4|

%?bl<||%xdaa|%xdab|%xdac|%xdad>
%?pv<|%xdba|%xdbb|%xdbc|%xdbd|%xdbe|%xdbe>
%?mp<%xdca|%xdcb|%xdcc|%xdcd|%xdce>
%?mm<|%xdda|%xddb|%xddc|%xddd>

%pb|progressbar.bmp|60|131|90|58|

%Cl|5|30|75|75|
%C

%V|18|2|40|12|-|-|-|
%al%bt

%V|95|2|32|12|-|-|-|
%ar%pvdB

%V|86|50|66|12|-|-|-|
%s%ia

%V|96|73|77|12|-|-|-|
%s%id

%V|34|119|90|12|-|-|-|
%s%it

%V|12|143|115|12|-|-|-|
%Ia;%It

%V|140|119|34|12|-|-|-|
%pr

%V|118|180|34|12|-|-|-|
%?px<%pt|%pt>

%V|40|164|34|12|-|-|-|
%pc

%V|72|205|42|12|-|-|-|
%ck:%cM

--- End code ---

JdGordon:

--- Quote from: karashata on November 09, 2008, 02:27:22 PM ---However, if you really want to have text show over an image, make sure the image is drawn to the screen first, then the text.  This is done by having the image display tag (or in your case, the progress bar tag) before the text you want to have over the image.

I hope that helps some.

--- End quote ---
I dont tihnk that will work... IIRC the bitmaps are always drawn after text.


ben106.. the simulator can be built nativly for linux... you just need libsdl-dev and gcc...

karashata:
You could be right, it's been ages since I've tried to draw text over bitmaps and I learned long ago that it didn't work out properly so I've avoided it since...

Navigation

[0] Message Index

Go to full version