Jump to content

  • Log In with Google      Sign In   
  • Create Account

Muzzy A

Member Since 25 May 2007
Offline Last Active Today, 03:33 PM

Posts I've Made

In Topic: C++ Function Pointer Casting

11 September 2014 - 02:38 PM

Thanks for the help guys, it works exactly the way I wanted.


In Topic: C++ Function Pointer Casting

10 September 2014 - 03:36 PM

OK I'll look those up, thanks for the help


In Topic: C++ Function Pointer Casting

10 September 2014 - 03:27 PM

I know this, let me clarify

class A
{
public:
    void foo();
};
 

// Define a simple function pointer
typedef void (*Func)();

 
int main()
{
    A obj;

    // This is what I want to work
    Func func = obj.foo;
 
    func();
}
 

I want to be able to have access to that object inside the function that gets called from the function pointer so that I don't have to have some sort of global reference to 'obj'

 

 

you can't typecast it to a 'Func', it gives an error as well.

 

The whole reason is I have a button class which has a function pointer that it calls when the button is clicked, and the function that gets passed to it is a 'void (*Func)()'.  I want to be able to have access to the class that holds that button without having to create some static/global variable to get access to it.


In Topic: DirectX 11 Drawing multiple instances of the same object

04 April 2014 - 12:39 PM

Well this Tutorial explains everything I need. Thanks for the post.


In Topic: A question about where to store the Camera!

31 March 2014 - 11:56 AM

I like the idea of using the camera like a scene object, I never would have thought to use it like that. It makes everything go together smoothly and there isn't code in random places for the camera. To me a hierarchy beats having references all over the place any day. I guess it's all about preferences.


PARTNERS