codder88

Member
  • Content count

    32
  • Joined

  • Last visited

Community Reputation

103 Neutral

About codder88

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1.   Hello everyone,   I have that triangle and I want to move top vertex, how can I do that?
  2. c++ class help

    ok... thank's guys :D
  3. c++ class help

    #pragma once #include "main.h" class CClass2; class CClass1 { public: CClass1(const CClass2 &Class2) { this->SetVar(Class2.GetVar()); } void SetVar(int val) { var=val; } int GetVar() const { return var; } private: int var; }; class CClass2 { public: CClass2(const CClass1 &Class1) { var = 5; } int GetVar() const { return var; } private: int var; }; i'm using visual c++ 2010 express and the compiler give me error C2027 and C2228
  4. c++ class help

    Quote:Original post by _fastcall Use a forward declaration for B or move the definition for class B above class A. See also: Organizing Code Files in C and C++. in fact i want to use the class1 in class2 and class2 in class1
  5. c++ class help

    if i add "class class2;" at the top of the file the compiler give me again the errors
  6. c++ class help

    i have 2 classes class class1 { public: class1(const class2 &c){} }; class class2 { public: class2(){} }; the compiler give me error because the class2 isn't defined, how to fix that?
  7. Quote:Original post by Aardvajk For variables, std::map<std::string,std::string> and convert the values to ints, floats whatever when you need the values. Functions is a bit more tricky. Most conventional scripting languages I am aware of have a standard signature, e.g.: class script_params { /* ... */ }; typedef int(*script_func)(script_params&); And it is the responsibility of the native code to decode parameters from the supplied information. Best way I guess would be to look at how something like Lua (or the more recent and pretty interesting IonScript I spotted on here the other day) handles it. That should give some inspiration. Thanks :)
  8. I want to make a cvar system with registering functions, variables... I want to know some ideas...
  9. c++ class question

    Quote:Original post by iMalc Quote:Original post by codder88 It's still crashing...And it's still not caused by the code you're posting. There are all sorts of way the rest of your code can cause an error to show up here. Your best options are to make a cut down minimal compile example program that produces the problem. Remove everything that isn't necessary to produce the problem. Or you could learn to use your debugger and examine the call stack. What compiler/IDE? One way or another, we need more info! I'm using VC++... I compiled in debug mode and there is an assertion failed Expression: _CrtIsValidHeapPointer(pUserData) The char* what i pass to ctest is valid... How to fix it?
  10. c++ class question

    Quote:Original post by Wooh Does it even compile? You call your class ctest but your constructor and destructor is called CString. operator+= needs a return type. After fixing these errors it compiles and works fine. *** Source Snippet Removed *** It's still crashing...
  11. c++ class question

    Quote:Original post by SimonForsman Quote:Original post by codder88 i have *** Source Snippet Removed *** When i close the application it crash :S maybe i need to release something? hmm, i'm not sure about this but, what are the operator precedance for += and dereferencing ? (you might be adding the char pointer to this before you dereference it which would be a likely cause for a crash) try: (*this)+=str; and see if that helps. it crash when i close the application :(
  12. c++ class question

    i have class ctest { public: CString(const char *str) { *this+=str; // crash :S } ~CString() { } operator+=(const char*str) { for(size_t i=0; i<strlen(str); i++) { vec.push_back(str[i]); } } private: vector<char>vec; }; void print(ctest str) { //... } When i close the application it crash :S maybe i need to release something?
  13. C++ vector question

    Quote:Original post by ViperG you need to also check for these values... dm.dmDisplayFrequency dm.dmBitsPerPel dm.dmDefaultSource Jyk was correct about different modes/pits/refresh rate per screen res. I have also seen other intel chipsets reverse the x and y values because its an inverted supported resolution (no joke). so instead of getting 1024x768 you get 768x1024. I logged in a txt and works :D i have intel chipset
  14. C++ vector question

    Quote:Original post by void main The simplest solution is IMHO to create a little helper function, which will tell you if some DEVMODE with the same resolution is already contained in your vector. Something like this: *** Source Snippet Removed *** ... then just use this in your loop for testing if newly enumerated DEVMODE is worth push_backing :-) Ok i try :D
  15. C++ vector question

    Quote:Original post by _fastcall Use std::set or std::map instead of a std::vector. You may need to create a simple structure with only the information you're looking for. (See DEVMODE structure.) Or you can keep track of the current display settings: *** Source Snippet Removed *** Isn't ordered this is another piece of the log VIDEOCARD INFO: 640 x 480 VIDEOCARD INFO: 640 x 480 VIDEOCARD INFO: 640 x 480 VIDEOCARD INFO: 640 x 480 VIDEOCARD INFO: 720 x 480 VIDEOCARD INFO: 800 x 600 VIDEOCARD INFO: 800 x 600 VIDEOCARD INFO: 800 x 600 VIDEOCARD INFO: 800 x 600 VIDEOCARD INFO: 1024 x 768 VIDEOCARD INFO: 1024 x 768 VIDEOCARD INFO: 1024 x 768 VIDEOCARD INFO: 1024 x 768 .... VIDEOCARD INFO: 640 x 480 // here you can see the 640 x 480 is repeated... VIDEOCARD INFO: 640 x 480 VIDEOCARD INFO: 640 x 480 VIDEOCARD INFO: 640 x 480