I did a ScriptBasic SDL_Draw version of Peter
Rainbow benchmark. I'm happy to report that Peter's
Simple Window library (compiled with OxygenBasic) takes the same time as the SB version.
(and a lot easier to use)
' ScriptBasic Rainbow
DECLARE SUB Window ALIAS "SB_Window" LIB "sdl"
DECLARE SUB RGB ALIAS "SB_RGB" LIB "sdl"
DECLARE SUB WaitKey ALIAS "SB_WaitKey" LIB "sdl"
DECLARE SUB Ticks ALIAS "SB_Ticks" LIB "sdl"
DECLARE SUB UpdateRect ALIAS "SB_UpdateRect" LIB "sdl"
DECLARE SUB CLS ALIAS "SB_CLS" LIB "sdl"
DECLARE SUB Draw_Pixel ALIAS "SB_Draw_Pixel" LIB "sdl"
DECLARE SUB Draw_Line ALIAS "SB_Draw_Line" LIB "sdl"
DECLARE SUB Draw_Circle ALIAS "SB_Draw_Circle" LIB "sdl"
DECLARE SUB Draw_FillCircle ALIAS "SB_Draw_FillCircle" LIB "sdl"
DECLARE SUB Draw_HLine ALIAS "SB_Draw_HLine" LIB "sdl"
DECLARE SUB Draw_VLine ALIAS "SB_Draw_VLine" LIB "sdl"
DECLARE SUB Draw_Rect ALIAS "SB_Draw_Rect" LIB "sdl"
DECLARE SUB Draw_FillRect ALIAS "SB_Draw_FillRect" LIB "sdl"
DECLARE SUB Draw_Ellipse ALIAS "SB_Draw_Ellipse" LIB "sdl"
DECLARE SUB Draw_FillEllipse ALIAS "SB_Draw_FillEllipse" LIB "sdl"
DECLARE SUB Draw_Round ALIAS "SB_Draw_Round" LIB "sdl"
DECLARE SUB Draw_FillRound ALIAS "SB_Draw_FillRound" LIB "sdl"
Window(300, 300, "ScriptBasic Rainbow")
CLS(RGB(255, 255, 255))
m = -1.57
x1 = 1
y1 = 301
q = 0.00101
gx = 0.15
gy = 0.3
t1 = Ticks()
FOR s = 1 TO 3107
m = m + q
x1=x1 + gx * cos(m)
y1=y1 + gy * sin(m)
x2 = (x1 + 150)/2
y2 = (y1 + 300)/2
x3 = (x1 + x2) /2
y3 = (y1 + y2) /2
x4 = (x2 + 150)/2
y4 = (y2 + 300)/2
x5 = (x1 + x3) /2
y5 = (y1 + y3) /2
x6 = (x2 + x3) /2
y6 = (y2 + y3) /2
x7 = (x2 + x4) /2
y7 = (y2 + y4) /2
x8 = (x4 + 150)/2
y8 = (y4 + 300)/2
Draw_Line(x1, y1, x5, y5, RGB(255, 0, 0))
Draw_Line(x5, y5, x3, y3, RGB(255, 102, 0))
Draw_Line(x3, y3, x6, y6, RGB(255, 255, 0))
Draw_Line(x6, y6, x2, y2, RGB(0, 255, 0))
Draw_Line(x2, y2, x7, y7, RGB(0 ,0, 255))
Draw_Line(x7, y7, x4, y4, RGB(0, 0, 128))
Draw_Line(x4, y4, x8, y8, RGB(128, 0, 128))
NEXT
UpdateRect()
t2 = Ticks()
t3 = (t2 - t1) / 1000
PRINT "Lines: ", s * 7,"\n"
PRINT "Time: ",FORMAT("%.4f",t3)," seconds.\n"
WaitKey
jrs@laptop:~/sb/sb22/sdl$ scriba rainbow.sb
Lines: 21756
Time: 0.0650 seconds.
jrs@laptop:~/sb/sb22/sdl$