BASIC

Author Topic: Box2d - 2D physics  (Read 61887 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10689
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Box2d - 2D physics
« on: 2009-Sep-29 »
OK, here's Schranz0r's port of Box2D. I extended it a bit so you can debug the shapes, too.

Also, at the very bottom of the file, there's an example ("b_WakeUp") that should get you started how to extend the wrapper. You might need the get/set acceleration and velocity functions as well as the add impact functions. A "is point in shape" function would be handy for picking, too.
It's all there, just wrap it. Ask here if you need help.

You propably need the header pack (which I should update, btw.)
@Schranz0r - where is the header pack?!

Bugfix: b_DestroyBody didn't set pointer to NULL.

[edit]
Updated version 13 oct 2011


[attachment deleted by admin]
« Last Edit: 2011-Oct-13 by Kitty Hello »

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: Box2d - 2D physics
« Reply #1 on: 2009-Sep-29 »
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: Box2d - 2D physics
« Reply #2 on: 2009-Sep-29 »
This is soooooooooo cooooooooool ....thanks guys.  :good: :good: :good:
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: Box2d - 2D physics
« Reply #3 on: 2009-Sep-29 »
No Problem  :good:
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2601
    • View Profile
Re: Box2d - 2D physics
« Reply #4 on: 2009-Sep-30 »
well done guys!  :good:

P.S. Will this work on the iPhone?
Cheers,

Ian.

ā€œIt is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.ā€
(E. W. Dijkstra)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1631
  • Particle Hawk
    • View Profile
Re: Box2d - 2D physics - error messages
« Reply #5 on: 2009-Sep-30 »
My EditorE.exe is version: GLBasic IDE, Version: 7.115
GLBasic had a long list of errors on the first compile.
So, I installed the header pack.
After installing the header pack, i get a new error message:
Code: GLBasic [Select]
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.045 SN:ee90b650 - 3D, NET
Wordcount:52 commands
compiling:
*** create process failed
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 0.5 sec. Time: 21:08
Build: 0 succeeded.
*** 1 FAILED ***

BTW, this looks really cool.  :good:
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10689
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Box2d - 2D physics
« Reply #6 on: 2009-Sep-30 »
oh dear. Shut down, reboot and try again. That sounds really bad.

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: Box2d - 2D physics
« Reply #7 on: 2009-Sep-30 »
I hope you put all into   "C:\Program Files\GLBasic\Compiler\platform" ?

EDIT:

Look at this, thats cool:

http://www.youtube.com/watch?v=_k87Ybaz8tY
« Last Edit: 2009-Sep-30 by Schranz0r »
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1631
  • Particle Hawk
    • View Profile
Re: Box2d - 2D physics
« Reply #8 on: 2009-Sep-30 »
@Gernot:
I rebooted, it didnt help.

@Schranz0r:
Well yes, I installed the files and allowed overwriting of directories, it asked for each platform.
Afterwards, the error with a long list didnt happen anymore.
A new error message, the one i posted in my last post, is what i get now.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline neseir

  • Mc. Print
  • *
  • Posts: 21
    • View Profile
Re: Box2d - 2D physics
« Reply #9 on: 2009-Sep-30 »
I have the same version but did not update the header files. Works fine here. What are the changes in the header files and why should I install them ?

(From compilation of the Box2D project)

Quote
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.045 SN:eb010adf - 3D, NET
Wordcount:52 commands
compiling:

linking:
success
_______________________________________
*** Finished ***
Elapsed: 13.2 sec. Time: 14:19
Build: 1 succeeded.

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: Box2d - 2D physics
« Reply #10 on: 2009-Sep-30 »
I replaced the headers and I still get the following errors.  :'( :'( I would be thankful for any suggestions.  O_O

Code: GLBasic [Select]
In file included from C:/glbasicProjects/GLBasic/Box2D/Source/Common/b2BlockAllocator.cpp:20,
                 from C:\Temp\glbasic\gpc_temp1.cpp:37:
C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/cstdlib:49:28: bits/c++config.h: No such file or directory
In file included from C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/bits/stl_algobase.h:70,
                 from C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/memory:54,
                 from C:/glbasicProjects/GLBasic/Box2D/Source/Common/b2BlockAllocator.cpp:21,
                 from C:\Temp\glbasic\gpc_temp1.cpp:37:
C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/iosfwd:46:29: bits/c++locale.h: No such file or directory
C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/iosfwd:47:25: bits/c++io.h: No such file or directory
In file included from C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/memory:55,
                 from C:/glbasicProjects/GLBasic/Box2D/Source/Common/b2BlockAllocator.cpp:21,
                 from C:\Temp\glbasic\gpc_temp1.cpp:37:
C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/bits/allocator.h:52:31: bits/c++allocator.h: No such file or directory
In file included from C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/memory:55,
                 from C:/glbasicProjects/GLBasic/Box2D/Source/Common/b2BlockAllocator.cpp:21,
                 from C:\Temp\glbasic\gpc_temp1.cpp:37:
C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/bits/allocator.h:80: error: expected template-name before &#39;<&#39; token
C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/bits/allocator.h:80: error: expected `{&#39; before &#39;<&#39; token
C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/bits/allocator.h:80: error: expected unqualified-id before &#39;<&#39; token
*** FATAL ERROR - Please post this output in the forum
 
« Last Edit: 2009-Oct-01 by Kitty Hello »
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: Box2d - 2D physics
« Reply #11 on: 2009-Sep-30 »
Copy all files from -> C:\Program Files\GLBasic\Compiler\platform\Win32\Include\mingw32\bits

To -> C:\Program Files\GLBasic\Compiler\platform\Win32\Include\bits

Hope it fix it!

Or see attachment and place it on -> C:\Program Files\GLBasic\Compiler\platform\Win32

[attachment deleted by admin]
« Last Edit: 2009-Sep-30 by Schranz0r »
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline kaotiklabs

  • Dr. Type
  • ****
  • Posts: 313
  • Spain is diferent
    • View Profile
Re: Box2d - 2D physics
« Reply #12 on: 2009-Sep-30 »
Copy all files from -> C:\Program Files\GLBasic\Compiler\platform\Win32\Include\mingw32\bits
To -> C:\Program Files\GLBasic\Compiler\platform\Win32\Include\bits

Mine was fixed with this. Thanks!
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: Box2d - 2D physics
« Reply #13 on: 2009-Sep-30 »
MIne also fixed. Thank you, thank you, thank you very much.  =D
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1772
    • View Profile
    • Homepage
Re: Box2d - 2D physics
« Reply #14 on: 2009-Sep-30 »