0 Favourites

Minimal code to draw nothing

  • Hello,

    What's the minimal code to put in the runtime drawing function of a plugin:

    instanceProto.draw = function(ctx, glmode){}

    and in instanceProto.drawGL = function(glw){}

    To draw nothing.

    If I put nothing, I get error messages.

    Does any of you guys have an example ?

    I would really appreciate it. Thanks.

  • I have several plugins that do this:

    	// only called if a layout object - draw to a canvas 2D context
    	instanceProto.draw = function(ctx)
    	{
    	};
    	
    	// only called if a layout object in WebGL mode - draw to the WebGL context
    	// 'glw' is not a WebGL context, it's a wrapper - you can find its methods in GLWrap.js in the install
    	// directory or just copy what other plugins do.
    	instanceProto.drawGL = function (glw)
    	{
    	};[/code:12o2ww9j]
  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Thanks for the quick reply.

    That's what I did, but I got a message error:

  • What does your GetPluginSettings section from the edittime.js look like. Sounds like a mismatch.

  • It looks like this:

    function GetPluginSettings()
    {
    	return {
    		"name":			"ListModel",
    		"id":			"aekiro_listmodel",
    		"version":		"1.0",            
    		"description":	"Stores and manipulate an Array of simple non-nested hashtables (aka dictionnaries).To be used as a model for a listview for example.",
    		"author":		"AekiroStudio",
    		"help url":		"https://later.com",
    		"category":		"Data & Storage",
    		"type":			"world",
    		"rotatable":	false,
    		"flags":		0
    	};
    };
    [/code:23dmakva]
    I also tried the flag:  pf_position_aces | pf_size_aces | pf_angle_aces | pf_appearance_aces | pf_zorder_aces | pf_effects 
    but I still get the same error.
    
    Btw, I know that ("type" : object) is more appropriate for a data structure, but I went with  ("type" : world) because I need to be able to create, in the editor, multiple instances (by copy/paste) of a same type. you can't do that with a plugin of type "object" like an array, you can only clone it, which create a new type. I hope I was clear.
  • I don't know. There's not enough here to go on. Can you post the plugin? One of my data-only plugins is here:

    Edit: I think you do need 'object'

    Edit: you can call Create, to create new instances of 'object'

  • Yeah, I think I just need to go with the "object" type and let the user know that they need to programmatically create the instance.

    Thanks so much for your time.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
78 10,774
Josek5494's avatar
Josek5494
Unread hot topic
61 4,808
Reuben's avatar
Reuben
Unread hot topic
28 2,116
michael's avatar
michael