coatesjetset's Recent Forum Activity

  • I am refining my SpriteButton plugin because of some odd behaviors I've seen in our environment. NDA prevents me from saying what our environment is specifically, so I will just say that it is a browser embedded in an application, written by another party so I cannot modify the browser's behavior.

    In SpriteButton, I copied code from DragDrop that registers for all three input types (msPointer, mouse and touch) -- the issue is that if multiple types are registered, multiple events are sent to the plugin. For specific example:

    On the Android version of the environment, if I tap a button, I get a touch down, touch up, mouse down, mouse up, in that order. Because the mouse up is the last event, and a true mouse up needs to leave the button in a "hover" state, (as the pointer is still over the button) a tap results in a button showing its hover image after the click. Ideally I would only get touch events for a touch and not mouse events, but since I cannot modify the environment, I can only modify what events I register for.

    On Windows, IE10+ supports msPointer, so I can just not register for mouse or touch if msPointer is supported, and thus only get one callback issued for one event. iOS doesn't support mouse, so I can just not register for mouse on that platform. Android theoretically supports both.

    I can detect Runtime.isAndroid and Runtime.isiOS and not register for mouse events in both cases, but it feels a bit brittle to me. Does anyone know of a more robust way to filter out a mouse event that is a duplicate of a touch event? Obviously I could test the position values, but that isn't 100% reliable. Ideally I'd find something bulletproof.

    In the meantime, I will probably just not register for mouse events on iOS and Android, but it does men my plugin could act funny on a system that supports both touch & mouse but not msPointer (such as Chrome under Windows 8, perhaps? I haven't tested, and IE supports msPointer)

  • I did testing on Windows with Chrome and IE, and on iOS, Windows RT, and Android. I believe the current version works on all platforms. If you find any bugs, definitely let me know! While I'm not working on this plugin as my primary focus right now, I use it in the work I am doing, so I should be pretty quick to fix any bugs.

  • As an addendum, in the plugin I'm working on now, I have the following set up:

    instanceProto.setError= function(errorString)
    {
        this.status.lastError = errorString;
        this.runtime.trigger(cr.plugins_.MyPlugin.prototype.cnds.OnError, this);
    }
    
    instanceProto.fire = function(eventName)
    {
        if (cr.plugins_.MyPlugin.prototype.cnds[eventName])
        {
            this.runtime.trigger(cr.plugins_.MyPlugin.prototype.cnds[eventName], this);
        }
        else
        {
            this.setError("Condition " + eventName + " not found");
        }
    };
    

    then I can set up an event that OnError prints out the error message. Of course, it may be better in other situations to log to the javascript console instead of (or in addition to) the above, but I found it handy, so I thought I'd pass on the tip.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This has been super useful for me.

    instanceProto.fire = function(eventName)
    {
        this.runtime.trigger(cr.plugins_.MyPlugin.prototype.cnds[eventName], this);
    };

    This function allows for easy firing of conditions. For example, if you have a condition

    Cnds.prototype.OnError = function()
    {
        return true;
    };

    You can, from basically anywhere, fire that condition with a call to

    this.fire("OnError");

    or, from within an anonymous embedded method

    var self = this;
    somelibrary.AsynchronousCall().then(
        function(result)
        {
            self.status = JSON.stringify(result);
            self.fire("OnSuccess");
        },
        function(result)
        {
            self.status = JSON.stringify(result);
            self.fire("OnError");
        });

    The <font face="Courier New, Courier, mono">fire</font> method could be made safer with a check that the event exists, but the above is the simplest form. I would suggest adding this to the template files for plugins and behaviors. What do others think?

  • This is Chris, a programmer with Jet Set Games. We are primarily an iOS/Unity development house, but we do some contract work for various other major studios/publishers, and we are evaluating Construct2 for such a project. (Can't give details because of NDA, unfortunately)

    So far, Construct2 is meeting all of our requirements, and I am hopeful we will be getting some commercial licenses soon.

  • Version 1.3 uploaded. Bugs fixed, so it works as I intended on both Chrome and IE, on touch and on mouse systems. Removed the OnHover event as it was not firing exactly as I wanted, will add it (and other events) back in later once my coworkers and I get a design spec finalized.

    Added some installation instructions to top post.

  • Hm. It must be because I had manually placed the files in program files first, then dragged the .c2addon assuming it would replace the ones in program files, which it didn't. It also looks like C2 prioritizes the ones in program files over the ones in appdata. So it looks like the problem is in mixing the install methods. I do still think that a notification along the lines of "you have the same plugin installed in both program files and appdata, the one in program files will be used" would be a good addition.

    In any case, I now know how to ensure that I'm running the latest version of my plugin, so thanks for the help.

  • The most recent version does not exhibit intended behavior on IE10 (I don't think IE is doing anything wrong, it's just that I was assuming that a mouse move event would have correct data in the "info.which" field, which is not true, and IE behaves differently with what garbage data is in the field versus Chrome)

    So, doing a partial rewrite now that I grok what's going on more.

  • For me, if I don't run Construct2 as administrator, it will not properly copy the .c2addon contents (since it cannot write to the C:\Program Files\ directory) but no error message shows up.

    Suggestions would be

    1) don't put up the "restart construct2 to see your new addons" window if the addons weren't actually installed, and instead give an error. I would consider this high priority.

    2) Have construct2 request elevated permissions to allow c2addons to be installed even if the program itself was not run as administrator

    3) Ideally, use a directory in the user's space that can hold 3rd party plugins & behaviors so Administrator access is not needed. This also allows people to quickly back up & transfer their 3rd party plugins from computer to computer. It also makes plugin development easier since the text editor could work on the in-place file without needing admin access, and source control could work off the same directory.

  • dropbox.com/s/njwr5uy9buhngrv/C2Zipper.zip

    I made a quick C# utility to take a plugin/behavior directory and make a .c2addon file. It's a command-line tool that works with drag & drop (including multiple directories)

    i.e. if your plugin is in

    c:\myplugin

    it makes c:\myplugin.c2addon

    The tool verifies that info.xml and the "files" subdirectory exists before attempting to do the zip.

    Notes:

    This requires .NET 4.5 assemblies, so you need Windows 8, Visual Studio 2012, or some other way to get .NET 4.5

    I have included the source, not a binary, since Visual Studio Express 2012 for desktop is free, and no one should run random .exe files from the net. :)

  • Version 1.2 uploaded with working sample. Will change top message.

  • anata: I found your bug as well. Not sure why I'm not getting that error here when I load the plugin. Anyway it will be fixed soon.

coatesjetset's avatar

coatesjetset

Member since 30 Aug, 2013

None one is following coatesjetset yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies