I have an application that works properly in IOS and WebOS, however displays images and texts with strange effects in Android.
Attached image.
[attachment deleted by admin]
Are you using USEASBMP ? Ive had a similar effect with that.
No, I don't use it. :S
What resolution is set in your program and what is the resolution of the device - I suspect they aren't the same.
I use STRETCHSPRITE to resize the screen and GETSCREENSIZE to find the screen resolution, but i get very strange results because this command answers me 320x480 in a HTC Wildfire with a resolution QVGA (320x240).
In any case I've also tested on a single screen without resizing and I have the same result.
it looks like either a texture is "broken" (DRAWSPRITE no, 0,0 to test)
or the drawing of this texture is wrong. The error is only in the background of the info-areas?
are you using polyvector?
I'm not using Polyvector. The problem appears in PNG and BMP files interchangeably, however this does not happen with LOADBMP.
P.D.: Why not work well GETSCREENSIZE in Android?
Try to make a smaller example to see the problem, maybe in one line of code?
This afternoon I will do tests to give more details.
Thanks
I think can be error in the resolution at compiling, or ....
you have some setscreen command, I rebenmer I have a similar trouble in my android for this command.
I still have the same problem.
Attached two screenshots in the android emulator, choosing a HVGA resolution (320x480). In addition, using GETSCREENSIZE I get 213x320, you can see at the top of the screenshot #1. Why?.
The effects in the emulator are faithful to reality.
[attachment deleted by admin]
QuoteIn addition, using GETSCREENSIZE I get 213x320, you can see at the top of the screenshot #1. Why
Probably because the XML forces the program to return that size...
It looks like your graphics have multiple transparency layers...
first at all, check AndroidManifest.xml and set android:anyDensity to true. That should return the correct resolution with GETSCREENSIZE.
Also Emulator is not very good at all, and can mess out the graphics and a lots of thing is not supported (and is slow as hell). Here POLYVECTOR was a total mess and noting works, but have works nice on two tested phones.
SETSCREEN should also not been used (not checked the code) for mobile versions.
I have had a report that my Android app only shows half the screen (I think that's what they said I'm trying to clarify) on his HTC Wildfire - perhaps this is the same problem?
It does not work. :noggin:
The images are made with photoshop and probably have several layers of transparencies. They are saved as PNG files using the "Save for Web & Devices" option.
On the other hand, the texts are not working correctly and I'm using the UO_DiNGSFont_v4 application for generating the text with transparent background.
Quote from: caffeinekid on 2011-Oct-05
I have had a report that my Android app only shows half the screen (I think that's what they said I'm trying to clarify) on his HTC Wildfire - perhaps this is the same problem?
Yes, My problem occurs in small resolutions like HTC Wildfire -320x240- (used for my test).
it looks like an alpha problem. Then you draw the text, can you try: ALPHAMODE -1, please?
I already tried to no avail.
I am also concerned that GETSCREENSIZE not work correctly.
getscreensize has something to do with scaling of compatible apps. There's a whole thread about it and I have not quite understood the solution myself, I admit.
http://www.glbasic.com/forum/index.php?topic=6833.0 (http://www.glbasic.com/forum/index.php?topic=6833.0)
Please post a very small example that makes the error for me to test.
Quote from: msx on 2011-Oct-05
The images are made with photoshop and probably have several layers of transparencies. They are saved as PNG files using the "Save for Web & Devices" option.
On the other hand, the texts are not working correctly and I'm using the UO_DiNGSFont_v4 application for generating the text with transparent background.
Do those images work when compiling for PC?
Maybe doing a small code to show those sprites on a desktop just to check?
Before saving images from photoshop where you want the alpha to work, have it single layer with the transparent area being those "chess squares". I tried using the alpha channel on the channels RGBA tab, but that one dosen´t go through the png.
Save it normally as PNG(no interlace), when you reopen your graphics on photoshop, it should show the same single layer with the chess thing.
oh, before so, you wanna select the whole screen and crop it just in case some info is outside...
It also has to be an RGB image, no CMYK, indexed colors may also no work...I guess saving for internet/devices will index the colors, but I´m not sure, go for pure RGB.
I doubt this is the problem, but hope it helps.
Transparenty does not work with text as well other plain draw commands (a least not on Sony Xperia Play), which could been the issue with the image?
I managed to cause failure. Attached is a sample file with the bug.
Note that the progress bar should be red.
[attachment deleted by admin]
oh, tried your test on pc,
it displays correct, checked the PNGs, they are all fine...
I guess the prob happens only on android then...
and I thought I was being helpfull somehow :x
[attachment deleted by admin]
That is, only occurs in Android. In WebOS and IOS works fine.
I found a bug in loadsprite for BMP files. Can you try converting the tabla.bmp to "tabla.png" (make a real PNG file - check the file size).
BMP files crashed on my device when loading. I also fixed the transparent-colour bu for bmp files. Update soon.
Thank you Gernot, you are the best. :nw: :nw:
How can I be any good if my code has bugs? ;)
because your imperfection is perfect. :booze:
I've converted "tabla.bmp" to "tabla.png" and still not working. :S
Gernot, Can you tell me why is this?
The attached binary works for me.
[attachment deleted by admin]
This APK is the building of my BAS?
yes. But with my BMP fix. It works on my device.
Quote from: msx on 2011-Oct-05
Quote from: caffeinekid on 2011-Oct-05
I have had a report that my Android app only shows half the screen (I think that's what they said I'm trying to clarify) on his HTC Wildfire - perhaps this is the same problem?
Yes, My problem occurs in small resolutions like HTC Wildfire -320x240- (used for my test).
I'm also painfully testing on a borrowed HTC Wildfire won in a raffle.
It works on a wildfire? I seem to get White for all sprites. Is it better for new GLB or is it the new phone?
Cheers
Note Andoird version < 2.2 = white rgb polys/lines but 3D work/bmp sprites work.
Generally, as an immediate solution as suggested before, if you want fixed coloured lines then just draw thin texture 2D/3D polys!
I think I can confirm that there is a bug that only appears on HTC Wildfire. Attached a video of an HTC Wildfire and the code that is running, you'll notice that the default font of GLB is deformed and progress bar is white but it should be red.
GLOBAL NUM, TEMP, TEMP$
SETCURRENTDIR("Media") // seperate media and binaries?
ALLOWESCAPE TRUE
WHILE TRUE
NUM=10
FOR I=1 TO NUM
MSG_Obteniendo_Datos()
//Progress Bar (RED Colour)
DRAWLINE 59,250,260,250,RGB(255,127,0)
DRAWLINE 59,262,260,262,RGB(255,127,0)
DRAWLINE 59,250,59,262,RGB(255,127,0)
DRAWLINE 260,250,260,262,RGB(255,127,0)
TEMP=200/(NUM+1)
FOR J=1 TO (I*TEMP)
DRAWLINE 59+J,251,59+J,262,RGB(255,0,0)
NEXT
SHOWSCREEN
Pause(200)
NEXT
WEND
FUNCTION MSG_Obteniendo_Datos:
ALPHAMODE -1
TEMP$="OBTENIENDO DATOS, POR FAVOR ESPERE..."
PRINT TEMP$,160-(LEN(TEMP$,1)/2),168,1
TEMP$="GETTING INFORMATION, PLEASE WAIT..."
PRINT TEMP$,160-(LEN(TEMP$,1)/2),208,1
ENDFUNCTION
FUNCTION Pause%: delay%
LOCAL time_start% = GETTIMERALL()
WHILE ABS(GETTIMERALL() - time_start) < delay
FOR i=1 TO 1000; NEXT
WEND
ENDFUNCTION
I mentioned earlier this year that the Wildfire can't handle coloured RECTS - you need to use POLYVECTOR...
and what about the texts unreadable?
You could always write your own print routines that use polyvector ;)
I need an example.
Thanks
I thought I'd take a stab at it, give this a try...
// --------------------------------- //
// Project: PolyFont BY GulfRacer
// Start: Sunday, October 16, 2011
// IDE Version: 10.106
LOCAL screen_x, screen_y
GETSCREENSIZE screen_x, screen_y
SETCURRENTDIR("Media")
LOADSPRITE "font.png",1000 // LOAD YOUR FONT AS A SPRITE
WHILE TRUE
PrintPoly("** This is a PrintPoly test! **",screen_x/2, 100, 1000, RGB(255,0,0),1) // WARNING: USE COLOR RGB(255,255,255) FOR MOBILE DEVICES
PrintPoly("This text is centered!",screen_x/2,150,1000, RGB(0,255,0),1)
PrintPoly("This text is not!",screen_x/2,200,1000, RGB(0,0,255),0)
SHOWSCREEN
WEND
FUNCTION PrintPoly: text$, x, y, font, color, center
LOCAL font_sizex, font_sizey, char_row, char_col, text_length
LOCAL loop_foo, cur_char$, cur_char_code
LOCAL texture_x, texture_y, cols, rows, center_x=0
text_length=LEN(text$)
IF text_length>0
GETSPRITESIZE font,font_sizex,font_sizey
cols=font_sizex/16 // GET THE COLUMN SIZE IN PIXELS
rows=font_sizey/8 // GET THE ROW SIZE IN PIXELS
IF center=1 THEN center_x=text_length*cols/2
FOR loop_foo=0 TO text_length-1
cur_char$=MID$(text$,loop_foo,1) // GET THE CURRENT CHARACTER
cur_char_code=ASC(cur_char$) // GET THE CURRENT CHARACTER CODE
char_row=INTEGER(cur_char_code/16) // FIND THE ROW IN THE FONT MATRIX THE CHARACTER BELONGS TO
char_col=INTEGER(MOD(cur_char_code,char_row*16)) // FIND THE COLUMN IN THE FONT MATRIX THE CHARACTER BELONGS TO
texture_x=char_col*cols // LOCATE THE TEXTURE PIXEL X LOCATION IN THE FONT MATRIX
texture_y=char_row*rows // LOCATE THE TEXTURE PIXEL y LOCATION IN THE FONT MATRIX
STARTPOLY font
POLYVECTOR x-center_x+(loop_foo*cols),y,texture_x,texture_y,color
POLYVECTOR x-center_x+(loop_foo*cols),y+rows,texture_x,texture_y+rows,color
POLYVECTOR x-center_x+(loop_foo*cols)+cols,y+rows,texture_x+cols,texture_y+rows,color
POLYVECTOR x-center_x+(loop_foo*cols)+cols,y,texture_x+cols,texture_y,color
ENDPOLY
NEXT
ENDIF
ENDFUNCTION
FUNCTION Prontsc:a$,x,y,cl,cl2,scx,scy
// x,y - Center point of text
// cl - top colour of text
// cl2 - bottom colour of text
// scx,scy - Scaling factor for text (1 = normal, 2 = double size, 0.5 = half size etc)
// Needs bitmap font loaded into sprite id 1000 (Use GLBs Font creator to make, or use other bitmap font)
// size of font needs to be 32x32, 16 chars accross, 8 down
LOCAL xx,yy,a,Nm
LOCAL nx,ny,nx2,ny2
Nm=LEN(a$)-1
STARTPOLY 1000,2
FOR m=0 TO Nm
a=ASC(MID$(a$,m,1))
yy= INTEGER((a/16))*32
xx= MOD(a,16)*32
nx=(((m*2)-Nm)-1)*(16*scx)
nx2=((((m+1)*2)-Nm)-1)*(16*scx)
ny=16*scy
ny2=16*scy
POLYVECTOR x+nx,y-ny, xx,yy, cl
POLYVECTOR x+nx,y+ny, xx,yy+32, cl2
POLYVECTOR x+nx2,y-ny, xx+32,yy, cl
POLYVECTOR x+nx2,y+ny, xx+32,yy+32, cl2
NEXT
ENDPOLY
ENDFUNCTION
Thank you. I get it. It has helped me.