picking

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

Post » Fri Jun 12, 2009 1:12 am

Picking. I've been looking through some picking operations, and wow...there's alot going on there. I get some of it, but in the interest of distilling, as a simple example

let's say I have
*CRunObject Hello; //already pointing to a single instance of an object

what command(s) would pick this object and allow it to continue down to the next subevent or actions?

what if I had *CRunObject Hello, and *CRunObject Goodbye, how can I make both of those picked

do you have to explicitly tell it to suppress elses, to run subevents, and run actions every time? or does it depend on the complexity of the particular picking operation?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Fri Jun 12, 2009 8:31 am

You might be better off asking what can't be used to pick, as there are tons of ways. You can use just about anything the object can do to pick it, you can use the system to pick it, you can use other objects to pick it, the list goes on and on. As to your other question, you can add multiple conditions to the event, or pair them up using pv's, families, containers, object pairer, again just about anything they can have in common.

On sub events Im not quite sure what you mean, any thing that is picked is automatically used in actions, unless nothing is picked, and then the parent is used.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Jun 12, 2009 8:41 am

He's talking about how to handle picking from the C++ side of things, in regards to making a plugin ;)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Jun 12, 2009 8:57 am

Oh, disregard that, I suck at reading forum headers.
>Looks for new glasses
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Jun 12, 2009 12:35 pm

The correct pointer syntax is CRunObject*, by the way :P

First, any action or condition that does any picking at all must specify the SOL_MODIFIER flag (otherwise behavior is undefined, and the app will probably crash). If the pointer is called 'object' and the pointer to its type (CRunObjType*) is called 'type', then the following does:

[code:34maw5si]pRuntime->SelectAll(type);
// 'type' is now put in to 'all selected' mode, as if it hasn't yet been referenced by any conditions - eg. in an Always event[/code:34maw5si]

[code:34maw5si]pRuntime->SelectAll(type);
pRuntime->Select(object);
// 'object' is now the only object picked[/code:34maw5si]

[code:34maw5si]pRuntime->Select(object);
// Without a preceeding 'selectall', this adds 'object' to the currently picked objects
// It *must not* already be picked - if you're not sure call IsSelected() first to check[/code:34maw5si]

[code:34maw5si]pRuntime->SelectAll(type);
pRuntime->Select(object1);
pRuntime->Select(object2);
pRuntime->Select(object3);
// The three objects 'object1', 'object2' and 'object3' are now selected
// Note you cannot call Select() on the same object twice - if you think
// any of those pointers might point to the same object, you must check it
// isn't selected first via pRuntime->IsSelected(object)[/code:34maw5si]

The code for running actions, subevents, suppressing elses etc is purely for looping conditions like for-each and repeat - they're a bit more complicated, but for other conditions, you don't need to worry about those functions at all.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sat Jun 13, 2009 12:21 am

thanks ashley

you've been a great help as usual
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 1 guest