Пример #1
0
        public Animation(Frame[] frames, int fps)
        {
            this.frames = frames;
            this.activeIndex = 0;

            this.interval = TimeSpan.FromSeconds(1.0d / fps);
            this.elapsed = TimeSpan.Zero;
        }
        void window_Load(object sender, EventArgs e)
        {
            this.GraphicsContext = new DebugGraphicsContext(new OpenGLGraphicsContext());
            var locator = new ServiceLocator();
            locator.RegisterService<IGraphicsContext>(this.GraphicsContext);

            var resourceLoader = new ResourceLoader();
            resourceLoader.AddImportersAndProcessors(typeof(ResourceLoader).Assembly);

            this.Resourses = new ResourceContext(locator, new TypeReaderFactory(), new TypeWriterFactory(), resourceLoader,
                                                        Path.Combine(this.resourceFolder, "Assets"), this.resourceFolder);
            this.Resourses.ShouldSaveAllLoadedAssets = false;

            pixel = this.Resourses.LoadAsset<TextureAtlas>("Fonts\\Metro_W_Pixel.atlas")["pixel"];
            var effect = this.Resourses.LoadAsset<ShaderProgram>("Basic.effect");
            this.spriteBuffer = new SpriteBuffer(this.GraphicsContext, effect);
            this.guiRenderer = new GUIRenderer(this.spriteBuffer, pixel);

            window.VSync = VSyncMode.Off;
            window.Keyboard.KeyRepeat = true;

            // Other state
            GraphicsContext.Enable(EnableCap.Blend);
            GraphicsContext.Enable(EnableCap.ScissorTest);
            GraphicsContext.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);

            var factory = CreateGUIFactory();
            this.Load(factory);

            clock = new Clock();
        }
Пример #3
0
 public ImageBox(Frame image)
 {
     this.Image = image;
     this.ImageColor = Color.White;
 }
 public void DrawFrame(Frame frame, ref Rect rect, Color color)
 {
     this.batch.BufferFrame(frame, rect, color);
 }
 public GUIRenderer(ISpriteBuffer batch, Frame pixel)
 {
     this.batch = batch;
     this.pixel = pixel;
 }
Пример #6
0
 public Panel(Frame frame = null)
 {
     this.BackgroundImage = frame;
 }