Re: MP3D Engine Alpha 32
Posted: Wed Jan 13, 2016 12:44 am
Removed
http://www.purebasic.com
https://www.purebasic.fr/english/
ยก ABSOLUTELY AGREE !Joubarbe wrote:I don't really see the point of an installer... I mean, if someone doesn't know how to extract some folders in the proper PB directory, he sure doesn't need a game engine
I need a solution to Free the created 2D bodies, or to modify its parameters.Psychophanta wrote:There seems not to free 2DPhysics bodies nor statics entities:
Please test it in the examples of the native package.
Example:Code: Select all
BallBody=MP_2DPhysicBodyCircle(wX/2,5 , 31, Ball, 10) MP_FreeEntity(BallBody); <- does not free anything
Code: Select all
#Mode = 2; #Mode = 1 or #Mode = 7
Structure PointVertex
x.f
y.f
z.f
Color.l;d3dcolor
EndStructure
; code for MP3D
Declare DrawMatrix()
Declare changePositions()
Global angle.f
;ExamineDesktops()
;MP_Graphics3D (DesktopWidth(0),DesktopHeight(0),0,3) ; Erstelle ein WindowsFenster #Window = 0
MP_Graphics3D (800,600,0,2)
;MP_Viewport(0,0,DesktopWidth(0),DesktopHeight(0)-5)
SetWindowTitle(0, "press 'B' to change the x,y,z of lines....press up/down to move camera, A/Z to move up.down ")
camera=MP_CreateCamera()
light=MP_CreateLight(2)
MP_LightSetColor (light, RGB(255,255,255))
Global size = 300
Global Entity= MP_CreatePrimitives (size, #Mode)
Define.f red, green, blue
Quit.b = #False
;==============================================================
DrawMatrix()
MP_PrimitivesBlendingMode(Entity, 5,2)
MP_PositionEntity(camera, 0, 0, 700)
MP_EntityLookAt(camera,0,100,0)
MP_PositionEntity(light, 0 , 0, 10)
MP_EntityLookAt(light,0,0,0)
MP_VSync(0)
xx.f=0 :zz.f=0 : camY.f=0
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
If MP_KeyDown(#PB_Key_Up)
zz.f + 1
ElseIf MP_KeyDown(#PB_Key_Down)
zz.f - 1
EndIf
If MP_KeyDown(#PB_Key_Z)
camY+0.3
MP_PositionEntity(camera, 0, camY, 700)
ElseIf MP_KeyDown(#PB_Key_A)
camY-0.3
MP_PositionEntity(camera, 0, camY, 700)
ElseIf MP_KeyDown(#PB_Key_B)
changePositions()
EndIf
MP_PositionEntity(Entity, xx, 0, zz)
;MP_TurnEntity(Entity,0,0.1,0)
;changePositions(); call the routine for rotating lines
MP_DrawText (1,1,"FPS = "+Str(MP_FPS()))
MP_RenderWorld()
MP_Flip ()
Wend
Procedure DrawMatrix()
*Memory = MP_GetMemPrimitives(Entity)
For i=0 To size
x = Random(200)-100: y = Random(800)-400: z = Random(200)-100
*myvertex.PointVertex = *Memory + i * SizeOf(PointVertex)
r=0:g=255:b=0
*myvertex\x = x
*myvertex\y = y
*myvertex\z = z
*myvertex\color = MP_ARGB(200,r,g,b)
Next
MP_CloseMemPrimitives(Entity)
EndProcedure
Procedure changePositions()
angle.f = 0.01
*Memory = MP_GetMemPrimitives(Entity)
*myvertex.PointVertex = *Memory
;*********
For i=0 To size
x.f = *myvertex\x
z.f = *myvertex\z
move + 0.01
*myvertex\x = Random(200,1)
*myvertex\z = Random(200,1)
*myvertex\y = Random(200,1)
*myvertex + SizeOf(PointVertex)
Next
MP_CloseMemPrimitives(Entity)
EndProcedure
Code: Select all
BallBody=MP_2DPhysicBodyCircle(wX/2,5 , 31, Ball, 10)
MP_2DPhysicBodyRemove(BallBody); <- does free 2d bodies
Code: Select all
Procedure changePositions()
angle.f = 0.01
*Memory = MP_GetMemPrimitives(Entity)
*myvertex.PointVertex = *Memory
;*********
For i=0 To size
x.f = *myvertex\x
z.f = *myvertex\z
move + 0.01
*myvertex\x = *myvertex\x + Random(5,1) - 3 ; read and change x position
*myvertex\z = *myvertex\z + Random(5,1) - 3; read and change z position
*myvertex\y = *myvertex\y + Random(5,1) - 3; read and change y position
*myvertex + SizeOf(PointVertex)
Next
MP_CloseMemPrimitives(Entity)
EndProcedure
Thanks, not documented.mpz wrote: @Psychophanta , you can delete 2d Physic bodies with the following call MP_2DPhysicBodyRemove(Body)
Code: Select all
li=MP_2DPhysicStaticLine(x1,y1,x2,y2,$AAEEBB)
MP_2DPhysicBodyRemove(li)
Can't get the help file manuallympz wrote:Hi to all,
i have made a new lib and i have actualized the help file with the new functions. Download manually (see first post) or with the installer.
Code: Select all
Processing file : C:\MP3D Demos\Alpha\MP_AlphaTranzparenz.pb
Processing file : C:\MP3D Demos\Epyxshader\MP_Nightvision.pb
Processing file : C:\MP3D Demos\Epyxshader\MP_WobbleEffect.pb
Processing file : C:\MP3D Demos\Epyxshader\Overlay2.pb
Processing file : C:\MP3D Demos\Force Feedback\MP_ForceFeedback.pb
Processing file : C:\MP3D Demos\Mesh\MP_Mesh Achse verschoben.pb
Processing file : C:\MP3D Demos\Mesh\MP_Mesh_Create.pb
Processing file : C:\MP3D Demos\Mesh\MP_Mesh_Create2.pb
Processing file : C:\MP3D Demos\Mesh\MP_SchachDemo.pb
Processing file : C:\MP3D Demos\Mesh\MP_Spikes.pb
Processing file : C:\MP3D Demos\Shader\EffektShader\MP_BigShaderDemo.pb
Processing file : C:\MP3D Demos\Shadow\MP_ChessShadow.pb
Processing file : C:\MP3D Demos\Sound\MP_Soundeffekt.pb
Searched 195 file(s), found 37 occurrences in 13 file(s)