SPRITE2MEM in WebOS

Previous topic - Next topic

ampos

It seems it dont work.

I placed debugs in the program just before and after and it crash in this command.

I am using 9.040
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

ampos

check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

MrTAToad

Have you got a small bit of test code ?

ampos

Do you need any sample code because SPR2MEM does work on Gernot's palm?
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

MrTAToad

If you could supply a small one, it would be handy.

ampos

Ok, here is an example that uses SPRITE2MEM

Code (glbasic) Select
// A Tree image
image$ = "" _
        + "....****...." _
        + "..**++++**.." _
        + ".*++++++++*." _
        + "*++++++++++*" _
        + "*++++++*+++*" _
        + "*++++++*+++*" _
        + "*+++++*++++*" _
        + ".*++*+++++*." _
        + "..********.." _
        + "....####...." _
        + "....####...." _
        + "...######..." _
        + ""
DIM colors$[4]
    colors$[0] = "."+INTEGER(0x00000000) // transparent
    colors$[1] = "+"+INTEGER(0xff00ff80) // green
    colors$[2] = "*"+INTEGER(0xff008000) // dark green
    colors$[3] = "#"+INTEGER(0xff0080ff) // orange
MakeImage(0, 12, image$, colors$[])


LOCAL pixl%[]
    SPRITE2MEM(pixl%[], 0) // get the sprite

LOCAL w%, h%
    GETSPRITESIZE 0, w,h
MEM2SPRITE(pixl[], 1, w,h) // make a copy to see if it worked

DRAWRECT 0,0,1000,1000,RGB(70,90,255)
SMOOTHSHADING FALSE
STRETCHSPRITE 0, 32,32,99,99
STRETCHSPRITE 1, 232,32,99,99
SHOWSCREEN
MOUSEWAIT

// ------------------------------------------------------------- //
// -=# MAKEIMAGE #=-
// Make a Sprite from a string
// usage:
// img$ = ".+." _
// + "+++" _
// ".+."
// dim col$[2];
// col$[0]="."++INTEGER(0xAABBGGRR) // alpha, blue, green, red
// col$[1]="+"++INTEGER(0xff00ff80)
// ------------------------------------------------------------- //
FUNCTION MakeImage: num%, width%, image$, colors$[]
LOCAL x%, y%, c$, height%, pix%[]
    height = LEN(image$)/width

    DIM pix%[width*height]

    FOR y = 0 TO height-1
        FOR x = 0 TO width-1
            c$ = MID$(image$, x+y*width, 1)
            FOR i=0 TO BOUNDS(colors$[], 0)-1
                IF c$ = MID$(colors$[i], 0,1)
                    pix[x + y*width] = MID$(colors$[i], 1, 9)
                    BREAK
                ENDIF
            NEXT
        NEXT
    NEXT
   
    // Make Sprite from the image
    MEM2SPRITE(pix[], num%, width%, height%)
ENDFUNCTION // MAKEIMAGE


This code has not been tested on Palm, as I am not at home, where my Palm is living.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

MrTAToad

It does look like its not working in as much as I just get a black screen...

Which could mean that MEM2SPRITE isn't working too...

ampos

Well, it is the sample code in the GLB manual about MEM2SPRITE command.

In my Win machine is shows 2 trees on screen.

Not tested on Palm. My game in Palm just closes as soon as it reach the SPRITE2MEM command.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

MrTAToad

Hmmm - what webOS version are you using ?

I just get a black screen...

ampos

2.1.0

This code has not been (yet) tested on my Palm. On Win, it shows 2 trees.

Tonite I will check it on my palm pre 2.

Anyway, it is shows a black screen (your) or crashes (mine), it is not working :D
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

ampos

I have just tested the MEM2SPRITE example on my palm pre 2. It crashed. No black screen or anything. Just a open&close of the screen.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Kitty Hello

oh bad. Does the console bring some output? (compiler/platform/webos/tools/bin/deviceShell)

Kitty Hello

Yes, crashes in glReadPixels. :/