[Plugin] spriteURL

Post your completed addons to share with the community

Post » Wed Apr 18, 2012 9:57 am

This plugin loads an image inside a sprite at runtime (lazy loading).
To use this, add the object to the layout, position it (currently I only support top-left hotspot), then add the action to load from url.
If you need to lazy load an image outside construct2 this is the plugin you need (read the FAQ).
This plugin works with every browser either mobile or desktop. If you find a bug/error please report it so I can update the plugin.

Get the
latest version (v0.5b)

CHANGELOG:

v0.5b (April, 18th 2012)
-First public release

---------------------------------------------------------------FAQS

Considering that we already have one behaviour and one plugin that does exactly the same thing as mine why should you use this one?
Short answer: it's the only one that works.

Technical answer:
Loading an image at runtime it's an hack, basically something that c2 wasn't made to do, both the existing plugins do not treat it as such because they were tested only on new browsers. Both of those plugins DO NOT work on android and iOS (on 4.x they make c2 crash, on 5.x they are unpredictable) and have glitches when ran inside webGL.
Why you may ask? With the help of @Ashley in this thread and with days of testing I found out that on older (or slower) browsers, the image at one point as a value that could be less than zero, null/false and even unpredictable values, this means that when ctx.drawImage gets called all sort of error happens, errors that can result in a complete crash or glitches. My plugin checks if the image has been REALLY loaded and ONLY then it draws it, as far as my knowledge goes this can be done only in a plugin because you have complete control of the drawing part.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 20, 2012 10:15 pm

Good to know this is of zero interest.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 20, 2012 10:28 pm

Actually, this is the first time seeing it.
So... nice job.

Might be nice with some options for frames.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Fri Apr 20, 2012 11:07 pm

[QUOTE=0plus1] Good to know this is of zero interest. [/QUOTE]

Hell noo...

I didn't notice this thread, but you bumped this that it makes me interesing.


Then, awesome plug in! I wonder if Scirra is working a module loading per layout for complex games which contain more than 50 mb
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sat Apr 21, 2012 3:23 am

Indeed I had missed this thread too.
Sounds nice enough. And added to the general list of custom plugins and behaviors.

Good job.Kyatric2012-04-21 03:23:32
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Mon Apr 23, 2012 5:27 am

For some reason, I don't see "load from URL" in the actions for a sprite (I put it in the "plugin" folder)
]
B
12
S
3
G
4
Posts: 55
Reputation: 3,186

Post » Mon Apr 23, 2012 7:41 am

Really nice plugin, nice work!

But the plugin doesn't work when WebGL is activated.
I get a "inst.drawGL is not a function" error message.
B
38
S
13
G
9
Posts: 151
Reputation: 8,427

Post » Mon Apr 23, 2012 9:10 am

@CodeMasterMike
To be honest I haven't tested it in WebGL, hang on, I'm in the process of using it for a Chrome Web Store App and I'll need WebGL. As soon as I fix it I'll let you guys know.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Mon Apr 23, 2012 9:45 am

No stress, I just thought I would mention it to you, seeing its still a work in progress

Im interested in to know what your goal is with this plugin?
As it is now, you cant do much with it.

What I would like to see, is that it would work just like a sprite, with all sprite functions. And added that you can choose to load a URL sprite into a animation frame.

Keep up the good work!
B
38
S
13
G
9
Posts: 151
Reputation: 8,427

Post » Mon Apr 23, 2012 10:15 am

@CodeMasterMike my goal is to succesfully do what you stated, the problem is that injectng another image in a sprite is an hack and as a mobile developer my current goal is to assure 100% compatibility across all browsers (mobile and desktop), which means taking baby steps until all quirks are worked out. If you are developing only for desktop there is this excellent Plugin.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 6 guests