Hijacking draw and drawgl functions

For developers using the Construct 2 Javascript SDK

Post » Mon Sep 12, 2016 6:48 am

Here is an experiment of using the browser object to run javascript in a few interesting ways. You can do anything you can do with a plugin with this, but it's all done in C2 which makes it quicker to test changes.

First off it's used to load js files and interact with C2's runtime. This isn't minifier friendly, but it should be possible to wrap it in a plugin so it will be.

The main thing done in this capx is to change the rendering of one instance of an object in an interesting way.
With webgl off: some arbitrary canvas drawing is done.
With webgl on: a 3d cube is drawn inline with the rest of the other objects (as opposed to only on the very top or bottom).

https://www.dropbox.com/s/oge5lmjwm5wpp ... .capx?dl=1
/examples35/js_test2.capx

Maybe this will be interesting/useful to someone.
Last edited by R0J0hound on Fri May 26, 2017 6:46 pm, edited 1 time in total.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Mon Sep 12, 2016 10:57 am

That's friggin cool! I can see a lot of use for this, if there's a way to load objects.

I've been trying out Q3D but it was not really what I was looking for. As I wanted a combination of 3D objects and 2D objects in my game, that could be inline.

My main goal was to make the characters in 3D in a 2D isometric enviroment. Kind of like.
Little Big Adventure. https://youtu.be/wyXX8ET95IU?t=376
Commandos 2. https://youtu.be/4pnfCbuOslo?t=713

Would that be possible using this approach?
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 991
Reputation: 12,654

Post » Mon Sep 12, 2016 5:13 pm

You could, but the trouble here is it switches between how C2's renderer is set up and a different set up that has a z-buffer. In a nutshell each object will be 3d but come out as 2d sprites that you'd have to sort in the same way as you currently do in C2.

But yeah it should be possible. You'll probably want to utilize some 3d library to simplify the amount of rendering code.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Fri May 26, 2017 4:01 pm

R0J0hound wrote:Here is an experiment of using the browser object to run javascript in a few interesting ways. You can do anything you can do with a plugin with this, but it's all done in C2 which makes it quicker to test changes.

First off it's used to load js files and interact with C2's runtime. This isn't minifier friendly, but it should be possible to wrap it in a plugin so it will be.

The main thing done in this capx is to change the rendering of one instance of an object in an interesting way.
With webgl off: some arbitrary canvas drawing is done.
With webgl on: a 3d cube is drawn inline with the rest of the other objects (as opposed to only on the very top or bottom).


https://dl.dropboxusercontent.com/u/542 ... test2.capx

Maybe this will be interesting/useful to someone.

can you update link please? i wanna look at it : (
B
9
S
2
G
1
Posts: 17
Reputation: 1,059

Post » Fri May 26, 2017 6:47 pm

@Follder22
link updated
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest