Closed vrabete closed 8 years ago
Hey, vrabate.
Thanks for reporting this. Unfortunately, I have very little time to devote to this project these days, but if you provide me with a very simple reproduction case, with code, I will look at it very soon.
The less time have to spend on setting up the reproduction case, the faster I will solve the issue. :)
Exact same issue for me as well. Thanks @vrabate for the report.
I will make a fast project, and post it asap, any help would be greatly appreciated, thank you.
I have managed to solve my situation by not using Shape anymore, but still, the issue with shape remains (I've even had the weirdest error when doing a drawRect on graphics in the GraphicsAPI example) and, due to lack of time I didn't put up a project anymore, but, if you want to test it, just put a rectangle in the graphics of a Shape on the Starling stage and lock/unlock the computer... you should not be able to see the rect anymore.
My other weird error looks like this, and the two parameters that reach that place implement IShader, because they come from drawRect and all those other calls in Starling stack: TypeError: Error #1034: Type Coercion failed: cannot convert to starling.display.shaders.IShader. at starling.display.materials::StandardMaterial()[C:\Work\StarlingTests\src\starling\display\materials\StandardMaterial.as:0] at starling.display.graphics::Graphic()[C:\Work\StarlingTests\src\starling\display\graphics\Graphic.as:81] at starling.display.graphics::Plane()[C:\Work\StarlingTests\src\starling\display\graphics\Plane.as:0] at starling.display::Graphics/drawRect()[C:\Work\StarlingTests\src\starling\display\Graphics.as:442] at GraphicsAPIExample/runExample()[C:\Work\StarlingTests\src\GraphicsAPIExample.as:32] at GraphicsAPIExample/onAdded()[C:\Work\StarlingTests\src\GraphicsAPIExample.as:27]
I tried to reproduce the problem with Shapes not showing after Context Lost, but I am unable to do so. The Context Lost scenario works fine in this super simple scenario:
Main.as:
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import starling.core.Starling;
[SWF( width="800", height="600", backgroundColor="#F4F4F4", frameRate="60" )]
public class Main extends Sprite
{
private var starling :Starling;
public function Main()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
Starling.handleLostContext = true;
starling = new Starling( SpriteTest, stage, null, null, "auto", "auto" );
starling.antiAliasing = 0;
starling.showStats = true;
starling.start();
}
}
}
SpriteTest.as:
package { import starling.display.Shape; import starling.display.Sprite; import starling.events.EnterFrameEvent; import starling.events.Event;
public class SpriteTest extends Sprite
{
private var item:Shape;
public function SpriteTest():void
{
super();
addEventListener(EnterFrameEvent.ENTER_FRAME, onUpdate);
}
private function onUpdate(event:Event):void
{
if (item == null)
{
item = new Shape();
item.x = item.y = 100;
item.graphics.lineStyle(1, 0xff0000);
item.graphics.drawCircle(100, 100, 100);
addChild(item);
}
}
}
}
If you are still experiencing problems with Context Lost, through - for example - locking the screen, can you please help me with a reproduction step? The code above works fine.
As for the crash in GraphicsAPIExample.as, I can't reproduce this bug either. I am using the latest Starling Extension Graphics source tree off GitHub and the latest Starling source tree off GitHub.
The example runs flawlessly, and if I make sure Context is lost, it still works.
I have submitted a fix for Lost Context. It seems to work better now, but I have only a limited set of test cases.
Does anyone have a clue why Shape does not show anymore after I lose context because I lock out? No new Shape is showing anymore at all and I don't find onGraphicLostContext in Graphics extension (not even in the latest update - I've found somewhere around here that that solved the issue back in June)