i try to use my dll with purebasic, but the result of the functions seems wrong.
i dont think that i make a mistake, but here is my code.
my dll and all stuff can be found on
i still tested my dll with a visual c++ programm and it works correctly.
the fault must be in this progamm.
http://mitglied.lycos.de/stfighter07/kollision/
please help!
----------------------------------------------
InitSprite() ; Iniziert DirectX
InitKeyboard() ; Die Tastatur befehle sollen verwendet werden
InitSound() ; Sound befehle sollen verwendet werden
OpenLibrary(0, "mechanic2D.dll")
;----Bildschirmkonstanten--------
#fullscreen= 0
#resolutionx= 1024
#resolutiony= 768
#kreis= 3;
#konvex= 4;
#automatic = -1;
#PI = 3.1459
#kreis= 3
#true= 1
#false= 0
If #fullscreen = 0
If OpenWindowedScreen(OpenWindow(0, 0,0, #resolutionx,#resolutiony, #PB_Window_SystemMenu|#PB_Window_WindowCentered|#PB_Window_SizeGadget, "Kollisionen"),0,0,#resolutionx,#resolutiony, 1, 0,0)= 0 : Goto programmende : EndIf
Else
If OpenScreen(#resolutionx, #resolutiony, 16, "Kollisionen") = 0 : Goto programmende : EndIf
EndIf
SetFrameRate(75)
worldhandle.l
kreis1.l
wand.l
neuewand.l
objkreis.l
; new world will be initialized here
worldhandle= CallFunction(0,"CreateWorld") ;Result may be wrong?
;the layout for an objekt will be created here
kreis1= CallFunction(0, "CreateForm")
CallFunction(0, "AddFormPart",kreis1, 3,0,0)
CallFunction(0, "AddPoint", kreis1, 0,0)
CallFunction(0, "AddPoint", kreis1, 20,0)
CallFunction(0, "CloseForm",kreis1, 100, 100, 1)
wand= CallFunction(0, "CreateForm")
CallFunction(0, "AddFormPart",wand, 4,0,0)
CallFunction(0, "AddPoint", wand, -10,250)
CallFunction(0, "AddPoint", wand, 10,250)
CallFunction(0, "AddPoint", wand, 10,-250)
CallFunction(0, "AddPoint", wand, -10,-250)
CallFunction(0, "CloseForm",wand, 0, 0, 1)
; objects will be created here
neuewand= CallFunction(0, "CreateObject", wand)
CallFunction(0, "MakeObjectAlive",neuewand, 0,-260, 0,0,0,0);
neuewand= CallFunction(0, "CreateObject", wand)
CallFunction(0, "MakeObjectAlive",neuewand, 0,260, 0,0,0,0);
neuewand= CallFunction(0, "CreateObject", wand)
CallFunction(0, "MakeObjectAlive",neuewand, 260,0, 0,0,#PI/2,0);
neuewand= CallFunction(0, "CreateObject", wand)
CallFunction(0, "MakeObjectAlive",neuewand, -260,0, 0,0,#PI/2,0);
objkreis= CallFunction(0, "CreateObject", kreis1)
CallFunction(0, "MakeObjectAlive",objkreis, 0,0, 0.3,0.2,0,0);
xpos.f
ypos.f
Repeat
ExamineKeyboard()
If #fullscreen= 0
If WindowEvent()= #PB_EventCloseWindow : Goto programmende : EndIf
EndIf
xpos.f= CallFunction(0, "GetXPosition", objkreis)
ypos.f= CallFunction(0, "GetYPosition", objkreis)
;all objects get moved
CallFunction(0,"MoveObjects")
StartDrawing(ScreenOutput())
Circle(xpos+300,ypos+300,20,255);
StopDrawing()
FlipBuffers()
ClearScreen(0,0,0)
If KeyboardPushed(1) : Goto programmende : EndIf
ForEver
;-************Programmende************************
programmende: ;Programmende label
CallFunction(0,"DestroyWorld", worldhandle)
CloseLibrary(0)
CloseScreen()
