gibbon's Forum Posts

  • Answer...

    globalThis.variable...
  • Hi, I am trying to add elements to an array using a script in an event loop.

    The array variable is declared also via another script in the "layout start" event.

    But the console reports when inside the loop that the variable isn't declared?

    So how can I access variables declared in one event (via script) from other events (via script)?

    Andy

  • Whilst I cant offer any help, I too am trying to do the same.

    Is there anyone with some knowledge on importing and using scripts that could help?

    Its frustrating that it was once quite easy to do but now not.

    It doesn't matter how I import the script, at runtime I just see this in the console:

    Uncaught TypeError: Cannot set properties of undefined (setting 'L')

    If I set the leaflet.js to import for events, I get an error at runtime and the following in the console...

    	scriptsInEvents.js:5 Uncaught TypeError: Cannot set properties of undefined (setting 'L')
     at scriptsInEvents.js:5:145
     at scriptsInEvents.js:5:150
    domSide.js:24 [C3 runtime] Failed to load JavaScript code used in events. Check all your JavaScript code has valid syntax.
    _InitDOM @ domSide.js:24
    
  • Hi, I was just wondering if anyone knows whether the Usermedia object works with the latest iOS build.

    For a while there was an existing issue with WebViewKit & Apple, however I have read from the bug report of the said issue that it was resolved? If I do a remote preview I can only get it to work using Chrome...

    bugs.webkit.org/show_bug.cgi

    Obviously I can just try it but before I do I was wondering if anyone has had any success?

    Given that the current documentation doesn't warn of any issue with iOS I would like to think it does?

    Andy

  • I think , I might have found a solution, weather it is the best way im not sure.

    Width in this case is always the width of the canvas, so easy to just use the canvas width.

  • I have a sprite (which I use as a photo, so rectangular), I then take a snapshot of the canvas and simply want to capture only the rectangle sprite (the photo).

    So, most obvious choice when using "take snapshot canvas" is to set the X & Y position to the sprite X & Y, and same with the width & height (sprite width & height).

    However this only works if full screen scaling is set to off, if it is anything else such as Scale Inner/Outer, then the captured snapshot is never the right place or size?

    I have also tried using "photo.height*PlatformInfo.DevicePixelRatio" but still no luck, this just changes things but still not correct.

    When I run in Debug mode and look at the sprite in question, the width, height and scale doesn't change regardless of the canvas scale??

    So how do I get these values to get a correct snapshot??

    Andy

  • Thanks Ashley, what about width and height?

    Edit: I have also done as above and it still ends up taking a snapshot about 20 pixels higher than sprite????

  • I was aware no one else seemed to be shouting about so I new it must have been something I was doing.

    Turns out, for some reason when opening a project (even new ones) it would result in selecting the cordovalib project to build as apposed to the main project.

    Very odd.

    Sorted now though.

    Andy

  • Ashley Can you please elaborate a little on this.

    In the Canvas snapshot X and Y I using the following.

    Sprite2.X*PlatformInfo.DevicePixelRatio

    Sprite2.Y*PlatformInfo.DevicePixelRatio

    How do I incorporate the LayerToCanvasX/Y method?

    Thanks

  • I am having serious issues...

    Why is it new builds wont build, saying the errors I mentioned such as missing info.plist?

    BUT sometimes a new server build works?

    SOMETIMES it builds but doesn't run or install on the device?

    What is going on??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fresh build from the server managed to build but now the UserMedia is no longer working again...

    Feel like giving up on this at times!

    ERROR: Rejection from 'runtime' handler 'cordova-fetch-local-file': [object Object]

    2020-11-16 18:00:27.632553+0000 camapp[19460:3769028]

    WARN: Error requesting camera: TypeError: undefined is not an object (evaluating 'navigator["mediaDevices"]["getUserMedia"]')

  • Hi, has any one successfully managed to compile a iOS Xcode project using latest Xcode and iOS14?

    I am having a numorus amount of errors, on first opening its showing

    config.xml and www folder in red, as well as Resources folder in Red.

    When I try to build it fails, saying info.plist is missing (which I cannot find in the project folder at all) as well as cordova.h?

    Anyone any idea?

  • The snapshot area is given in device pixels (i.e. pixels on the resulting image if you took a full screenshot). That is different to layout co-ordinates (i.e. object positions) which depends on scrolling, scaling, the viewport size, etc.

    The system LayerToCanvasX/Y expressions can convert a layout position to canvas CSS co-ordinates, and then if you multiply that by PlatformInfo.DevicePixelRatio, that should give you the device co-ordinates.

    Thanks Ashley, Will give this a try!

    Andy

  • Mikal

    Thanks for the help but unfortunately that still does not give me the correct size?

    I really do not know what you have to do in order to specifically set the size of the snapshot (despite there being settings for it)

    I feel like I have exhausted all possible attempts

  • Will give it a try, thanks