Searching for a quicker rect command

Archives Forums/BlitzPlus Programming/Searching for a quicker rect command

Vignoli(Posted 2010) [#1]
Hi

I'm developping a sprite editor for amstrad cpc in B+.

As i use two canvas, one for drawing operations, and one for the real view, i use the "rect" command in two loops (x and y) to Refresh the sprites into the two canvas.
All the data's of the sprite are in an array.

My problem is that a 48*96pixels sprites is too slow.

Does someone has ideas to optimise my Refresh function ?


Sauer(Posted 2010) [#2]
Any draw command like plot, rect, and line will be slow. Maybe you could use sprites to render your sprites, like pre-rendering a bunch of different colored 48x96 squares, then using the DrawImage command. That would certainly be faster than using Rect.


Vignoli(Posted 2010) [#3]
Thanks a lot, i'll try that


Stamm(Posted 2010) [#4]
btw you dont have to use 2 canvases 1 is enough
when you use CanvasBuffer() it sets the buffer to the backbuffer of the canvas you still have to use FlipCanvas()

format_code('
canvas=createcanvas([whatever])
setbuffer canvasbuffer(canvas)
[Draw your stuff]
;stuff is invisible until now!!
flipcanvas canvas;render evrything visible
;now evrything gets visible
')

and with what happened with my computer i think 2 canvases when you only need 1 is very slow


CS_TBL(Posted 2010) [#5]
B+ should be able to draw rects all around the screen without a glitch.