dann implementiert doch Highlighting für PB-Quellcode für PHPBB
Gibs doch schon, damit habe ich ja schon mal experimentiert:
Hier ein Beispiel :
PureBasic 3.3 hat geschrieben:
InitSprite()
InitKeyboard()
InitMouse()
OpenScreen(1024, 768, 32, "Bot 2.0")
b.f = 3.14159265/180
#b = 0.01745329
Bot_x.f = 500
Bot_y.f = 400
Bot_v.f = 0
Bot_w.f = 180
Bot_dw.f = 0
Structure A
x.f
y.f
w.f
EndStructure
NewList Anh.A()
For n = 1 To 10
AddElement(Anh())
Anh()\x = 500+80*n
Anh()\y = 400
Anh()\w = 180
Next n
a = 1
max_v = 50
Procedure.f Abstand(x1, y1, x2, y2)
r.f = Sqr(Pow(x1-x2,2)+Pow(y1-y2,2))
ProcedureReturn r
EndProcedure
Procedure.f Winkel(x.f,y.f)
Winkel.f
If x = 0
If y < 0 : Winkel = -90 : EndIf
If y >= 0 : Winkel = 90 : EndIf
Else
Winkel = ATan(y/x)/#b
If x < 0 : Winkel + 180 : EndIf
EndIf
ProcedureReturn Winkel
EndProcedure
Repeat
ExamineMouse()
MouseX = MouseX()
MouseY = MouseY()
FlipBuffers()
ClearScreen(0,0,0)
StartDrawing(ScreenOutput())
Bot_x = Bot_x + Cos(Bot_w*b)*Bot_v*0.1
Bot_y = Bot_y + Sin(Bot_w*b)*Bot_v*0.1
Bot_w = Bot_w + Bot_dw
While Bot_w < 0 : Bot_w + 360 : Wend
While Bot_w >= 360 : Bot_w - 360 : Wend
deX = MouseX-Bot_x
deY = MouseY-Bot_y
If deX = 0 :
If deY < 0 : Winkel = -90 : EndIf
If deY >= 0 : Winkel = 90 : EndIf
Else
Winkel = ATan(deY/deX)/b
If deX < 0 : Winkel + 180 : EndIf
EndIf
Unterschied = Winkel-Bot_w
If Unterschied > 180 : Unterschied = Unterschied - 360 : EndIf
If Unterschied < -180 : Unterschied = Unterschied + 360 : EndIf
If Unterschied > 0 And Unterschied <= 180 : Bot_dw = Unterschied/10 : EndIf
If Unterschied < 0 And Unterschied >= -180 : Bot_dw = Unterschied/10 : EndIf
If Bot_dw > 45 : Bot_dw = 45 : ElseIf Bot_dw < -45 : Bot_dw = -45 : EndIf
If Bot_v > Sqr((Sqr(Pow(deX,2)+Pow(deY,2)))*2*a) : If Bot_v > 0 : Bot_v = Bot_v - a : EndIf : EndIf
If Bot_v < Sqr((Sqr(Pow(deX,2)+Pow(deY,2)))*2*a) : If Bot_v < max_v : Bot_v = Bot_v + a : EndIf : EndIf
; INFO :
;--------
; Zugobjekt : Bot mit
; _x : x-Position
; _y : y-Position
; _w : Fahr-Richtung (Winkel)
; _v : Geschwindigkeit
; Anhänger : Anh mit
; _x : x-Position
; _y : y-Position
; _w : Fahr-Richtung (Winkel)
;Berechnungen für den ersten Anhänger
xAnh.f = Bot_x-Cos(Bot_w*b)*40
yAnh.f = Bot_y-Sin(Bot_w*b)*40
ResetList(Anh())
While NextElement(Anh())
d.f = Abstand(xAnh,yAnh,Anh()\x,Anh()\y)
If d <> 40 :
Anh()\w = Winkel(xAnh-Anh()\x, yAnh-Anh()\y)
Anh()\x = Anh()\x + Cos(Anh()\w*b)*(d-40)
Anh()\y = Anh()\y + Sin(Anh()\w*b)*(d-40)
EndIf
xAnh = Anh()\x-Cos(Anh()\w*b)*40
yAnh = Anh()\y-Sin(Anh()\w*b)*40
Wend
;Bot
Circle(Bot_x, Bot_y, 15, RGB(255,255,255))
Circle(Bot_x+Cos(Bot_w*b)*15, Bot_y+Sin(Bot_w*b)*15, 10, RGB(255,255,255))
LineXY(Bot_x, Bot_y, Bot_x+Cos(Bot_w*b)*40, Bot_y+Sin(Bot_w*b)*40)
LineXY(Bot_x, Bot_y, Bot_x-Cos(Bot_w*b)*40, Bot_y-Sin(Bot_w*b)*40)
ResetList(Anh())
While NextElement(Anh())
;Anhänger
Circle(Anh()\x, Anh()\y, 10, RGB(0,255,255))
LineXY(Anh()\x, Anh()\y, Anh()\x+Cos(Anh()\w*b)*40, Anh()\y+Sin(Anh()\w*b)*40)
LineXY(Anh()\x, Anh()\y, Anh()\x-Cos(Anh()\w*b)*40, Anh()\y-Sin(Anh()\w*b)*40)
Circle(Anh()\x+Cos(Anh()\w*b)*40, Anh()\y+Sin(Anh()\w*b)*40, 5, RGB(0,255,0))
Wend
;Maus
Circle(MouseX, MouseY, 5, RGB(128,128,128))
StopDrawing()
ExamineKeyboard()
Until KeyboardReleased(#PB_Key_Escape) <> 0
End
; ExecutableFormat=Windows
; UseIcon=C:\Dokumente und Einstellungen\Martin\Eigene Dateien\FLSDCT\icon.ico
; Executable=C:\Dokumente und Einstellungen\Martin\Desktop\klein Kram\Hat.exe
; DisableDebugger