Jump to content
  • Advertisement

blubberbernd

Member
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

100 Neutral

About blubberbernd

  • Rank
    Member
  1. blubberbernd

    Implicit conversion

    I already have convert functions that work. But I wanted to register these conveert functions as implicit conversion behavior so that AS calls them implicitly (automatically). It would be really nice if that works somehow.
  2. blubberbernd

    Implicit conversion

    Hi, I'm currently playing around with regsitering behaviour for implicit conversions. I tested this with the string to int conversion. But I need some clarification here, because I encountered a problem: I regsitered the behavior like it is in the manual (except that I used the implicit version), I'm using the stdstring addon: r = engine->RegisterObjectBehaviour("string", asBEHAVE_IMPLICIT_VALUE_CAST, "int f() const", asFUNCTION(stringToInt), asCALL_CDECL_OBJLAST); Then I registered a C++ testFunction(const int&) : void testFunction(const int&) My test code in the script file looks like this: string testStr = "4"; //this works testFunction(1 * testStr) //this DON'T work testFunction(testStr) In the second case I get the error that there's no testFunction(string), candiates are testFunction(int&). Does the conversion only work in operations? How do I manage it to also have it working in function calls (pass a string to a function that needs an int, for example)?
  3. blubberbernd

    Problems with Addref and Release methods

    Thanks for the infos, but how do I work around this? I think simply using another calling convention and leaving everything else as it was, won't work? I have a lot of classes, so implementing a addref and release function for each of them would be very annoying. ;) A lot of classes don't need them anyways, so a single dummy would be very good.
  4. Hi, I have a problem with the Addref and Release methods. I have a class that should not be created or destroyed from the script, so I skip the factory function and only register an empty function for addref and release: r = engine->RegisterObjectType("MyClass", 0, asOBJ_REF); assert(r >= 0); r = engine->RegisterObjectBehaviour("MyClass", asBEHAVE_ADDREF, "void f()", asFUNCTION(dummyFunc), asCALL_CDECL); assert(r >= 0); r = engine->RegisterObjectBehaviour("MyClass", asBEHAVE_RELEASE, "void f()", asFUNCTION(dummyFunc), asCALL_CDECL); assert( r >= 0 ); //with dummyFunc being: void dummyFunc() { } The value of r after RegisterObjectBehavior() is always "-7" and AS reports "invalid configuration". What/where is the problem here and how to solve it?
  5. blubberbernd

    const overloading, registering with asMETHOD

    Ah, Ok. Thank you very much.
  6. Hi, I currently have this problem. I have a class with two identical member functions, one const, the other not const: class MyClass { public: obj* getObj() {return o;} const obj* getObj() const {return o;} } If I now want to register MyClass::getObj() to AS with engine->RegisterObjectMethod(), I can't to this because I get the error "Invalid overload of asMETHOD(...)". Obviously this is because I have two functions with the same name and parameters. How do I solve this problem?
  7. blubberbernd

    Pointers, references, values between c++ and AngelScript

    Thank you very much, this already helps a lot. Just so that i got it right: In Angelscript code I can NEVER have a reference "type&" like in c++? I can only have "type &in" (or &out, &inout)? And AngelScript code does NOT support the asterisk pointer (*), only the "@", which works basically the same? And a new question: When should I use SetArgObject and when SetArgAddress? Do they HAVE TO match the function declaration in the AS code (like Object for value types and Address for &in or @type)?
  8. Hi, I already managed to pass a string and a string array to AS from my c++ code, but I'm not sure if I did it right (I think I passed as value from c++ to as). //AS code void bar(string str, string[] strArr){} //in C++ code std::string str = "foo"; CScriptArray* strArr; //initilaise array here SetArgObject(0, str); SetArgObject(1, strArr) Can someone give me a short overview of all the pointer, reference, @, *, &, in, out, inout operators and a short example when to use which in both languages when passing variables between the two (C++ and AS)? And how to pass variables if I only can acces them through a const reference (const string&)? I am especially interested in string and array types. I find this whole passing of variables confusing.
  9. blubberbernd

    Integrating AngelScript into existing codebase (cmake)

    This will exclude MingW rom all other Win32 compilers, yes. But the /MP flag seems to be exclusive to Visual Studio. Maybe you should simply ask for "if(MSVC)".
  10. blubberbernd

    Integrating AngelScript into existing codebase (cmake)

    I just found out what caused my problems. In the AngelScript cmake file at the bottom there is: if(WIN32) set_target_properties(Angelscript PROPERTIES COMPILE_FLAGS "/MP") endif(WIN32) I had to out-comment this. This was producing the error that "c:\MingW\msys\1.0\MP" is not found.
  11. blubberbernd

    Integrating AngelScript into existing codebase (cmake)

    Thanks. I think I'll do it also this way. It seems to work now (but I was not not changing the cmake file of AS, in the first place). Not sure what I missed on the first try, maybe the include directories (seems I only added the .h files to the list, but not the folder).
  12. blubberbernd

    Newbie needs some advices

    Nice, thanks for your great help.
  13. blubberbernd

    Integrating AngelScript into existing codebase (cmake)

    Thanks for your replies. Problem is that with a lib: every developer needs his own lib, depending on compiler and operating system (MingW, VC, Linux). This would make it hard to get unexpirenced new developers for the project because setting up the build envoironment is harder this way. Setting up all source files in my cmake file was how I did it in first instance, but for some reason the AngelScript add ons did not work properly (I did set up the add on source files in my cmake file, too). The add ons were not found by the compiler. That's why I wanted to try the automatic lib building by calling your cmake file (after that I ended up posting here ). Personally I'm using MingW, but when I included the angelscript cmake file I got the strange error that "c:\MingW\msys\1.0\MP" could not be found when budling as_atomic.cpp. I'm not sure what this means, because this does obviously not exist, but I have no idea where I would have to look for the position in the cmake files (or whereever) to fix it (after all, I only called the angelscript cmake file from my cmake file, nothing more, nothing less).
  14. Hi, what are the best ways of integrating AngelScript when using cmake? I tried this: 1) copy whole AS sdk into my project folder 2) in my own cmakelists I added "add_subdirectory(angelscript/angelscript/projects/cmake)" 3) further in my cmake file I added "target_link_libraries(Angelscript)" But this doesn't work, it stops building on the first AS cpp file. Can someone give me an advice on how is the best way to integratte AS into an existing cmake project?
  15. blubberbernd

    Newbie needs some advices

    Hi, I have a new question. If I register a SIngleton type, how do I get access to the singleton-instance from AngelScript? Do I have to register the getInstance() method from my C++ class and call it from AngelScript code?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!