possible to...how to...

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

Post » Tue Jun 16, 2009 11:59 pm

1. change sprite distort map info through another plugin? given a pointer* to a sprite

2. get top left corner of sprite through another method besides object->info.x-object->info.hotspotx, object->info.y-object->info.hotspoty?

3.get imagepoint location?

4.set the current animation frame?



5. and what is hotspotangle?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Jun 17, 2009 12:28 am

1. Eh, it'd be difficult, you'd need changes to the Sprite object really. What do you want to do?

2. There is no "left corner". Do you mean the top left corner or bottom left corner? Of the sprite box or the bounding box? What's wrong with the code you posted anyway?

3. See the following functions in VRuntime:
[code:2d3trdro] virtual bool GetImagePoint(CRunObject* obj, int number, POINTF& pt) = 0;
virtual bool GetImagePoint(CRunObject* obj, const char* pointName, POINTF& pt) = 0;[/code:2d3trdro]

4. object->info.curAnim->curFrame or similar. Check curAnim is not NULL. You might need a call to UpdateAnimation or similar after it. Check the Sprite object source to see how it does it.

5. An unused leftover from a failed idea.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Jun 17, 2009 12:59 am

thanks ash

[quote="Ashley":28kdgq8t]1. Eh, it'd be difficult, you'd need changes to the Sprite object really. What do you want to do?[/quote:28kdgq8t]

two things, first for the bitmapped text object (sprite lettering), I was hoping to let the user setup up a text box, so the text display would be limited to a rotatable box,
like a traditional text box, if the text was longer than fit into the box it could be partially obscured or not visible, and then they could scroll text across to bring it into and out of visibility like a scrolling marquee

the second was for my personal plugin project, I wanted to be able to setup complex distort map functions that constantly update sprites. I suppose it's possible to do with events, by having the plugin have distortion specific expressions, and then "always" - set distortion to those expressions, but that's a little messier than the way the rest of the plugin works,

and as far as the first usage, (with the scrolling text box), that plugin is for widespread use, and I'd prefer not to make the user have to take extra steps to make the plugin do what it's supposed to.
[quote:28kdgq8t]
2. There is no "left corner". Do you mean the top left corner or bottom left corner?[/quote:28kdgq8t]
yeah, I meant to type top left
[quote:28kdgq8t]
Of the sprite box or the bounding box? [/quote:28kdgq8t]
I don't think I know the difference
[quote:28kdgq8t]
What's wrong with the code you posted anyway?[/quote:28kdgq8t]
nothing, but if there was a function that returned the topleft corner, I would rather do that
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Jun 17, 2009 9:14 am

[quote="lucid":218g0939]nothing, but if there was a function that returned the topleft corner, I would rather do that[/quote:218g0939]

You could make an inline function or macro if you're really into tidy code :P.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Wed Jun 17, 2009 1:19 pm

I don't see why you need distort maps for a scrolling marquee... it sounds like you can do that just moving the objects around.

The top left of the object box is like the top left corner of the selection box in the layout editor - it rotates with the object. The bounding box never rotates, it's an unrotated box big enough to fit in the whole rotated object. Still, if the current calculation works absolutely fine... why are you asking? :P

Also I'd hope you use a function instead of a macro for that calculation!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Jun 17, 2009 2:50 pm

i was going to use the distort map for letters that were partially cut off by the edge of the text box as they scrolled into and out of view

thanks for the info about the bounding boxes.

i was asking just to make sure im following sdk conventions:),

and as far as macros, after explaining how they worked, david told me about your and general c++ dev community's (but especially your :)) opinion on macros. i don't intend to use them, intellisense seems to work much better with functions and constants than macros anyway
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