Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Aug 2007
Offline Last Active May 27 2013 03:17 PM

Posts I've Made

In Topic: passing class/function to asMETHOD

28 April 2013 - 10:27 AM

Ah, right.  Thanks saejox, AngelBinder was a big help.


Well, I guess it's pretty clear by now that I have no idea what I'm doing:




So, after more researching, and asking around a little on stackoverflow, I have something compiling.


However, now I seem to be unable to create a asSMethodPtr object...


I define the following struct:



struct S
    int f()
        return 5;

    int x = 10;


and use it thusly:





asSMethodPtr pt = asSMethodPtr<sizeof( void (S::*)() )>::Convert( AS_METHOD_AMBIGUITY_CAST( int (S::*)()) (&S::f) );


However, I get the following compile time exception:



template_tests.cpp: In function ‘int main()’:
template_tests.cpp:64:15: error: missing template arguments before ‘pt’
template_tests.cpp:64:15: error: expected ‘;’ before ‘pt’
Any idea why in the world I get that?
If I try to add an integer in there as a template, like so:


asSMethodPtr<16> pt = asSMethodPtr<sizeof( void (S::*)() )>::Convert( AS_METHOD_AMBIGUITY_CAST( int (S::*)()) (&S::f) );


I get this error instead:
template_tests.cpp: In function ‘int main()’:
template_tests.cpp:66:120: error: conversion from ‘asSFuncPtr’ to non-scalar type ‘asSMethodPtr<16>’ requested

In Topic: passing class/function to asMETHOD

26 April 2013 - 01:28 PM

Ok, I'm trying to actually figure out how to do it...How do you create a asSMethodPtr struct object without the Macro...?


I've got this:


auto methodPtr = asSMethodPtr<sizeof(void (classObject.pointer)())>::Convert((void (classObject.pointer)())(classObject.addRefMethodPointer));


(Where 'classObject' is a struct of type 'Class' (defined in my first post))


But it doesn't compile, I get:



 src/common/as_wrapper/AngelScript.cpp:98:66: error: void value not ignored as it ought to besrc/common/as_wrapper/AngelScript.cpp:98:68: error: template argument 1 is invalid
src/common/as_wrapper/AngelScript.cpp:98:107: error: void value not ignored as it ought to be


Any ideas?  I've afraid this asSMethodPtr struct is pushing the limits of my C++ abilities...

In Topic: passing class/function to asMETHOD

25 April 2013 - 06:55 PM

Ahh that makes sense.  I'll give wrapping asSFuncPtr a go.


Thanks SiCrane.

In Topic: using angelscript compile error

13 November 2012 - 05:57 PM

Apparently, that method is now deprecated.

Found out from Chris on stackoverflow (here: http://stackoverflow.com/questions/13370774/using-angelscript-compile-error)

According to the source (angelscript.h line 664), GetFunctionIdByDecl is deprecated, so you need to #define AS_DEPRECATED to use it

In Topic: [Solved] Crazy Quaternion

15 June 2011 - 06:44 PM

Oh man, this problem was a nightmare haha. But I finally got it fixed!


1) Because this is a Camera, I had to use the Conjugate of the rotation Quaternion to fill the matrix that OpenGL used to change the Model View Matrix.

2) Some of the math I was doing when getting the change in mouse coordinates was producing HUGE float values, so I had to cast some of the results to (float) and it was then producing the correct values.

Can't say this was a fun problem, but I learned a crap load.

Thanks a lot to anyone who looked over the problem!