您的位置:首页 > 其它

FB图形例题3D旋转【VFB源码】

2018-03-08 22:58 316 查看


这是 FB 自己内部绘图专用函数画的动画当然可以用翻译为 GDI画,这里只是演示代码运行方式感兴趣的可以下载源码研究。基本代码: ScreenRes 800, 600, 32

Dim As Long fps
ReDim As V3 Va()
Dim As String d = "ABCD"
Randomize 13
AddABox(va(), Type < V3 > (400, 300, 0), 350, 2, 2, RGB(250, 100, 0)) 'skewer
'flip 90 degrees on y axis
memcpy(@va(LBound(va)), RotateArray(va(), Type < _float > (0, 1.570796, 0), vct(400, 300, 0), 0), (UBound(va) - LBound(va) + 1) *SizeOf(v3))
'Add text
For n As Long = 0 To Len(d) -1
Var zv = map(0, (Len(d) -1), n, -250, 250)
AddAChar(Va(), Chr(d
), 150, RGB(Rnd * 255, Rnd * 255, Rnd * 255), "Arial", FS_BOLD, zv)
Next n
'knob at the end
addasphere(va(), Type < V3 > (400, 300, -350), 30, RGB(200, 200, 0), 1)

Dim As Single ang, rad
Dim As v3 Ptr rr

Color, RGB(100, 100, 100)
Do
ang += .025
If ang > 1.570796 * 4 Then ang = 0 '2*pi
rr = RotateArray(va(), Type < _float > (.5, ang, 0), vct(400, 300, 0), 1)
quicksort(rr, 0, UBound(va) -1)
ScreenLock
Cls
Draw String(10, 10), "FPS =" & fps
Draw String(10, 30), "Elements = " & UBound(va)

For n As Long = LBound(va) -1 To UBound(va) -1
rad = map( -500, 500, rr
.z, 5, 2)
Circle(rr
.x, rr
.y), rad, rr
.col, , , , f
Next n
ScreenUnlock
Sleep Regulate(30, fps), 1
Loop Until Len(Inkey)源码下载:Basic语言编程群 78458582 进QQ群后,在群共享里下载。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: