14.003 CAANOO DRAWRECT, DRAWSPRITE -, virtual screen

Previous topic - Next topic

erico

DRAWRECT stutters when in animation, don´t know if this is new as I never tried that command on a Caanoo till now.

About the rest, I have more or less this to display stuff on my code
Code (glbasic) Select
CREATESCREEN 1,200,428,240 ;// Virtual Screen

// --- STANDARD SETS
IF comp=0 THEN SETSCREEN 320,240,0 ;// Caanoo
IF comp=0 THEN DRAWSPRITE 200,-54,0                         ;// Caanoo


What I get on screen is the game without those -54 on the drawsprite, they are like 0.
I appended a crap pic.

Of course all works fine as expected on the PC

Kitty Hello

Oh no. Can you zip a tiny test program for this bug?

erico

Ok, will create a little test...I just found out that DRAWRECT is not a culprid here on the stutter but ZOOMSPRITE...
Will post it later today.

erico

Here the test project, I´m not sure anymore just what is guilty on this behavior and I found a couple more strange things to boot.
Appended is the usual crappy picture and the zipped project.

As with the picture, you can see that the final drawsprite of the virtual screen is not drawing it on the correct place -54 but on the 0 (ye the thing should display centered).
In app, you cycle between modes with space bar on PC and A button on Caanoo.
Here the more strange results I get on the caanoo:

MOVE SPRITE - things flicker a bit but, when the sprite is moving below 0x0 coords, things stutter a lot, specially on the lines of the lower right part.
ROTO SPRITE - very slow but the whites in sprite either become alpha or the same color of the drawrect used to paint the background of the
                      virtual screen.
ZOOM MASK - The mask stutters when the scaling is above 1x, most noticeable on the left corner.

Apart from these visual things, everything else in my original game is working fine.
I thought that these issues were related to the virtual screen on the Caanoo, but removing it from code, the performance and issues were the very same.
Finally, everything works fine on PC.

EDIT: adding the code.
EDIT2: all .bmp are 24 bit rgb888. The mask is done with the pink color.

Code (glbasic) Select
// --------------------------------- //
// Project: SCREEN_CAANOO
// Start: Sunday, August 16, 2015
// IDE Version: 14.003

// --- BOOT
LIMITFPS 60 // 60 fps
SETSCREEN 320,240,0 // Caanoo Screen
CREATESCREEN 1,200,428,240 // Virtual Screen
ALPHATESTING 0.0 // Alpha set
SMOOTHSHADING FALSE // Nearest neighbour interpolation
LOADSPRITE "Media/BKG.bmp",1// Load test 428x240 background sprite
LOADSPRITE "Media/MSK.bmp",2// Load test 1104x391 mask sprite

// --- VARIABLES
GLOBAL zoom // on off zoomsprite
GLOBAL zx,zy,zax,zay // zoom amount, accelerations
GLOBAL mx,my,sx,sy // movement amount
GLOBAL b // joy button
zax=-.025 ; zay=-.025
sx=1 ; sy=1

WHILE TRUE ;//---------------------------------------------------------------------------------------LOOP

USESCREEN 1 // Virtual Screen
DRAWRECT 0,0,428,240,RGB(128,128,128) // Drawrect grey background

// --- SPRITE STATIC
IF zoom=0
DRAWSPRITE 1,mx,my // Draw sprite
ENDIF

// --- SPRITE MOVE
IF zoom=1
DRAWSPRITE 1,mx,my // Draw sprite
mx=mx+sx // move sprite
my=my+sy
IF mx<=-80 THEN sx=1
IF mx>=80 THEN sx=-1
IF my<=-80 THEN sy=1
IF my>=80 THEN sy=-1
ENDIF

// --- SPRITE ZOOM
IF zoom=2
zx=zx+zax // add accelerations
zy=zy+zay
IF zx<=0 THEN zax=.025
IF zx>=2 THEN zax=-.025
IF zy<=0 THEN zay=.025
IF zy>=2 THEN zay=-.025
ZOOMSPRITE 1,0,0,zx,zy // Zoom sprite
ENDIF

// --- SPRITE ROTO
IF zoom=3
zx=zx+sx // add accelerations
ROTOZOOMSPRITE 1,0,0,zx,1 // Roto sprite
ENDIF

// --- MASK STATIC
IF zoom=4
DRAWSPRITE 1,mx,my // Draw test sprite
DRAWSPRITE 2,-338,-76 // Draw mask sprite
ENDIF

// --- MASK MOVE
IF zoom=5
DRAWSPRITE 1,0,0 // Draw test sprite
DRAWSPRITE 2,mx-338,my-76 // Draw mask sprite
mx=mx+sx // move mask
my=my+sy
IF mx<=-80 THEN sx=1
IF mx>=80 THEN sx=-1
IF my<=-80 THEN sy=1
IF my>=80 THEN sy=-1
ENDIF

// --- MASK ZOOM
IF zoom=6
zx=zx+zax // add accelerations
zy=zy+zay
IF zx<=0 THEN zax=.025
IF zx>=2 THEN zax=-.025
IF zy<=0 THEN zay=.025
IF zy>=2 THEN zay=-.025
DRAWSPRITE 1,0,0 // Draw test sprite
ZOOMSPRITE 2,-338,-76,zx,zy // Zoom mask sprite
ENDIF

// --- CONTROLS (A button / space ->change test mode)
b=GETJOYBUTTON(0,0)
IF b=1 OR KEY(57)=1
zoom=zoom+1
IF zoom=7 THEN zoom=0
SLEEP 200
zx=1 ; zy=1 ; sx=1 ; sy=1 ; mx=0 ; my=0
ENDIF

// --- DISPLAY + HUD
USESCREEN -1 ;// Backbuffer
DRAWSPRITE 200,-54,0 ;// Position virtual screen centered on the Caanoo´s screen
IF zoom=0 THEN PRINT "STATIC SPRITE",0,14
IF zoom=1 THEN PRINT "MOVE SPRITE",0,14
IF zoom=2 THEN PRINT "ZOOM SPRITE",0,14
IF zoom=3 THEN PRINT "ROTO SPRITE",0,14
IF zoom=4 THEN PRINT "STATIC MASK",0,14
IF zoom=5 THEN PRINT "MOVE MASK",0,14
IF zoom=6 THEN PRINT "ZOOM MASK",0,14
SHOWSCREEN

WEND ;//---------------------------------------------------------------------------------------LOOP END

erico

Tested 006 version, still same issues on caanoo. will check 12.656... same uncentering.

Kitty Hello

Its because the sprite is bigger than the screen. I have to check...

erico

Hopefully that also deals with the positioning of the virtual screen, maybe both problems are related. Let me know if there is anything I can do to help.