|
1381
|
Developer / Technical / Re: What language should I learn, dudes?
|
on: November 19, 2010, 10:31:01 AM
|
I think it's very hard to justify any language without garbage collection as a first programming language. It's not the 90s anymore.
There's always smart pointers. Learn C#. It is a great language for learning. I strongly advise against C/C++. It is a language that is extremly hard to master and especially for beginners it is a burden. C++ is a very complex language and the possible perfomance improvements come with many drawbacks in coding comfort and ease of use. I have never felt more comfortable with any languages, and the many possibilities makes it very easy to use once you know it well. Still though, you're right in saying that it's not the best language for a complete beginner. --- ALSO, just to tell; I had the skeleton of a Breakout clone working four days after getting into C++ (using SDL). My only real previous experience was GML, some BlitzBasic and web design with PHP and some JavaScript. The code wasn't pretty, but the game was working, and I've learned loads since then. C++ isn't as hard as you want to make it appear.
|
|
|
|
|
1382
|
Developer / Technical / Re: Collision Detection for Rotating Objects
|
on: November 03, 2010, 03:42:13 PM
|
The short answer is that you don't want to write this yourself and that you should find a physics engine and use that.
If you are resolved to create your own solution then the problem basically becomes writing a physics engine. Nothing wrong with that, but you should do that because you want to write a physics engine, not because you want to make a game with rotating objects.
Quoted for truth. www.box2d.org
|
|
|
|
|
1383
|
Developer / Technical / Re: Programming Language Resources
|
on: November 02, 2010, 01:08:47 PM
|
http://kerp.net/box2dThis is a wonderful set of video tutorials for Box2D. The version used is not the latest one, and a few things are different, but it's nothing a programmer can't easily fix himself with a little information gathered from elsewhere. The tutorials are for ActionScript 3, but as the structure of the library is the same, it doesn't matter. I'm using these tutorials to use Box2D with C++, and it's working out just fine (and I get to learn ActionScript 3 along the way, if I would ever want to use that!).
|
|
|
|
|
1385
|
Developer / Technical / Re: The happy programmer room
|
on: November 01, 2010, 06:12:43 PM
|
hackish way of showing an animation while loading/generating textures: throw calls to "renderLoaderSpinner" EVERYWHERE.
Worked almost the first time actually and looks pretty darn decent.
How about firing up a new thread instead? It's not trivial to load textures into opengl on one thread (this includes rendering up dynamically generated textures) while simultaneously rendering to the main window from another thread. You need more than one context, which SDL's support of is disgustingly lacking (i will get all the SDL out of the code EVENTUALLY, even then its not a simple task) i actually do have support for loading raw files into memory on a separate thread, which I do to make sure all this loader is doing just sending stuff to the GPU and generating the dynamic stuff I need. Why is this? It doesn't make sense to me.
|
|
|
|
|
1386
|
Developer / Technical / Re: Linking Box2D in Xcode (not for iOS)? [SOLVED]
|
on: November 01, 2010, 06:11:19 PM
|
|
Hahaha. Okay. I solved it. My fault, of course. I had a file of my own, named math.h, located in the folder above the Box2D one, which I gave to Xcode as a search directory. I changed the name of this file and changed the includes of the files that depend on it, and now it works.
I feel a bit ashamed, of course, but I'm just extremely happy to have solved this. Now I can do some actual work again.
SOLVED.
|
|
|
|
|
1387
|
Developer / Technical / Re: The happy programmer room
|
on: November 01, 2010, 05:22:51 PM
|
hackish way of showing an animation while loading/generating textures: throw calls to "renderLoaderSpinner" EVERYWHERE.
Worked almost the first time actually and looks pretty darn decent.
How about firing up a new thread instead?
|
|
|
|
|
1389
|
Developer / Technical / Re: Linking Box2D in Xcode (not for iOS)?
|
on: November 01, 2010, 05:18:20 PM
|
These are the errors I get for the first file (and they're pretty much the same for all others): /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:99:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:99: error: '::acos' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:116:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:116: error: '::asin' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:131:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:131: error: '::atan' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:146:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:146: error: '::atan2' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:162:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:162: error: '::ceil' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:177:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:177: error: '::cos' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:192:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:192: error: '::cosh' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:207:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:207: error: '::exp' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:222:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:222: error: '::fabs' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:237:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:237: error: '::floor' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:252:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:252: error: '::fmod' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:262:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:262: error: '::frexp' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:277:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:277: error: '::ldexp' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:292:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:292: error: '::log' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:307:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:307: error: '::log10' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:322:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:322: error: '::modf' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:341:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:341: error: '::pow' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:363:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:363: error: '::sin' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:378:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:378: error: '::sinh' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:393:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:393: error: '::sqrt' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:408:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:408: error: '::tan' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:423:0 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/cmath:423: error: '::tanh' has not been declared
/Users/Skomakarn/Dropbox/Tommy/Tommy2/TommyXcode/TommyXCode/../../classes/events/../graphics/../maths/../../math.h:90:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/TommyXcode/TommyXCode/../../classes/events/../graphics/../maths/../../math.h:90: error: 'round' is not a member of 'std'
/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/SFML.framework/Headers/Graphics/Matrix3.inl:58:0 /Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/SFML.framework/Headers/Graphics/Matrix3.inl:58: error: 'cos' was not declared in this scope
/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/SFML.framework/Headers/Graphics/Matrix3.inl:59:0 /Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/SFML.framework/Headers/Graphics/Matrix3.inl:59: error: 'sin' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Settings.h:142:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Settings.h:142: error: 'sqrtf' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:119:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:119: error: 'sqrtf' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:217:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:217: error: 'cosf' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:217:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:217: error: 'sinf' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:233:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:233: error: 'cosf' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:233:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:233: error: 'sinf' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:256:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:256: error: 'atan2f' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:353:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:353: error: 'atan2f' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:619:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/Box2D/Common/b2Math.h:619: error: 'floorf' was not declared in this scope
/Users/Skomakarn/Dropbox/Tommy/Tommy2/TommyXcode/TommyXCode/../../main.cpp:497:0 /Users/Skomakarn/Dropbox/Tommy/Tommy2/TommyXcode/TommyXCode/../../main.cpp:497: error: 'round' was not declared in this scope So most of them are related to <cmath>, some of them to my own files and some to Box2D's files, but they're all ultimately related to <cmath> and/or <math.h>... I did not get these errors before trying to integrate Box2D and messing with the header paths/-I flags.
|
|
|
|
|
1390
|
Developer / Technical / Re: Linking Box2D in Xcode (not for iOS)?
|
on: November 01, 2010, 04:29:42 PM
|
Howdy,
I just tried it myself at home for a project I'm thinking of starting up.. here's what you do
Copy the Box2D directory to your project..
note: not the Box2D_v2.1.2 that pops up when you unzip the source but the the Box2D_v2.1.2/Box2D/ directory only Box2D_v2.1.2 contains a whole ton of things you don't need like freeglut this is probably the source of the errors you've been getting That's not the source of the errors. Adding only the relevant folder is exactly what I've done. then set your header search path to that directory in your project.. Did that. then build and you should be golden Nope. Still getting the same errors about std functions from C. you may need to right click on frameworks and add libstdc++ if you get any errors Didn't help. if this isn't working for you still I can link you a copy of the project on dropbox if ya need it You could, but I'm not sure it'll help. The errors I get are in files that I have not created myself, such as std_algobase.h... No idea what's going on, really. Never got these errors before trying to integrate Box2D with the project.
|
|
|
|
|
1391
|
Developer / Technical / Re: Linking Box2D in Xcode (not for iOS)?
|
on: November 01, 2010, 01:30:03 PM
|
|
Okay... So. I add the Box2D folder to my project. I put the path to the folder above it as a recursive header search path. No more errors about finding Box2D headers and classes, but instead thousands of errors about not finding functions such as std::mem*, std::str* and lots of other C library stuff. Fffffff.
EDIT 1: The errors are in STL files, so I'm guessing the search path overwrites the default ones or something... Adding it to the user search paths instead, takes me back to the error of not finding Box2D.h...
EDIT 2: Adding -I "path/to/folder/above/Box2D/" to the C++ flags does remove this problem, but still complains about ::acos and so on not having been declared, which I got before as well. Seems to be some clash between versions of STL included, or something... Bah.
|
|
|
|
|
1394
|
Developer / Technical / Re: Linking Box2D in Xcode (not for iOS)?
|
on: October 31, 2010, 07:50:21 PM
|
Just dragging libBox2D.a into your project should be enough for Xcode to automatically set up the library search path and linker flags for you.
To where? Right-clicking the root in the tree, selecting Add existing files (checking Copy or not) does not work. Okay so I apologize if some of this is telling you things you already know, but... There are two steps to compiling a program, "compiling" and "linking". At the "compile" step, all it does on function calls is figure out what the names of the various functions are. At the "link" step, it turns names for functions into actual addresses to call. In order to do the compile step, you need a "header file", so that the compiler knows the names of the functions you can call. You can tell the compiler how to find header files in two ways. You can drag the .h file into the list of files in XCode (it does not matter where in the list). Or you can add the directory containing the headers to the "header search paths" in the project "Get Info" dialog. In order to do the link step, the linker needs one of two things: the actual .c or .cpp file containing the function code so it can make an object file, or a static library (.a file) which is like a big frozen object file. You can add a .c or a .cpp file by dragging it anywhere in XCode's list of files. You can add a .a file either by dragging it into XCode's list of files; or by going into "Get Info" and adding the library's directory to "Library Search Paths" then the -llibraryname line to the "other c flags" line. I do know all of this, and this is actually exactly what I tried before making this thread. This is odd... As you wish, here is the exact error output: ld: warning: in /Users/Skomakarn/Downloads/Box2D_v2.1.2/Box2D/Box2D/libBox2D.dylib, file is not of required architecture Undefined symbols: "vtable for b2PolygonShape", referenced from: __ZTV14b2PolygonShape$non_lazy_ptr in PhysicalBody.o "b2World::b2World(b2Vec2 const&, bool)", referenced from: oyggj::Level::Level(oyggj::String const&)in Level.o "b2World::DestroyBody(b2Body*)", referenced from: oyggj::PhysicalBody::EventHandler::onBake(oyggj::CollisionEvent const*)in PhysicalBody.o "b2World::ClearForces()", referenced from: oyggj::Level::update() in Level.o "b2World::~b2World()", referenced from: oyggj::Level::~Level()in main.o oyggj::Level::~Level()in main.o oyggj::Level::Level(oyggj::String const&)in Level.o "b2PolygonShape::SetAsBox(float, float)", referenced from: oyggj::PhysicalBody::EventHandler::onBake(oyggj::CollisionEvent const*)in PhysicalBody.o "b2World::CreateBody(b2BodyDef const*)", referenced from: oyggj::PhysicalBody::EventHandler::onBake(oyggj::CollisionEvent const*)in PhysicalBody.o "oyggj::PhysicalBody::handler", referenced from: __ZN5oyggj12PhysicalBody7handlerE$non_lazy_ptr in PhysicalBody.o "b2World::Step(float, int, int)", referenced from: oyggj::Level::update() in Level.o "b2Body::CreateFixture(b2FixtureDef const*)", referenced from: oyggj::PhysicalBody::EventHandler::onBake(oyggj::CollisionEvent const*)in PhysicalBody.o ld: symbol(s) not found collect2: ld returned 1 exit status I did compile Box2D myself, so I don't see why it would not be of the required architecture... I guess we might have a clue now, at least, though.
|
|
|
|
|
1395
|
Developer / Technical / Re: Linking Box2D in Xcode (not for iOS)?
|
on: October 31, 2010, 02:57:28 PM
|
Just dragging libBox2D.a into your project should be enough for Xcode to automatically set up the library search path and linker flags for you.
To where? Right-clicking the root in the tree, selecting Add existing files (checking Copy or not) does not work.
|
|
|
|
|
1396
|
Developer / Technical / Re: Linking Box2D in Xcode (not for iOS)?
|
on: October 31, 2010, 08:30:34 AM
|
Box2D is usually set up to be compiled into your application, rather than linked in. So to start with the basic questions: I have performed the cmake, make and sudo make install commands, and I can, without any problems, compile manually in the terminal, using G++. It's only yielding errors through Xcode. Have you actually compiled the library, and ensured it's in the library search path. Are you talking about the $PATH variable, or something in Xcode? Have you ensured it's built by the same compiler, same (relevant) options. The global GCC should be the same as the one in Xcode... In particular, check whether exceptions are enabled - by default Box2D doesn't have this on, and I think on some platforms this affects name munging and thus will cause linker errors. Where in Xcode do I do this? If you have checked all of those, you need to get dirtier. Locate the library and check to see if it actually has the missing symbols. On linux, one would use nm and ar to do this. The object files are there, at least... AFAIK, there's nothing special about using box2d as a library over using anything else. And that's my experience in the terminal. Like I said up there, only Xcode causes trouble.
|
|
|
|
|
1397
|
Developer / Technical / Linking Box2D in Xcode (not for iOS)? [SOLVED]
|
on: October 31, 2010, 06:53:06 AM
|
|
I'm trying to make a C++ program (which is not for iOS, but for OS X, Windows and Linux) using Box2D to compile in Xcode. Thanks to the TIGS IRC channel, I managed to get Xcode to understand where the Box2D.h file is located, by adding the path to the Library Search Paths in the project build settings.
However, linking doesn't work, and when trying to compile the program, I get about ten vtable related errors. I've added -lBox2D to the Other Linker Flags in the project build settings, but it doesn't help.
Does anybody know how to set this up properly?
|
|
|
|
|
1398
|
Developer / Technical / Re: The happy programmer room
|
on: October 29, 2010, 05:58:36 AM
|
That's just stupid, as I don't even have to use any parameters for the main() function if I don't want to...
You do if you're using SDL. Also there are situations in which you might be passing in unused parameters to functions other than main(). The example that told me to do this in the first place doesn't use SDL. It's text based.
|
|
|
|
|
1400
|
Developer / Technical / Re: The happy programmer room
|
on: October 28, 2010, 11:43:35 PM
|
Yeah, B2_NOT_USED prevents a compiler warning that you are, wait for it, not using a variable. If you don't have that warning enabled, don't bother with it.
That's just stupid, as I don't even have to use any parameters for the main() function if I don't want to...
|
|
|
|
|