more questions (all will go here)

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Tue May 26, 2009 4:08 pm

I'm going to flood the board if I keep starting new threads for all my questions, so they'll all go here

1.
in the template SDK resources, there's IDR_ACTIONS and IDR_CONDITIONS, and IDR_EXPRESSIONS menus.
can I do something with these? like make a different kind of interface to the plugin, instead of the standard list thing that comes when you use add param and such?

2.
I can take a parameter for object types, and get [code:31q7idtd]CRunObjType* pObjType= params[0].GetObjectParam(pRuntime);
[/code:31q7idtd] which I can use to [code:31q7idtd]pRuntime->CreateObject(pObjType, pLayer->number, pLayout);[/code:31q7idtd]

what if I already know the object type beforehand? is there a way to like
[code:31q7idtd]pRuntime->CreateObject(specific_object_type, 1, pLayout)[/code:31q7idtd]

or

[code:31q7idtd]CRunObjType* pObjType = my_object_type[/code:31q7idtd]?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue May 26, 2009 4:21 pm

1. They're deprecated and no longer used. Ignore them.

2. I'm not sure I understand the question. If you use pRuntime->CreateObject(specific_object_type, 1, pLayout), and specific_object_type is a valid CRunObjType*, that will work.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue May 26, 2009 4:28 pm

[quote="Ashley":191fsds6]
2. I'm not sure I understand the question. If you use pRuntime->CreateObject(specific_object_type, 1, pLayout), and specific_object_type is a valid CRunObjType*, that will work.[/quote:191fsds6]

well for instance if I wanted to create a sprite
how would I get the CRunObjType for sprite or my_object_type, when they aren't chosen as parameters

just no matter what it's supposed to create a sprite,
or to put it another way
how do I get a CRunObjType* for sprite without using GetObjectParam?

or my_object_type
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue May 26, 2009 5:36 pm

There's the 'pType' member of CRunObject which is a CRunObjType* pointer to the object's type. Have a browse through the SDK headers some time, you'll probably find a lot of useful stuff in there.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue May 26, 2009 5:52 pm

Thanks again Ash
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed May 27, 2009 8:10 am

Ok,
I have some pointer variables that I declared in main.h in the ExtObject definition
but I realized at runtime all instances of my plugin shared these pointer variables
but not the other variables

for instance:
[code:3qbfajmq]class ExtObject : public CRunObject
{
public:
//...all the sdk code ...//

CRunObject* pMyPointer;
int MyInt;

};[/code:3qbfajmq]

at runtime MyInt stays unique to each instance of the plugin
pMyPointer is like one variable shared by all instances of the plugin

I say instances, but to clarify, this happens whether I have several instances of MyPlugin
or if I have cloned MyPlugin several times so I have separate objects MyPlugin, MyPlugin2, etc...

is there a way to avoid this? I want each instance to have a unique pointer.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed May 27, 2009 11:07 am

A pointer points to an area of memory. If the object the pointer is for is the same, the memory address is going to be the same.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Wed May 27, 2009 1:22 pm

[quote="lucid":2s3jci3u]at runtime MyInt stays unique to each instance of the plugin
pMyPointer is like one variable shared by all instances of the plugin[/quote:2s3jci3u]
No it's not! If you wanted it shared, you'd declare it static, but since it's not, a copy of the pointer is held by every object instance. They could all point to the same object if your code does that - but each instance is holding a separate pointer which can be uniquely changed.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed May 27, 2009 10:11 pm

simple one
how do I make an object destroy itself

I can't find a aDestroy() action in the sprite cvs I'm assuming you need to
#define COMMONACE_COUNT_DESTROY


either way, do I have to explicitly destroy them
with[code:2kpiwxmt]
ExtObject::~ExtObject()[/code:2kpiwxmt]

or is there a something in the sdk to do it?


Edit:
would it be pRuntime->DestroyObject(MyObjectPointer)?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed May 27, 2009 10:29 pm

Yes.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Next

Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests