It is currently Sun Nov 01, 2020 3:00 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: [Chipmunk4PB] v0.1 is released (2D Physic Engine Wrapper
PostPosted: Wed Dec 22, 2010 10:42 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2005 2:46 pm
Posts: 1799
Location: Pas-de-Calais, France
Thank you! :D


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.1 is released (2D Physic Engine Wrapper
PostPosted: Wed Dec 22, 2010 10:54 am 
Offline
User
User

Joined: Thu May 22, 2008 10:32 pm
Posts: 65
Thanks, i was working on a wrapper too, it will be usefull :)


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.1 is released (2D Physic Engine Wrapper
PostPosted: Wed Dec 22, 2010 11:57 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
atomo wrote:
Thanks, i was working on a wrapper too, it will be usefull :)

I know.
But it will be better you use/test the Chipmunk4PB wrapper and write some examples too ;-)

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.1 is released (2D Physic Engine Wrapper
PostPosted: Wed Dec 22, 2010 12:05 pm 
Offline
User
User

Joined: Thu May 22, 2008 10:32 pm
Posts: 65
i'll do :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.1 is released (2D Physic Engine Wrapper
PostPosted: Wed Dec 22, 2010 10:04 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
A window with 10 bouncing boxes
Development time: 10min
http://www.morty-productions.de/icesoft/?download=Bounce.zip

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.1 is released (2D Physic Engine Wrapper
PostPosted: Wed Dec 22, 2010 10:29 pm 
Offline
User
User

Joined: Sun Sep 20, 2009 7:37 pm
Posts: 42
Location: Melbourne, Florida, USA
IceSoft wrote:
A window with 10 bouncing boxes
Development time: 10min
http://www.morty-productions.de/icesoft/?download=Bounce.zip

would be nice to see the source


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.3 released (2D Physic Engine Wrapper)
PostPosted: Wed Mar 16, 2011 9:34 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
Chipmunk4PB v0.3 released

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.3 released (2D Physic Engine Wrapper)
PostPosted: Thu Mar 17, 2011 11:11 pm 
Offline
Addict
Addict
User avatar

Joined: Mon May 26, 2003 3:07 pm
Posts: 1477
Location: Nantes
Nice. :)

I tried an old sample (4.X.X).
It works great but I can't detect any collision.

- Does collision detection work ? (cpArrayEach)
- Your cpSpaceEachBody function has 4 arguments. I didn't found this 4th in chipmunk doc ?

Here is my example :
Code:
XInclude "Chipmunk4PB_v0.3.pbi"

Global *space.cpSpace
Global *staticBody.cpBody
Global ticks

Procedure DrawPolyShape(*poly.cpPolyShape)
   Protected *verts.cpVect=*poly\verts
   Protected *last.cpVect
   Protected v.cpVect
   Protected first.cpVect
   Protected last.cpVect
   
   *last=*verts+SizeOf(cpVect)*(*poly\numVerts-1)
   cpvrotate(v, *last, *poly\shape\body\rot)
   cpvadd(v, v, *poly\shape\body\p)
   cpv(last, v\x, v\y)
   
   For i=0 To *poly\numVerts-1
      cpvrotate(v, *verts, *poly\shape\body\rot)
      cpvadd(v, v, *poly\shape\body\p)
      LineXY(last\x, last\y, v\x, v\y, RGB(0, 0, 0))
      cpv(last, v\x, v\y)
      *verts+SizeOf(cpVect)
   Next
   Circle(*poly\shape\body\p\x, *poly\shape\body\p\y, 2, RGB(0, 0, 255))
EndProcedure
Procedure DrawCircleShape(*circle.cpCircleShape)
   Protected x=*circle\tc\x
   Protected y=*circle\tc\y
   Protected r.f=*circle\r
   Protected a.f=*circle\shape\body\a
   Circle(x, y, r)
   LineXY(x, y, x+Cos(a)*r, y+Sin(a)*r)
EndProcedure
Procedure DrawSegmentShape(*seg.cpSegmentShape)
   Protected a.cpVect
   Protected b.cpVect
   
   cpvrotate(a, *seg\a, *seg\shape\body\rot)
   cpvrotate(b, *seg\b, *seg\shape\body\rot)
   cpvadd(a, a, *seg\shape\body\p)
   cpvadd(b, b, *seg\shape\body\p)
   
   LineXY(a\x, a\y, b\x, b\y, RGB(0, 0, 0))
EndProcedure
ProcedureC DrawShape(*shape.cpShape, *datas)
   Select *shape\klass\type
      Case #CP_CIRCLE_SHAPE
         DrawCircleShape(*shape)
      Case #CP_SEGMENT_SHAPE
         DrawSegmentShape(*shape)
      Case #CP_POLY_SHAPE
         DrawPolyShape(*shape)
   EndSelect
EndProcedure
ProcedureC DrawCollisions(*arbiter.cpArbiter, *datas)
   Protected i
   For i=0 To *arbiter\numContacts-1
      *contacts.cpContact=*arbiter\contacts+SizeOf(cpContact)*i
      Circle(*contacts\p\x, *contacts\p\y, 2, #Red)
   Next
EndProcedure
ProcedureC FixBodyPositions(*body.cpBody, *datas)
   ;check if object is offscreen
   If *body\p\y>500 Or *body\p\x>680 Or *body\p\x<-20
      ;reset its position if necessary
      *body\p\x=Random(640)
      *body\p\y=-20*Random(30)
   EndIf
EndProcedure


Procedure InitObjects()
   Protected *shape.cpShape
   Protected *body.cpBody
   Protected i, j
   
   cpInitChipmunk()
   cpResetShapeIdCounter()
   
   ;{/// PHYSIC ENVIRONMENT
   *staticBody=cpBodyNew(#INFINITY, #INFINITY)
   
   *space=cpSpaceNew()
   *space\iterations=5
   cpv(*space\gravity, 0, 100)
   cpSpaceResizeStaticHash(*space, 40.0, 999)
   cpSpaceResizeActiveHash(*space, 30.0, 2999)
   ;}
   
   ;{/// TRIANGLES
   Dim TRIANGLE.cpVect(3)
   cpv(TRIANGLE(0), 15, 15)
   cpv(TRIANGLE(1), 0, -10)
   cpv(TRIANGLE(2), -15, 15)
   
   For i=0 To 8
      For j=0 To 5
         s.l=j%2
         Protected stagger.f=s*40
         Protected offset.cpVect
         cpv(offset, i*80+stagger, 100+(j*70) )
         *shape=cpPolyShapeNew(*staticBody, ArraySize(TRIANGLE()), @TRIANGLE(), offset)         
         *shape\e=1.0
         *shape\u=1.0                 
         cpSpaceAddShape(*space, *shape)
      Next
   Next
   ;}
   
   ;{/// FALLING COINS
   Dim COIN.cpVect(5)
   For i=0 To ArraySize(COIN())-1
      Protected angle.f=-2*#PI*i/ArraySize(COIN())
      cpv(COIN(i), 10*Cos(angle), 10*Sin(angle))
      Debug Str(10*Cos(angle))+" "+Str(10*Sin(angle))
   Next
   
   For i=0 To 299
      *body=cpBodyNew(1.0, cpMomentForPoly(1.0, ArraySize(COIN()), @COIN(), cpvzero))
      cpv(*body\p, Random(640), -20*Random(200) )     
      cpSpaceAddBody(*space, *body)
     
      *shape=cpPolyShapeNew(*body, ArraySize(COIN()), @COIN(), cpvzero)
      *shape\e=0.0
      *shape\u=0.4
      cpSpaceAddShape(*space, *shape)
   Next
   ;}
EndProcedure
Procedure MoveObjects()
   ticks+1
   Protected steps.f=1.0
   Protected dt.f=1.0/60.0/steps
   Protected i
   For i=0 To steps
      cpSpaceStep(*space, dt)
      cpSpaceEachBody(*space, @FixBodyPositions(), #Null, #Null)
   Next   
EndProcedure
Procedure DrawObjects()
   ClearScreen(RGB(255, 255, 255))
   StartDrawing(ScreenOutput())
      DrawingMode(#PB_2DDrawing_Outlined)
      cpSpaceHashEach(*space\activeShapes, @DrawShape(), #Null)
      cpSpaceHashEach(*space\staticShapes, @DrawShape(), #Null)
      DrawingMode(#PB_2DDrawing_Default)
      cpArrayEach(*space\arbiters, @DrawCollisions(), #Null)
   StopDrawing()
   FlipBuffers()   
EndProcedure
Procedure FreeObjects()
   cpSpaceFree(*space)
   cpBodyFree(*staticBody)
EndProcedure

InitSprite()
InitKeyboard()
InitObjects()

OpenWindow(100, 0, 0, 640, 480, "Test : Chipmunk 4.1.0 / 5.X.X - PACHINKO", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(100), 0, 0, 640, 480, 0, 0, 0)
Repeat
   DrawObjects()
   MoveObjects()
   ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or WaitWindowEvent(1)=#PB_Event_CloseWindow
FreeObjects()
End

_________________
Imagewin8.1 x64 5.31 | IDE | PB plugin | Tools | Sprite | JSON | visual tool


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.3 released (2D Physic Engine Wrapper)
PostPosted: Thu Mar 31, 2011 6:18 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
eddy wrote:
It works great but I can't detect any collision.
- Does collision detection work ? (cpArrayEach)
- Your cpSpaceEachBody function has 4 arguments. I didn't found this 4th in chipmunk doc ?

Both are fixed. Will come with the next version.

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.3 released (2D Physic Engine Wrapper)
PostPosted: Mon Apr 04, 2011 8:15 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
Short demo: shows the collisionshandler functions

http://www.morty-productions.de/icesoft ... andler.zip

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.4 released (2D Physic Engine Wrapper)
PostPosted: Fri Apr 15, 2011 6:14 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
Update: Chipmunk4PB_v0.4:
Demo (with Source) +Collisionshandler +Constraints
Have fun!
Download link:
http://www.morty-productions.de/icesoft ... unk4PB.zip

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.4 released (2D Physic Engine Wrapper)
PostPosted: Tue Sep 06, 2011 8:21 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
I created an own forum for the Chipmunk4PB Wrapper:
http://chipmunk4purebasic.freeforums.org/index.php

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.4 released (2D Physic Engine Wrapper)
PostPosted: Tue Sep 06, 2011 9:12 am 
Offline
Addict
Addict
User avatar

Joined: Thu Aug 07, 2003 7:01 pm
Posts: 3158
Location: United Kingdom
Thanks for the info, will join your forum later today. :)

but, imho, either this or Box2D needs to be built-in to the PB native libs.

_________________
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] v0.4 released (2D Physic Engine Wrapper)
PostPosted: Fri Sep 16, 2011 5:38 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
Here a nice example code:
http://www.file-upload.net/download-373%20...%20D.exe.html

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
 Post subject: Re: [Chipmunk4PB] 7.01 Preview (2D Physic Engine Wrapper)
PostPosted: Wed Apr 12, 2017 7:52 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1485
Location: Germany
After a long time:
Chipmunk4PB_7.01 (preview) is available:
(it works well)

Download:
http://www.morty-productions.de/icesoft ... B_7.01.zip (143.4 KB)

Please replace on HelloNewton2D_Chipmunk4PB.pb (line 140):
Code:
cpSpaceStep(*space, 0.1) with   cpSpaceStep(*space, timeStep)


Contains:
Quote:
PB example file: Chipmunk4PB_7.01\HelloNewton2D_Chipmunk4PB.pb
Residents file: Chipmunk4PB_7.01\Residents\Chipmunk4PB.res
UserLibrary: Chipmunk4PB_7.01\UserLibraries\Chipmunk4PB


How to configure it:
Quote:
1) Copy the Chipmunk4PB.res into folder "PureBasic\Residents"
2) Copy the Chipmunk4PB into folder "PureBasic\UserLibraries"


How to test/use it:
Quote:
1) Start PureBasic => load "HelloNewton2D_Chipmunk4PB.pb" => run this example

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye