Created
June 4, 2012 04:08
-
-
Save wwwins/2866269 to your computer and use it in GitHub Desktop.
starling main class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.display.Sprite; | |
import flash.display.StageAlign; | |
import flash.display.StageScaleMode; | |
import flash.events.Event; | |
import starling.core.Starling; | |
[SWF( width="800", height="600", frameRate="60" , backgroundColor="0xCCCCCC")] | |
public class Main extends Sprite | |
{ | |
private var starling:Starling; | |
public function Main():void | |
{ | |
stage.scaleMode = StageScaleMode.NO_SCALE; | |
stage.align = StageAlign.TOP_LEFT; | |
// pass Game class | |
starling = new Starling(Game, stage); | |
starling.start(); | |
starling.stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated); | |
} | |
private function onContextCreated(e:Event):void | |
{ | |
// set framerate to 30 in software mode | |
trace("info:",Starling.context.driverInfo); | |
if (Starling.context.driverInfo.toLowerCase().indexOf("software") != -1) | |
Starling.current.nativeStage.frameRate = 30; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment