• Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About AndyTang

  • Rank
  1. From watching the Android game programming Google conference, they mention that it is a good idea to separate the rendering and the game logic, ie via threads. My question is, how does the rendering thread knows that when it is rendering the gaming data, that it is not being altered at the same time? Has anyone used this type of method before? For reference here is the video:
  2. Does anyone know any good internet resources or good books on template meta programming and design? I'm looking into something that compares and contrast the techniques between dynamic polymorphism and static polymorphism.
  3. Quote:Original post by alvaro Why are you using a vector of pointers? I prefer using a vector of objects, unless there is a good reason to use pointers (e.g., objects are HUGE and relocations would be too expensive, or I need polymorphism). If I really need to use pointers, I use a vector of shared_ptr or boost::ptr_vector. You are quite right. My example above was just a much simplified version of the actual code as a way to determine if my question could be done simply. I'am indeed using using a vector of smart pointers, which unfortunately brings their own little complication with something like this. :) I like to thanks everyone for their answers though. I am still getting my head around boost and binds as I have heard that doing your own vector loops is inefficient compared to the std algorithm.
  4. Here's a simplified version of my code. class ObjectA { ... } typedef std:vector<ObjectA*> ObjectAVector; class ObjectB { void Apply(Object& A) { ... } void Apply(ObjectAVector& av) { for(ObjectAVector::iterator it = av.begin(); it != av.end(); ++it) { Apply(**it); } } } I am wondering, is there a way to convert that iterator loop with a std::for_each algorithm. Using boost is possible as well as anything available within the C++ standard in VS2008.
  5. I am not sure if this is the right place to post Android Java programming so forgive me if it isn't. Does anyone have a working downloadable video capture code for the Android? Search results in google is not giving me much help as the code I've seen is what I've implemented and the error message is simply that prepare fails. I'm just not sure what I am doing wrong.
  6. Image Rotation Problems

    Thanks for your reply. I will check it :)
  7. Image Rotation Problems

    Thanks for the quick reply! I have the formula to go from source to destination: x' = x * cos(a) + y * sin(a) + cx y' = y * cos(a) - x * sin(a) + cy Is it a matter of just using the same formula in reverse, or is there a clever way to work out the source destination? I'm actually quite surprise there isn't something in GDI or GDI+ that does both alpha transparencies and rotation.
  8. I've recently tried rotating a alpha-transparent PNG but have run into a few snag and hope you guys can help. Basically, all I'm doing is going through every pixel in the source bitmap, rotating it, and placing it on the destination bitmap in the new position. The image rotates great but the images have gaps and holes. Is there a technique I should be using?
  9. Hi, I am very new to C#. I have a created some common code within a project that I can use with any of my other projects/solution. However, this code is stored in a path outside to the current solution. Although I can add the project to the solution, is there a way to reference to those code like you can in C++? i.e. #include "..\..\myCommonCode.h"
  10. Unfortunately, this doesn't just applies to C#, but to all programming languages including C++ on the Windows platform. As of Vista, program write access to 'Program Files' is restricted unless the user specifies they allow the app to (by giving Admin rights to the add - run as Admin). There is no way to get around this, but I have to agree with Microsoft on this one. The proper way to write user specific files/settings is either in 'App Data', or 'My Documents'. This will also account for multiple users on a single machine as well.
  11. mmh, I think it all comes to my evaluation method. I'm trying to find how many items are unique in an array. I do this by creating a boolean array, all set to false. As it reads in each number, it flips the boolean value to true. At the end, I count the number of trues. On another note, strangely enough, I had a small performance increase when I changed my storage data from bytes to integers.
  12. Quote:Original post by cyansoft False according to this. Thanks for the article. :) But the article states there are no performance difference between post- and pre-increment except for static variables. I'm just curious about performance at the moment because I'm working on some AI algorithms. I've recently ported some code from C++ to C# but I found it much much slower (about 3x slower). But this is only because I know how to optimise my C++ code (ie use of pointer arithmetic and for array iterations). Anyone know much about optimising code in C#?
  13. Just needed confirmation on something about c#. I have always been told that in C++, the pre-increment (++n) operator was the fastest operation for incrementing a integer. However, I've now been informed that this isn't the case anymore with c#. n = n + 1 is just as fast as n++ and ++n. Is this true?
  14. MFC Document/View question

    Anyone know any good MFC forums I can try this question? :)