Houdini

Members
  • Content count

    1091
  • Joined

  • Last visited

Community Reputation

266 Neutral

About Houdini

  • Rank
    Contributor
  1. Sniffing markers...

    Wow, thanks for all the replies guys! My wife and I are still reading over everything, and doing our own research. After reading some of the posts here, not only will we be talking to him about it, but we're probably going to alert his school, in hopes they can talk about it to the students. Please, keep the replies coming. Any advice/links you guys can give is very much appreciated. - Houdini
  2. Sniffing markers...

    Ok, my 12 year old son mentioned to his mom that some of his friends in school sniff markers to get high, and wants to know what "getting high" feels like, and if sniffing markers can hurt you. It's scary this stuff is starting so early for him... he's only in 6th grade. :( Anyways, his mom and I want to make sure he understands just how dangerous and stupid sniffing markers can be. I know it can cause your heart to stop, but I haven't found any real good articles on the net googling this subject. I'd really LOVE to find a couple good ones to read to him, perferably with real life examples of the dangers associated with this. Does anyone know any good links out there on the dangers of sniffing markers? - Houdini
  3. Ok, I think I have a decent solution. Thought I'd post it for anyone else who's looking to keep a laptop and desktop synchronized. Windows XP offline files is a decent solution, but it has a few problems, such as you can't use fast user switching, and it doesn't automatically include newly created subfolders in synchronization. The other issue is that I can't have my email client open on both computers and have them auto-sync correctly (you can only have one running at a time). So, here's my solution: I'm going to use Google Mail for email, so no synchronization required for that. For everything else, I'm going to use a free synchronization program called AllwaySync. - Houdini
  4. Thanks for the replies, guys. I'll take a look at XP's off-line feature and see if it'll do what I want. Any other comments/recommendations are welcome! - Houdini
  5. I just bought my very first laptop (WOHOO!) and I want to be prepared when it arrives. What I'd like is to keep my email and bookmarks synchronized between my laptop and desktop. I don't want to just point them to the same network folder, as I will travel with my laptop and the network may not be accessible. I'm thinking a good folder synchronization program would do the trick. Something that would be installed on both PCs, to monitor each others folders. When files in one of the folders change, it should update those same files on the other PC. This way everything is handled behind the scenes, with no interaction required on my part. Is there good software out there that does this? Any personal recommendations? How do you guys handle keeping things synchronized between PCs? - Houdini
  6. Quote:Original post by Promit Actually, you'd be wrong. VC7 is the more compliant compiler. Promit, is it really more compliant? I know both GCC and VC++ 7.1 are both very compliant compilers I never realized VC++ 7.1 was slightly more compliant. I do know I had to fix a bunch of compile issues when porting my code from VC++ 7.1 to GCC, and all of those compile errors were non-compliant errors that VC++ shouldn't have let compile that GCC caught. But I guess if I had written everything in GCC and tried compiling in VC++ 7.1 it would have been the other way around. Got any links supporting VC++ 7.1 being more standard compliant? - Houdini
  7. Do you like your job?

    I can't stand my current job. I previously had a job I *loved* as I was the sole programmer for startup company, and I got to work completely from home. However, that company ran short on money so in my new job I work from home one week and at the office the next. The problem is, my company is located in Florida while I live in Ohio. So I fly to FL every other week to work 14-16 hour days being paid salary (ie, no overtime pay). I constantly miss my wife and kids, and the programming is all in VB which I can't stand. At this point I'm just waiting it out, hoping for my previous company to get enough funds to hire me back... - Houdini
  8. Thanks guys, I'll give each a look! - Houdini
  9. Does anyone know of a multi-platform IDE where you can use multiple compilers compiling against the same project file? For my current project we have two developers, myself coding/compiling on a Windows box using VC++ 7.1 and the other on a Linux box using g++ 3.4.2. I downloaded a trial version SlickEdit for both Windows and Linux, and created a single GNU C/C++ project file. This allows us to use the same IDE and project file, which is great, but I am unable to modify it so we can use multiple compilers against the same project file. I'm hesitant to switch to makefiles, because if I understand correctly we'd need to manually add any new files we added to the project to that makefile, and we'd probably need different makefiles per compiler anyways. Does anyone know of any solutions to this problem? - Houdini
  10. Just wanted to let you know that thanks to the preprocessor output I was able to track down the issue. Turns out you can't pass commas to macros (duh!). Ie, doing this: #define MYMACRO(x) x MYMACRO(,) Makes the preprocessor think your passing two empty parameters, not a single comma parameter. Of course, VC++ 7.1 allows this when it shouldn't, otherwise I would have caught this long ago. For anyone who may be interested in passing commas in macros, I was able to do this with a small fix. Here's the working code: #include <iostream> using namespace std; // Commonly used pre-defined characters to seperate repeating code. // For exmple, the comma seperate is used when repeating function // arguments (ie, Function(A1 a1, A2 a2, A3 a3, ...) ) // // The empty seperator is used when there doesn't need to be any // characters between repeating code, such as repeating functions. #define MACRO_EMPTY_SEPERATOR_DISPLAY #define MACRO_COMMA_SEPERATOR_DISPLAY , // Commonly used pre-defined code to be repeated. For example, the // MACRO_FUNCTION_PARAMETER is used to repeat function parameters // (ie, Function(A1 a1, A2 a2, A3 a3, ...) ). #define MACRO_TEMPLATE_PARAMETER(num) typename A##num #define MACRO_FUNCTION_PARAMETER(num) A##num a##num #define MACRO_FUNCTION_ARGUMENT(num) a##num // The perform the actual repetition. Each macro will continuously // call the preceding macro until the MACRO_REPEAT_0 is called, at // which point each macro will write the seperator followed by the // macro, passing the repitition number. #define MACRO_REPEAT_0(begin_seperator, seperator, macro) #define MACRO_REPEAT_1(begin_seperator, seperator, macro) begin_seperator##_DISPLAY macro(0) #define MACRO_REPEAT_2(begin_seperator, seperator, macro) MACRO_REPEAT_1(begin_seperator, seperator, macro) seperator##_DISPLAY macro(1) #define MACRO_REPEAT_3(begin_seperator, seperator, macro) MACRO_REPEAT_2(begin_seperator, seperator, macro) seperator##_DISPLAY macro(2) #define MACRO_REPEAT_4(begin_seperator, seperator, macro) MACRO_REPEAT_3(begin_seperator, seperator, macro) seperator##_DISPLAY macro(3) // User called macros that uses the above macros to perform the // desired work. MACRO_LIST is primarily used to list template // or function arguments, where each argument is seperated by // a comma (ie, Function(A1 a1, A2 a2, A3 a3, ...) ). // MACRO_LIST_APPEND does the same as MACRO_LIST, except it is // used to append arguments onto an existing argument, thus all // code is preceded by a comma (ie, Function(int x, A1 a1, A2 a2, ...) ). // MACRO_REPEAT simply repeats code not using any seperating // characters. #define MACRO_LIST(num, macro) MACRO_REPEAT_##num(MACRO_EMPTY_SEPERATOR, MACRO_COMMA_SEPERATOR, macro) #define MACRO_LIST_APPEND(num, macro) MACRO_REPEAT_##num(MACRO_COMMA_SEPERATOR, MACRO_COMMA_SEPERATOR, macro) #define MACRO_REPEAT(num, macro) MACRO_REPEAT_##num(MACRO_EMPTY_SEPERATOR, MACRO_EMPTY_SEPERATOR, macro) // This creates a multiple CreateObject function using function // template overloading. Basically, it allows a user to specify // the object the function will create as well as any number // of parameters to pass to that objects constructor. When the // macros unroll this function, it will look similar to this: // // template<typename ClassType> // ClassType *CreateObject() // { // return new ClassType(); // } // // template<typename ClassType, typename A1>; // ClassType *CreateObject(A1 a1) // { // return new ClassType(a1); // } // // template<typename ClassType, typename A1, typename A2> // ClassType *CreateObject(A1 a1, A2 a2) // { // return new ClassType(a1, a2); // } // ... // // Note the macro below uses the \ to span multiple lines, // but the source tags are removing them. To compile you MUST // re-add these \ tags #define CREATEOBJECT(num) template<typename ClassType MACRO_LIST_APPEND(num, MACRO_TEMPLATE_PARAMETER)> ClassType *CreateObject(MACRO_LIST(num, MACRO_FUNCTION_PARAMETER)) { return new ClassType( MACRO_LIST(num, MACRO_FUNCTION_ARGUMENT) ); } // Generate 3 instances of this function, one which takes no // constructor params, one which takes one param, and the // last which takes two constructor parameters. MACRO_REPEAT(3, CREATEOBJECT) int main (int argc, char *argv[]) { // Create an integer, passing 42 as a constructor parameter int *ptr = CreateObject<int>(42); return(0); } - Houdini
  11. Excellent, I did not realize g++ did this. Thanks, you guys, I'll check that out and hopefully find my issue. - Houdin
  12. Quote:Original post by doynax Have you tried studying the preprocessor's output (i.e. by invoking cpp separately)? doynax, I'm not sure I follow. Are you saying it's possible to capture the source code generated by the preprocessor? I'm not sure what you mean by "invoking cpp seperately". - Houdini
  13. I've been dabbling in using the preprocessor to auto-generate code. What I have written compiles and works great on VC++ 7.1, but when I tried compiling under g++ 3.4.2 I'm getting compile errors. After spending a full day getting nowhere, I'm hoping one of you g++ and preprocessor gurus may be able to help me out. ;) I've whittled the code down to a bare minimum to reproduce the error and added a bunch of comments to hopefully explain how it works. Anyone familiar with the Boost Preprocessor should be able to understand what the code is doing. But let me briefly explain: I wrote, for the sake of an example, a function which create will create any object the user specifies, like so: template<typename ClassType> ClassType *CreateObject() { return new ClassType; } I'd like to use function template overloading to allow the user to pass any number of constructor parameters to this function, like so: template<typename ClassType, typename A1> ClassType *CreateObject(A1 a1) { return new ClassType(a1); } template<typename ClassType, typename A1, typename A2> ClassType *CreateObject(A1 a1, A2 a2) { return new ClassType(a1, a2); } Etc. However, instead of rewriting this function 16 times to allow 16 parameters I am instead using the preprocessor do that work. Below is a full source code example which does just that, and compiles fine in VC++ 7.1. #include <iostream> using namespace std; // Commonly used pre-defined characters to seperate repeating code. // For exmple, the comma seperate is used when repeating function // arguments (ie, Function(A1 a1, A2 a2, A3 a3, ...) ) // // The empty seperator is used when there doesn't need to be any // characters between repeating code, such as repeating functions. #define MACRO_EMPTY_SEPERATOR #define MACRO_COMMA_SEPERATOR , // Commonly used pre-defined code to be repeated. For example, the // MACRO_FUNCTION_PARAMETER is used to repeat function parameters // (ie, Function(A1 a1, A2 a2, A3 a3, ...) ). #define MACRO_TEMPLATE_PARAMETER(num) typename A##num #define MACRO_FUNCTION_PARAMETER(num) A##num a##num #define MACRO_FUNCTION_ARGUMENT(num) a##num // The perform the actual repetition. Each macro will continuously // call the preceding macro until the MACRO_REPEAT_0 is called, at // which point each macro will write the seperator followed by the // macro, passing the repitition number. #define MACRO_REPEAT_0(begin_seperator, seperator, macro) #define MACRO_REPEAT_1(begin_seperator, seperator, macro) begin_seperator macro(0) #define MACRO_REPEAT_2(begin_seperator, seperator, macro) MACRO_REPEAT_1(begin_seperator, seperator, macro) seperator macro(1) #define MACRO_REPEAT_3(begin_seperator, seperator, macro) MACRO_REPEAT_2(begin_seperator, seperator, macro) seperator macro(2) #define MACRO_REPEAT_4(begin_seperator, seperator, macro) MACRO_REPEAT_3(begin_seperator, seperator, macro) seperator macro(3) // User called macros that uses the above macros to perform the // desired work. MACRO_LIST is primarily used to list template // or function arguments, where each argument is seperated by // a comma (ie, Function(A1 a1, A2 a2, A3 a3, ...) ). // MACRO_LIST_APPEND does the same as MACRO_LIST, except it is // used to append arguments onto an existing argument, thus all // code is preceded by a comma (ie, Function(int x, A1 a1, A2 a2, ...) ). // MACRO_REPEAT simply repeats code not using any seperating // characters. #define MACRO_LIST(num, macro) MACRO_REPEAT_##num(MACRO_EMPTY_SEPERATOR, MACRO_COMMA_SEPERATOR, macro) #define MACRO_LIST_APPEND(num, macro) MACRO_REPEAT_##num(MACRO_COMMA_SEPERATOR, MACRO_COMMA_SEPERATOR, macro) #define MACRO_REPEAT(num, macro) MACRO_REPEAT_##num(MACRO_EMPTY_SEPERATOR, MACRO_EMPTY_SEPERATOR, macro) // This creates a multiple CreateObject function using function // template overloading. Basically, it allows a user to specify // the object the function will create as well as any number // of parameters to pass to that objects constructor. When the // macros unroll this function, it will look similar to this: // // template<typename ClassType> // ClassType *CreateObject() // { // return new ClassType(); // } // // template<typename ClassType, typename A1>; // ClassType *CreateObject(A1 a1) // { // return new ClassType(a1); // } // // template<typename ClassType, typename A1, typename A2> // ClassType *CreateObject(A1 a1, A2 a2) // { // return new ClassType(a1, a2); // } // ... // // Note the macro below uses the \ to span multiple lines, // but the source tags are removing them. #define CREATEOBJECT(num) template<typename ClassType MACRO_LIST_APPEND(num, MACRO_TEMPLATE_PARAMETER)> ClassType *CreateObject(MACRO_LIST(num, MACRO_FUNCTION_PARAMETER)) { return new ClassType( MACRO_LIST(num, MACRO_FUNCTION_ARGUMENT) ); } // Generate 3 instances of this function, one which takes no // constructor params, one which takes one param, and the // last which takes two constructor parameters. MACRO_REPEAT(3, CREATEOBJECT) int main (int argc, char *argv[]) { // Create an integer, passing 42 as a constructor parameter int *ptr = CreateObject<int>(42); cout << *ptr << endl; return(0); } As mentioned, this compiled perfectly in VC++ 7.1, but I get the following errors in g++ 3.4.2: ../test4.cpp:75:1: macro "MACRO_REPEAT_1" passed 5 arguments, but takes just 3 ../test4.cpp:75: error: expected nested-name-specifier before "ClassType" ../test4.cpp:75: error: ISO C++ forbids declaration of `ClassType' with no type ../test4.cpp:75: error: expected `>' before "MACRO_REPEAT_1" ../test4.cpp:75: error: expected constructor, destructor, or type conversion before '*' token ../test4.cpp:75: error: expected `;' before '*' token ../test4.cpp:75:1: macro "MACRO_REPEAT_1" passed 4 arguments, but takes just 3 ../test4.cpp:75:1: macro "MACRO_REPEAT_1" passed 4 arguments, but takes just 3 ../test4.cpp: In function `int main(int, char**)': ../test4.cpp:83: error: no matching function for call to `CreateObject(int, int)' *** Errors occurred during this build *** Now, the strange thing is that if I change the MACRO_REPEAT(3, CREATEOBJECT) line and to create just TWO CreateObject functions (ie, MACRO_REPEAT(2, CREATEOBJECT)) then the code compiles and runs fine. But repeating code more than twice to allow 2 or more constructor parameters to be passed causes the errors displayed above. Anyone have any ideas what the issue could be??? - Houdini [Edited by - Houdini on September 13, 2005 9:41:26 AM]
  14. ClanLib surface problem!

    Does anybody have any ideas? After doing some more testing, if I put in a CL_Display::clear(); line just before the second surface gets constructed but after the first surface is destructed, then it displays fine. But if I put the clear line just after the second surface gets constructed, but before it draws, it still displays in the 350x110 size. I'm new to 3D programming so I'm really hoping there is something simple I'm not doing that can fix this issue. As I said, I tried the ClanLib IRC channel and their user mailing list and nobody has responded, so I'm hoping the GameDev community can help me out. - Houdini
  15. I am currently trying out ClanLib, and seem to have a strange issue I'm hoping someone can help me with (since they haven't responded on the ClanLib mailing list). In my game I have two surfaces being drawn; one which draws for a few seconds and then is destroyed, and the other which isn't drawn until after the first surface has been destroyed. The problem is that even though the second surface is 1024x768, it's being drawn with a size of 350x110, which happens to be the size of the first surface. The actual image is correct and so is the placement on screen, but the size is always 350x110. I can duplicate the problem in the sample code below: CL_SetupCore::init(); CL_SetupDisplay::init(); CL_SetupGL::init(); CL_DisplayWindow window("test", 1024, 768); // Connect the Window close event CL_Slot slot_quit = window.sig_window_close().connect(this, &ExampleBlendFunctions::on_window_close); // Run until someone presses escape while (!quit) { CL_Display::clear(); { // logo1 has a size of 350x110 and will be destroyed outside this scope CL_Surface logo1("clanliblogo.png"); logo1.draw(0, 0, window.get_gc()); } // logo2 for some reason always displays in 350x110 if logo1 has been destroyed, otherwise it will display fine if logo1 still exists. CL_Surface logo2("mainscreen.png"); logo2.draw(0, 0, window.get_gc()); CL_Display::flip(); CL_System::keep_alive(); } CL_SetupGL::deinit(); CL_SetupDisplay::deinit(); CL_SetupCore::deinit(); Does anyone have any clue why my second surface won't display correctly if the first surface is destroyed? If the first surface is NOT destroyed after the draw() call, or I just comment out the draw() function, then the second surface displays correctly. I'm very confused... - Houdini