FBA The Creator
http://www.fbacreator.com/fbaforum/

Possible Bug found in rect function
http://www.fbacreator.com/fbaforum/viewtopic.php?f=2&t=156
Page 1 of 1

Author:  ckl_88 [ Sun Mar 15, 2009 8:06 am ]
Post subject:  Possible Bug found in rect function

I think I just found a bug in the rect (x1,y1,x2,y2,r,g,b) function.
It only happens when you set the resolution to be 480x640 and draw a rectangle with the y2 coordinate beyond the bounds of the screen.

I've replicated this using the HelloWorld sample code listed here:
Code:
--------------------------------------------------- 
-- FBA Tutorials
--
-- Tutorial / 01 / HelloWorld
--
---------------------------------------------------
--
-- The simplest FBA script, the "HelloWorld" !
--
-- This example shows minimal code required in order to create
-- the main window
---------------------------------------------------

debug("Hello World!")


function onmainloop()   
         --
         -- this routine is called on each frame by FBA. You have
         -- to draw all your cool graphics here...
         --
         fillrect (10,10, screenwidth()-10, screenheight()+10, 100,100,100)
         
         rect (10, 10, screenwidth()-10, screenheight() + 10, 255,255,255)
         
         
         
         -- quit if we're pressing stylus/mouse
         if (mousedown() > 0) then
            quit()
         end
end

-- this is an optional event automatically called when your application
-- is about to be closed. You can do here some finalization code (settings save etc)
-- or just ignore it if you don't need it ;)
--
-- don't draw anything here, because after this function your application will be closed ;)
--
function onquit()

end


Basically, if you run this in any resolution other than 480x640, it will work.

The line is question is:
rect (10, 10, screenwidth()-10, screenheight() + 10, 255,255,255)

I've tried several scenarios:
rect (10, 10, screenwidth()-10, screenheight() + 10, 255,255,255) <- crashes
rect (10, 10, screenwidth()-10, screenheight(), 255,255,255) <- crashes
rect (10, 10, screenwidth()-10, screenheight() - 1, 255,255,255) <- does not crash
rect (10, 10, screenwidth()+10, screenheight() - 1, 255,255,255) <- does not crash


If you comment out the rect line, and just do the fillrect (which fills in the same area) it will work.

I'm currently doing a scrolling list which can have up to 100 items. So the ability to draw rects outside of the screen area is important.

Thanks.

Author:  ckl_88 [ Tue Apr 07, 2009 6:20 pm ]
Post subject:  Re: Possible Bug found in rect function

Is this being investigated?

Thanks.

Author:  evilmaio [ Tue Apr 07, 2009 8:32 pm ]
Post subject:  Re: Possible Bug found in rect function

Try to set clipping before your drawing operations:

clipping(0,0,screenwidth()-1,screenheight()-1)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/