[PLUGIN] Canvas

Post your completed addons to share with the community

Post » Wed Oct 15, 2014 7:42 pm

@R0J0hound

thnx for the reply man, i think i have no choice then
but i have found a solution so is not that bad, thnx again
B
48
S
5
G
6
Posts: 210
Reputation: 6,247

Post » Fri Oct 17, 2014 6:00 pm

@R0J0hound

I need to extend your Canvas plugin with a new behaviour
Do you know how to access "this.canvas and this.ctx" from a behaviour?

EDIT:
Got it, from rex's canvas_ext
var self = this;
var inst = self.inst;
var canvas = inst.canvas;
var ctx = inst.ctx;
B
7
S
1
Posts: 26
Reputation: 530

Post » Fri Nov 14, 2014 6:29 pm

Love the plugin.

When drawing a circle, it seems rgb and hex work, but not hsl.

Is it supposed to work? I use chrome to preview.

Thanks
B
16
S
2
Posts: 80
Reputation: 1,457

Post » Fri Nov 14, 2014 6:38 pm

From the first post or any of the parameters that set color.
"hsl(120, 50%, 50%)"

The first value is from 0 to 360. The other values are from 0 to 100, be sure the % symbol is there. All values have to be whole numbers, so no decimals.
B
79
S
24
G
54
Posts: 4,743
Reputation: 40,749

Post » Fri Nov 14, 2014 6:46 pm

Oh yes, I missed the % symbol. Big thanks!
B
16
S
2
Posts: 80
Reputation: 1,457

Post » Fri Nov 28, 2014 7:38 am

Hey R0J0hound,

I've modified your plugin to my liking, and was curious if you'd like to include it in your code going forward? Here's what I did:

In EditTime.js
Code: Select all
AddNumberParam("X pos", "The X pos to paste from.");
AddNumberParam("Y pos", "The Y pos to paste from.");
AddNumberParam("Width", "The Width of Section to paste from.");
AddNumberParam("Height", "The Height of Section to paste from.");
AddAction(23, 0, "Paste Section", "Canvas", "Paste Section Coordinate x: {0}, y: {1}, width: {2}, height: {3} onto canvas", "Pastes Section into the canvas.", "PasteSection");


In Runtime.js
Code: Select all
   acts.PasteSection = function (x,y,w,h)
   {
      var ctx=this.ctx;
      var buffer = document.getElementById('c2canvas');
      var bufferCtx = buffer.getContext("2d");
      var bufferTMP = document.createElement('canvas');      
      var bufferTMPCtx = bufferTMP.getContext("2d");
      var myImageData = bufferCtx.getImageData(x, y, w, h);
      bufferTMP.width = w;
      bufferTMP.height = h;
      bufferTMPCtx.putImageData(myImageData, 0, 0);
      ctx.drawImage(bufferTMP,0,0,this.width,this.height);
      this.runtime.redraw = true;
        this.update_tex = true;
   };


I'm sure there may be a better way of doing this... but this is the method that worked for me. The good thing about this code is, it takes ALL of the layers at the exact point you specify in the C2Canvas. Great for lots of uses, including mine. Works great too. If you're not interested in including it, that's ok... I'll just modify yours every time I need to download it. :)

Hopefully other people are able to get a use out of this too.
B
46
S
15
G
3
Posts: 199
Reputation: 4,584

Post » Mon Dec 01, 2014 10:42 pm

This has been the closest I have gotten to a good way to implement splitscreen. Either this or your other plugin Paster. Are you planning on making it so you can set the resolution of the canvas?

Like in other (almost every other really) development program, you can set your cameras and how big they are on your screen and then set how the view looks.
B
7
S
1
Posts: 18
Reputation: 405

Post » Mon Dec 01, 2014 11:52 pm

@indiegrimes
You can already. There's a set resolution action to change it. The default resolution is the same as the canvas' size.
B
79
S
24
G
54
Posts: 4,743
Reputation: 40,749

Post » Tue Dec 02, 2014 1:29 am

Sorry, but could you show where that is?

EDIT: I can use resize canvas but this is a low resolution pixel game and its causing a lot of blurring
B
7
S
1
Posts: 18
Reputation: 405

Post » Tue Dec 02, 2014 4:28 am

@indiegrimes that is what I meant. You can select point sampling in the project settings to eliminate the blurring.
B
79
S
24
G
54
Posts: 4,743
Reputation: 40,749

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests