StarlingGraphics / Starling-Extension-Graphics

flash.display.Graphics style extension for the Starling Flash GPU rendering framework
https://github.com/StarlingGraphics/Starling-Extension-Graphics/wiki
MIT License
285 stars 88 forks source link

Lost context on android #28

Closed jonnysparkplugs closed 11 years ago

jonnysparkplugs commented 11 years ago

Seems to lose context on Android (tested on galaxy nexus and nexus 7 both running 4.2.1). When the screen rotates the "context" is lost. The drawing/line disappears every time

jonathanrpace commented 11 years ago

Does all Starling content disappear, or just stuff drawn with the graphics API?

jonnysparkplugs commented 11 years ago

The starling & feathers content stays on screen. I do however have "Starling.handleLostContext = true;" set in the main application/entry point. Its just the drawing (i'm creating circles) that disappear

I added "Starling.current.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated);" to starling.display.graphics.DisplayObject and saw that it was losing its context.

I had a quick go at fixing it myself but then felt pretty sleepy so went to bed. Although i'll probably have chance to have another look tonight as well.

So if I fix it or find out it was something I was doing wrong i'll update the ticket.

PS i was looking at http://wiki.starling-framework.org/manual/custom_display_objects

jonathanrpace commented 11 years ago

Thanks for the link - none of the graphics API classes currently handle a lost context themselves - shouldn't be too hard to add. I'll take a look shortly.

jonathanrpace commented 11 years ago

Ok that should be fixed. https://github.com/unwrong/Starling-Extension-Graphics/commit/76f4829a9bf662a527b35a6f71e57c49fbd6627b

I've not got an android device - Hitting CTRL+ALT+DELETE on Windows 7 causes the context to get lost, so I used that to test the fix. Could you let me know if it solves it on android too?

And thanks for reporting this.

jonnysparkplugs commented 11 years ago

I've just tested it and it works perfectly on Android now after a screen rotate. Thanks for the fix and again for the library