BBC BASIC for Windows
« BOX2DLIB library (beta) released »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:35pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: BOX2DLIB library (beta) released  (Read 1820 times)
ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #3 on: Jan 17th, 2014, 01:19am »

Great stuff Richard.

I have downloaded the libs and examples and look forward working with it.

Update

I can get the Box2D chain example to run from the IDE but it can't find the BOX2DLIB.DLL if run from the compiled form. I even tried putting the DLL in the same directory as the program.

« Last Edit: Jan 17th, 2014, 02:06am by ScriptBasic » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #4 on: Jan 17th, 2014, 08:41am »

on Jan 17th, 2014, 01:19am, ScriptBasic wrote:
it can't find the BOX2DLIB.DLL if run from the compiled form. I even tried putting the DLL in the same directory as the program.

To successfully embed the DLL in the compiled EXE it must be in one of two places: either in the BB4W library directory (@lib$) or in the same directory as the program (@dir$) - or in a sub-directory of one of those places.

So long as that is the case the only remaining requirement is to ensure that the DLL is correctly embedded when the program is compiled. The best way is probably to incorporate a REM!Embed compiler directive in the program, but if you don't want to bother with that you can simply add the DLL manually in the Compile dialog (Add @dir$ or Add @lib$ buttons).

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin1.html#directives
http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin1.html#embedded

Richard.
« Last Edit: Jan 17th, 2014, 09:03am by admin » User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #5 on: Jan 17th, 2014, 4:07pm »

The compile dialog showed the two library resources being included. All the library related files where put in the LIB directory of BBC4W. When the compiled app didn't work, I copied the DLL to the same directory as the .exe. I then copied it to the sysWOW64 directory with no luck. Works fine running from the IDE.

User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #6 on: Jan 17th, 2014, 4:23pm »

on Jan 17th, 2014, 4:07pm, ScriptBasic wrote:
The compile dialog showed the two library resources being included.

There should be three embedded resources in total for CHAIN.BBC to work. If your Compile dialog shows only two that will be why it isn't working!

Here's a version I compiled: chain.exe

And for those who missed it the first time round, here's Svein's 'Pintograph' drawing machine with my added Meccano (TM) graphics: pintograph.exe

Richard.
User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #7 on: Jan 17th, 2014, 5:41pm »

Your chain.exe works fine. I added the BOX2DGFX.BBC to the lib include listbox (making 3 resources) but I'm still getting the same error.

User Image

I checked the temp directory created and there was no BOX2D221.DLL present. I copied from the LIB but it still doesn't work.

Can I assume that compiling BBC4W applications really means packing up the interpretive files into a bundle and executed with the runtime when uncompressed by the packaging code?

Update

I added the BOX2D221.DLL to the project and it now works from the exe created directory. Just to undo the confusion, these are library files needed to make chain.exe work standalone.

BOX2D221.DLL
BOX2DDBG.BBC
BOX2DLIB.BBC

FYI - When running the chain.exe it uses 50% of of both of my CPU cores. I would guess if I had a single core processor, I would be running at 100% CPU utilization.

« Last Edit: Jan 17th, 2014, 7:29pm by ScriptBasic » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #8 on: Jan 17th, 2014, 7:59pm »

on Jan 17th, 2014, 5:41pm, ScriptBasic wrote:
Can I assume that compiling BBC4W applications really means packing up the interpretive files into a bundle and executed with the runtime when uncompressed by the packaging code?

Indeed so.

Quote:
I added the BOX2D221.DLL to the project and it now works from the exe created directory.

As I mentioned, the safest method is to add a compiler directive in the source program:

Code:
REM!Embed @lib$+"BOX2DLIB.BBC", @lib$+"BOX2DDBG.BBC", @lib$+"BOX2D221.DLL" 

Quote:
I would guess if I had a single core processor, I would be running at 100% CPU utilization.

It shouldn't - there's a WAIT 1 (10 millisecond sleep) in the main loop. On my Windows 8.1 laptop (1.9 GHz Intel Core i7) it uses about 8% CPU. Does Wine support hardware-accelerated graphics?

Richard.
« Last Edit: Jan 17th, 2014, 8:18pm by admin » User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #9 on: Jan 17th, 2014, 9:55pm »

Quote:
Does Wine support hardware-accelerated graphics?


Supposedly for OpenGL/SDL. Not sure what Box2D is using.

« Last Edit: Jan 17th, 2014, 9:55pm by ScriptBasic » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #10 on: Jan 17th, 2014, 10:02pm »

on Jan 17th, 2014, 9:55pm, ScriptBasic wrote:
Supposedly for OpenGL/SDL. Not sure what Box2D is using.

GDI+ for the Debug Draw interface (which is what chain.bbc is using).

The idea is to use Debug Draw during development, because it makes everything 'visible', but when all the physics is working as it should you switch that off and then render the final graphics however you prefer.

The crates and pintograph examples happen to use a mixture of custom assembler and GDI (in the BOX2DGFX library), but could just as well use SDL or OpenGL, in principle.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls