Example #1
0
		private Director() {
			_pixelFormat = Texture2DPixelFormat.RGB565;
			_depthBufferFormat = DepthBufferFormat.DepthBufferNone;
			RunningScene = null;
			_oldAnimationInterval = AnimationInterval = 1.0 / DefaultFPS;
			
			_sceneStack = new Stack<Scene>(10);
			_nextScene = new WeakReference(null);
			
			DeviceOrientation = DeviceOrientation.Portrait;
			
			IsDisplayFPS = false;
			_frames = 0;
			
			IsPaused = false;
		}
Example #2
0
        private void InitWithData(byte[] data, Texture2DPixelFormat pixelFormat, int pixelsWide, int pixelsHigh, SizeF contentSize)
        {
            GL.GenTextures(1, ref _name);
            GL.BindTexture(All.Texture2D, _name);

            SetAntiAliasTexParameters();

            switch (pixelFormat) {
                case Texture2DPixelFormat.RGBA8888:
                    GL.TexImage2D(All.Texture2D, 0, (int)All.Rgba, pixelsWide, pixelsHigh, 0, All.Rgba, All.UnsignedByte, data);
                    break;
                case Texture2DPixelFormat.RGBA4444:
                    GL.TexImage2D(All.Texture2D, 0, (int)All.Rgba, pixelsWide, pixelsHigh, 0, All.Rgba, All.UnsignedShort4444, data);
                    break;
                case Texture2DPixelFormat.RGB5A1:
                    GL.TexImage2D(All.Texture2D, 0, (int)All.Rgba, pixelsWide, pixelsHigh, 0, All.Rgba, All.UnsignedShort5551, data);
                    break;
                case Texture2DPixelFormat.RGB565:
                    GL.TexImage2D(All.Texture2D, 0, (int)All.Rgb, pixelsWide, pixelsHigh, 0, All.Rgb, All.UnsignedShort565, data);
                    break;
                case Texture2DPixelFormat.A8:
                    GL.TexImage2D(All.Texture2D, 0, (int)All.Alpha, pixelsWide, pixelsHigh, 0, All.Alpha, All.UnsignedByte, data);
                    break;
                default:
                    throw new InvalidEnumArgumentException("pixelFormat", (int)pixelFormat, typeof(Texture2DPixelFormat));
            }

            ContentSize = contentSize;
            PixelsWide = pixelsWide;
            PixelsHigh = pixelsHigh;
            PixelFormat = pixelFormat;
            MaxS = ContentSize.Width / PixelsWide;
            MaxT = ContentSize.Height / PixelsHigh;

            HasPremultipliedAlpha = false;
        }