Sign in to follow this  

[ Tools ] Tool Creation

This topic is 3660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! ive been putting together a little image generation library, wich i would like to make an editor for. ( writing image chains with no visual feedback dont do it for me ;) ) in the past ive used c++/opengl to create tools. these tools look great, but the development time is a bit to long (for a good tool) so, i where wondering. would i be able to get the same "visual" and dynamic feel with something simpler? Recommendations?

Share this post


Link to post
Share on other sites
im gonna take a closer look at wxWidgets ( since its free for commercial use )
if it wont suit my needs ill probably go with C# even if its not my "native" language ( i dont think the migration time from c++ to C# is long though )


btw, how is rescue squad comming along OrangyTang?
Your journal has become pretty silent as of late ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by LackOfGrace
btw, how is rescue squad comming along OrangyTang?
Your journal has become pretty silent as of late ;)

Temporarily halted while I deal with all sorts of Real LifeTM issues. Hopefully more progress sometime in the new year...

Share this post


Link to post
Share on other sites
Quote:
Original post by LackOfGrace
im gonna take a closer look at wxWidgets ( since its free for commercial use )
if it wont suit my needs ill probably go with C# even if its not my "native" language ( i dont think the migration time from c++ to C# is long though )


I'd vote for C#, you can keep your code in C++ though, and just write binding funcs for the C++ code into C#. It's quicker than using wx and C++ imho.

Share this post


Link to post
Share on other sites
Quote:
Original post by RobTheBloke
I'd vote for C#, you can keep your code in C++ though, and just write binding funcs for the C++ code into C#. It's quicker than using wx and C++ imho.


Could you point me in the direction of some documentation on this? I've had thoughts about learning C# and was hoping to still be able to use my C++ codebase. I did a very quick google, but nothing useful turned up.

Share this post


Link to post
Share on other sites
basically you have 2 options, either write a wrapper in strict C code, then you can use the interop services to wrap unmaneged dll's :

http://msdn.microsoft.com/msdnmag/issues/02/08/CQA/

You can also use swig to autogenerate bindings. I must admit i has problems with swig, so ended up just using the managed C++ route (which is not portable....)

alternatively, use Managed C++ to wrap the code. For example, given the original code like this:


namespace Original
{
class SomeOtherType
{
public:
};

class BlahToBind
{
public:

void someFunc();

int someVar;

// this returns some member var (which is a user type)
SomeOtherType* getSomeOtherType();
};
}



Write a managed C++ wrapper such as:



namespace Wrapper
{

public ref class SomeOtherType
{
public:
SomeOtherType() {
owner = true;
mOriginal = new Original::SomeOtherType();
}
SomeOtherType(Original::SomeOtherType* ptr) {
mOriginal = ptr;
owner = false;
}
~SomeOtherType() {
if(owner) delete mOriginal;
}

//
// other stuff to go here to mimic the
// member funcs and vars of Original::SomeOtherType
//

private:
Original::SomeOtherType* mOriginal;
bool owner;
};
public ref class BlahToBind
{
public:

BlahToBind()
{
mOriginal = new Original::BlahToBind;
}
~BlahToBind()
{
delete mOriginal;
}

void someFunc()
{
mOriginal->someFunc();
}

// declare property
property int someVar
{
int get(){ return mOriginal->someVar; }
void set(int v) { mOriginal->someVar = v; }
}
SomeOtherType^ getSomeOtherType()
{
return gcnew SomeOtherType( mOriginal->getSomeOtherType() );
}

private:
Original::BlahToBind* mOriginal;
};
}



There are probably better ways to do this, but it works for me and isn't that bad. One thing i would say, is that it is worth exposing as much data you can as properties, since then you can attach a PropertyGrid control onto an object and get an attribute editor basically for free.

Share this post


Link to post
Share on other sites

This topic is 3660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this