Edittime questions

For developers using the Construct 2 Javascript SDK

Post » Sun May 25, 2014 7:19 pm

Theres a few things i'd like to know about the edittime.

1. is there a way to find the current scroll/view position in edittime

2. how do you refer to the position/angle of an instance (im averaging the corners of the bounding quad atm, but there must be some direct way to refer to the position/angle of an object to lets say draw stuff in the editor without needing to find it from the quad)

3. Is there any file i can look at to find information on available edittime functions/properties? or is it all hard-coded into the exe, the sdk documentation is pretty lacking.
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

Post » Sun May 25, 2014 10:15 pm

Using this:
Code: Select all
function dir(object)
{
    methods = [];
    for (z in object) {
        methods.push(z);
    }
    return methods.join(', ');
}

I was able to see all the members of cr, instance and renderer.

cr.
plugins_, behaviors, logexport, seal, freeze, is_undefined, is_number, is_string, isPOT, nextHighestPowerOfTwo, abs, max, min, PI, round, floor, ceil, vector2, segments_intersect, rect, quad, RGB, GetRValue, GetGValue, GetBValue, shallowCopy, arrayRemove, shallowAssignArray, appendArray, arrayFindRemove, clamp, to_radians, to_degrees, clamp_angle_degrees, clamp_angle, to_clamped_degrees, to_clamped_radians, angleTo, angleDiff, angleRotate, angleClockwise, rotatePtAround, distanceTo, xor, lerp, unlerp, anglelerp, qarp, cubic, cosp, hasAnyOwnProperty, wipe, performance_now, ObjectSet, KahanAdder, regexp_escape, CollisionPoly, SparseGrid, GridCell, effectToCompositeOp, setGLBlend, round6dp, equals_nocase, Property, Parameter, Condition, Action, Expression, FontInfo, ParseFontString

instance.
SetPosition, SetSize, GetSize, GetLayoutSize, SetHotspot, GetBoundingRect, GetBoundingQuad, EditTexture, GetTexture, GetOpacity, GetAngle, DrawTilemap

renderer.
Quad, Line, Line3D, Fill, Outline, CreateFont, ReleaseFont, LoadTexture, SetTexture, ReleaseTexture, EnableTiling, SupportsFullSmoothEdges


A.
1. Not that I could find. Possibly there may be another global namespace, but since there isn't any plugins that use such a thing it probably doesn't exist.

2. Looks like there's a setPosition() but no getPosition(), so I guess averaging the corners it the only way currently. There is a getAngle() though.

3. See list above, other than that the following js files are used at edittime:
common_prelude.js
edittime_prelude.js

Other than that you possibly could open C2 in a hex editor and find a list of js names, but I don't imagine you'd find many more.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Mon May 26, 2014 2:57 am

awesome thanks!
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest