idmillington / cyclone-physics

The Physics engine that accompanies the book "Game Physics Engine Design"
MIT License
946 stars 265 forks source link

Cyclone version using C++11 #18

Closed LucasCampos closed 11 years ago

LucasCampos commented 11 years ago

Seems that the timing library is the only code the has some SO specificity, as there used to be no portable way to fetch the time in a precise manner.

But, by using the chronos library of C++11 should be possible to do so. I have implemented a simple version of timing.{cpp|h}, using such library. I can compile and run correctly on linux, but do I cannot test this code on windows, and I do not know how C++11 support on windows is advancing. Would you kindly try the code?

The code can be found here: https://github.com/LucasCampos/cyclone-physics/tree/linux-c++11

I also would like to apologize in case I should send this a pull request rather than as a issue. If it is the case, please warn me.

All tests were done a Ubuntu 12.04 64bits, using g++ 4.6.3.

idmillington commented 11 years ago

I also develop primarily on Linux, and switched to c++11 (I use clang++ normally). One of my jobs for this year is to move the code over, and generally make it a better and more concise c++ style, rather the pseudo-C/javadoc style it is in now. That in preparation for possibly a C++11 edition of the book in 2014. My priority will be my AI code, however, so this may take a while.

chrono is in VS2012 (but not before). C++11 support in VS is okay, but it misses both variadic templates and initializer lists, which are pretty significant and have knock-on effects elsewhere (e.g. std::tuple can take a max of 5 fields). Your modified timing.h file works as you have it, on VS2012.

I'd rather keep C++11 on a branch for a bit, because I know several schools that teach from my book still use older VS versions in their labs.

LucasCampos commented 11 years ago

Fair enough. Before spending more hours on the timing code, I wanted to know if using C++11 was acceptable. I'm glad to know it is. I think it indeed is understandable to delay putting C++11 on master until VS2012 is widespread.

That said, if I make a pull a request, will you be able to put the new code on a new branch? Sorry if this is a silly question. I'm a github beginner.

idmillington commented 11 years ago

Yes, I can. I'm not sure if I can do it through github's interface, but I can easily pull onto a branch in my local clone and then push it back to the main github repo.

Ian.

On 1 March 2013 10:04, Lucas Campos notifications@github.com wrote:

Fair enough. Before spending more hours on the timing code, I wanted to know if using C++11 was acceptable. I'm glad to know it is. I think it indeed is understandable to delay putting C++11 on master until VS2012 is widespread.

That said, if I make a pull a request, will you be able to put the new code on a new branch? Sorry if this is a silly question. I'm a github beginner.

— Reply to this email directly or view it on GitHubhttps://github.com/idmillington/cyclone-physics/issues/18#issuecomment-14280907 .