Box2d Wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Box2d Wrapper

Post by monkeycracks »

Well, considering Irrlicht is used primarily for 3d purposes, I doubt that this will be useful to anyone. Here is my simple Box2d wrapper for Irrlicht. I guess I'll call it IrrBox2d just to be like everyone else

Example:

Code: Select all

#include <IrrBox2d.h>

using namespace irr;
using namespace core;
using namespace video;
using namespace scene;
using namespace gui;
using namespace io;

#pragma comment(lib, "IrrBox2d.lib")
#pragma comment(lib, "Irrlicht.lib")

int main()
{
	IrrlichtDevice* dvc = createDevice(EDT_OPENGL, dimension2d<s32>(800, 600));
	IVideoDriver* drv = dvc->getVideoDriver();
	IWorld* w = createWorld(dvc, 1.0f, dimension2d<s32>(800, 600));
	IEntityManager* em = w->getEntityManager();

	em->createStaticEntity(position2d<s32>(5, 500), drv->getTexture("platform.png"));
	em->createDynamicEntity(position2d<s32>(5, 5), 1.0f, 0.3f, drv->getTexture("red.png"));
	em->createDynamicEntity(position2d<s32>(5, 305), 1.0f, 0.3f, drv->getTexture("green.png"));
	
	while(dvc->run())
	{
		drv->beginScene(true, true, SColor(0, 0, 0, 0));
		w->update(1.0f / 60.0f, 10);
		drv->endScene();
	}
	
	w->remove();
	delete w;
	return 0;
}
Suggestions are welcome. I probably left some things out of the code by mistake or just did things in an ugly way. Feel free to comment on it.

Download link
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

That's pretty cool monkeycracks, have you ever thought of trying to integrate that with PhoenixGL. :lol:

A great wrapper, but it would be cool to see some more interesting demos.
TheQuestion = 2B || !2B
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Sorry I just got finished and was really excited. I'll make something more appealing later.

Edit: Only made it with Irrlicht because my next probably-going-to-be-deleted project is using it.
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

monkeycracks wrote:Sorry I just got finished and was really excited. I'll make something more appealing later.

Edit: Only made it with Irrlicht because my next probably-going-to-be-deleted project is using it.
Ah, okay. Care to talk about that project? :D
TheQuestion = 2B || !2B
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Some ridiculous game where animals with ridiculous proportions blow each other up. 2d. Kinda like Worms except with cats, dogs, and probably cows.

Edit!
Ouch, just realized I can't rotate 2d images with Irrlicht unless I code something which will be ridiculously annoying.

Time to start, get frustrated, and switch to the engine you sent

Edit2:
Updated solution file to not be broken
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

If anyone's interested I'll extend this project, but I'm done with it for now.
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Yeah, not to sway you or anything, but you would get direct support from myself, and Jon, on any of your questions about PhoenixGL, if you used that.
TheQuestion = 2B || !2B
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Yeah I'll probably go with that sooner or later. I haven't slept in forever though so I need to rejuvenate.
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Well I was going to attempt to pick this up since I was enlightened with this post : http://irrlicht.sourceforge.net/phpBB2/ ... gerotation

But I can't seem to get it to work. Here is my test application.. Using latest SVN

Code: Select all

#include <Irrlicht.h>

#pragma comment(lib, "Irrlicht.lib")

using namespace irr;
using namespace core;
using namespace video;

int main()
{
	IrrlichtDevice* dvc = createDevice(EDT_OPENGL);
	IVideoDriver* drv =  dvc->getVideoDriver();

	ITexture* tex = drv->getTexture("red.png");

	while(dvc->run())
	{
		drv->beginScene(true, true, SColor(0, 0, 0, 0));

		drv->draw2DImageRotation(tex, rect<s32>(50, 50, 82, 82), rect<s32>(0, 0, 32, 32), 0, 1, SColor(255, 255, 255, 255), false);
		///drv->draw2DImage(tex, rect<s32>(50, 50, 82, 82), rect<s32>(0, 0, 32, 32));

		drv->endScene();
	}

	dvc->drop();

	return 0;
}
It still says the image is loaded, but it only draws if I use the commented out function instead of the new one.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Check out the sources for the Magic2D library (Somewhere on this forum.)
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Unfortunately it looks like I'll have to downgrade to Irrlicht v1.1 to use it. This should be fine though since I'll mostly only be using 2d functions. Sample application crashes with latest SVN so I'll try 1.1 when I get home.

Hopefully I can get this to work, I really haven't enjoyed my adventures with HGE so far :|
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

seeing the source would be for modding yours to have extra functions, not using an older library :) although 1.1 is limited it works fine for 2d with magic lib
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

The link to the source was dead, so I couldn't compile it to be used with 1.4. Works like a charm with 1.1 and I have no problem stepping back a bit.
geronika2004
Posts: 11
Joined: Mon Jan 22, 2007 5:42 pm
Location: Tbilisi, Georgia, Eastern Europe
Contact:

box2d

Post by geronika2004 »

Dear all,

the link provided above is dead

I can not download irrbox2d.h wrapper, the link is dead. Please, resubmit it for download :(

Thank you in advance.
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: Box2d Wrapper

Post by netpipe »

I only have cobra's version in the irrlichtdemo's repo on github. please repost if found.
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
Post Reply