Jump to content

Furbolg

Members
  • Posts

    243
  • Joined

  • Last visited

Everything posted by Furbolg

  1. You have to set it in your system > environment variables as already told. If you have Win Vista+, you simply can type "environment" into windows search and get the configuration directly.
  2. Furbolg

    One Little Thing

    I agree full to Roland, except this one: But thats only a opinion thing, if you can work with it its fine
  3. Furbolg

    One Little Thing

    Thats weird naming and typing. What i personally do is something like this // types.h typedef signed char s8; // 1 –128 to 127 typedef signed short s16; // 2 –32,768 to 32,767 typedef signed long s32; // 4 –2,147,483,648 to 2,147,483,647 typedef signed long long s64; // 8 –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 typedef unsigned char u8; // 1 0 to 255 typedef unsigned short u16; // 2 0 to 65,535 typedef unsigned long u32; // 4 0 to 4,294,967,295 typedef unsigned long long u64; // 8 –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 typedef float f32; // 4 3.4E +/- 38 (7 digits) typedef double f64; // 8 1.7E +/- 308 (15 digits) 1. this isnt true... copying primitive/nativ types is faster 2. You have to watch the side effects when you using reference/pointers they can change anytime (especially pointers, the can pointing into invalid memory etc.) Lets say you have a function which sets a box position with a simple float reference, now you create another box and use the same variable to place the box. What happens now is that both boxes are at the same place. (You cant use literals for reference, a reference need a valid object at the time you are using it also null/nullptr is not allowed)
  4. Furbolg

    One Little Thing

    Can i haz templates ?
  5. Furbolg

    One Little Thing

    Everyone has his favorite tools (and i cant work without visual assist or resharper anymore *vanish* ) @Rick: yes, it was just an idea because everything in std:: (except tr1 etc.) is standard c++ and the chances it works on other (modern/actual) c++ compiler are pretty high.
  6. Furbolg

    One Little Thing

    I dont know much about the mobil devices but maybe std::function / std::bind is a solution ? (requires c++11 / visual studio 2012 afaik)
  7. Furbolg

    One Little Thing

    It isnt about the size (in times of giga bytes), its about speed (lumooja) but more about good practise. No serious c++ programmer (and you advertise LE3 as c++ engine) will use reference for an simple int. Its like having spelling errors on your website, it looks unprofessional... ok it dont matter in this case. Just wanted to give a tip.
  8. Furbolg

    One Little Thing

    Yes i know but an native/primitive type to copy is faster then referencing it because of the indirection. http://stackoverflow.com/questions/2108084/pass-by-reference-more-expensive-than-pass-by-value
  9. Furbolg

    One Little Thing

    Hi Josh, really nice to hear this. One question: why the addhook function has a reference for the first parameter ? (if you use native datatypes (int, float ,char etc) it dont make sense to use reference/pointer because the variable/parameter which stores the adress also consumes memory. So you should use call by value in this case (int hookid))
  10. Furbolg

    Unit Testing

    "Good programming" doesnt mean to optimize every little if, switch etc. When you use inheritance (which josh does) and maybe use virtual functions (which josh probably does) then this is going to waste much more cycles then you can safe by optimize hundreds of little ifs. "Good programming" means in my understanding maintainable understandle code (short but precise comments, good parameter names etc.) No it will not exponentially sum up because you do other stuff as well. As i said if you render a model it has much more cpu cycles wasted than your small optimizations can safe.
  11. Furbolg

    Unit Testing

    I believe Josh can handle this. Sure an if (asm cmp) will slow down nearly everything because rendering a model / light or playing a sound has so few cpu cycles that every if counts... serious Lumooja, do you listen to yourself ? @ xtrempb: I think he means something like this // "slow" for(int i = 0; i < vector.size(); ++i) { } // "fast" int vectorsize = vector.size(); for(int i = 0; i < vectorsize; ++i) { }
  12. Furbolg

    Unit Testing

    Thats beautiful (c++ eyes) I love it
  13. Furbolg

    Unit Testing

    @ Lumooja: Sure ... Premature optimization is the root of all evil and the algorithm is more important than this little tricks.
  14. Furbolg

    Unit Testing

    @ ZioRed: Possible but wouldn't it be better to use the stack instead of the heap for this approach ? @CGMan: No its not (only) a buffer, its a "collection" of states (and some more). Lets say you want to create 2 context objects (editor with 2+ windows), how would you do that ? I mean how can you tell which Draw::SetColor belongs to which context ? @All / Josh: As i said dont take this as flaming, i just want to share my opinion/experience i made with c++.
  15. Furbolg

    Unit Testing

    Nice progress but... first sorry to be such a criticism guy but as a c++ programmer i have some issues: 1. inconsistent context Draw::SetColor(0,0,0); context->Clear(); //Display the device information on the screen Draw::SetBlendMode(Blend::Alpha); Draw::SetColor(1,1,1); Draw::Text("Orientation: "+String(Device::GetOrientation()),2,2); Draw::Text("Acceleration: "+Device::GetAcceleration().ToString(),2,22); Draw::SetBlendMode(Blend::Solid); Why you switch from context to a static class and backwards ? (You should put this Draw:: stuff into the context imho) 2. Why you have to release your shape at this //Create a shape shape = Shape::PolyMesh(model->GetSurface(0)); model->SetShape(shape); model->SetPosition(0,0,0); shape->Release(); In my opinion you shouldn't release the shape (safe it as reference) or release it in the ->SetShape Method. This is just my opinion and it is not ment to be negative.
  16. If you think about its very logical. You called each for iteration a function compared to call it once and save the result temporarly. Another good optimization is for two dimensional array, take care of your traversing order e,g. // creation unsigned char** myarray = new unsigned char*[1024]; for (int i = 0; i < 1024; ++i) { myarray[i] = new unsigned char; } // update for(int y = 0; y < 1024; ++y) { for(int x = 0; x < 1024; ++x) { myarray[y][x] = 0; // swapping x and y results in decrease/increase of nearly 50% on my system .... its because cache misses and miss prediction of cpu. } }
  17. Hi Rick! Runs smooth but sometimes the wizzards just dont aquire the target, maybe too short range ? Intel i5 2500k 4x 3.3 GHZ 8 GB Ram Win 7 64 Bit Geforce 670 GTX
  18. Hi Guys, You can use 'using namespace' with specialised types e.g. 'using namespace std::cout;' but i wouldnt use it because it hides your dependencies.
  19. Hi Aggror, very honest posting. Thanks for writing it, very interesting to see what are the good and the bad side of an project with this many people. I'll be excited to see your next project
  20. Hi Paratoxic! 1. void* (pointer) are evil (because you can pass everything to it) 2. if you use a reference (&) or pointer (*) then it will get the actual value but be careful. If the pointer points to null or an undefined value (if your variable gets deleted) you will get some strange behavior/crashes and most dangerous if you do something like this : if (myrefvalue = testvalue) You can change the value from within your "printer" method/class easily so take care and use const (the code above is not a comparisation, its an assignment which return true) The code you postet is another way (to rome) and it should work. To be honest, im an old style programmer im not such familiar with templates
  21. You cant do nothing here. Because templates are not "dynamic Type", Templates are "choosen Type". For example: std::list<string> stringlist; std::list<float> floatlist; // this ok stringlist.push_back( "test" ); floatlist.push_back( 1.0f ); // this wont work stringlist.push_back ( 2.0f ); floatlist.push_back ( "wow" ); What you "can" do here right now is using interfaces and inheritance for example: #include <windows.h> #include <iostream> #include <vector> #include <string> #include <sstream> #include <list> class IConsoleOutput { public: virtual std::string getConsoleString() = 0; }; class IntOutput : public IConsoleOutput { public: IntOutput(std::string name, int& refvalue) : name(name), value(refvalue) { } std::string getConsoleString() { std::stringstream output; output << name << " = " << value << std::endl; return output.str(); } private: std::string name; int& value; }; // same for float etc. int main() { int a = 0; std::vector<IConsoleOutput*> debugstrings; IntOutput testint(std::string("simple test"), a); debugstrings.push_back( &testint ); // i normally use IntOutput *bla = new IntOutput(...) but this is simpler and works right now // output all strings for(int i = 0; i < debugstrings.size(); i++) { std::cout << debugstrings[i]->getConsoleString(); } a = 10; // output all strings for(int i = 0; i < debugstrings.size(); i++) { std::cout << debugstrings[i]->getConsoleString(); } } This is just a small example without const correctness and some other design patterns (observer, visitor, factory ....) but i hope this is an idea for you.
  22. Hi Aggror, in the h. file you use: vector<resolution*> and in the cpp. file you use vector<resolution> thats a difference
  23. Ah ok, my fault, i thought updating newton would be enaugh. Then release LE3D soon
  24. Hi Guys! So could you make an update for Leadwerks 2.5 to support scaling (in Sandbox) again ? Because i think scaling with a external program is not a solution - its a workaround. (And besides the major competitors have scaling (unity, unreal, cryengine etc.))
  25. Could you show us the Defination and Implementation of Print ?
×
×
  • Create New...